[monit] début de monitoring de gunicorn

Thx to gunicorn-debian et ses fichiers de confs/initscripts bien foutus.
Pour l'instant seuls o2 et routeur sont monitorés. Reste à intégrer
niomniom lorsqu'il sera migré sur wheezy.
This commit is contained in:
Daniel STAN 2013-05-25 17:31:17 +02:00
parent 26116973ab
commit 45114d90f5
4 changed files with 31 additions and 6 deletions

3
Bundler/gunicorn.xml Normal file
View file

@ -0,0 +1,3 @@
<Bundle name="gunicorn">
<Package name="gunicorn"/>
</Bundle>

View file

@ -766,17 +766,27 @@
<Group name="portail-captif">
<Group name="nginx" comment="Proxy web et pages déco"/>
<Group name="gunicorn" comment="backend du proxy (pages déco)" />
<Group name="secrets-acl"/>
</Group>
<Group name="intranet2-server"
comment="le serveur HTTPS (port 443) gérant intranet2.crans.org">
<Group name="nginx" comment="Pour l'intranet"/>
<Group name="gunicorn" />
<Group name="secrets-acl"/>
</Group>
<Group name="wiki">
<Bundle name="moinmoin" />
<!--<Group name="gunicorn"/> TODO: faire une conf propre lors du passage
à wheezy (un fichier de conf dans /etc/gunicorn.d/ et décommenter
cette ligne-->
</Group>
<Group name="gunicorn" comment="green unicorn, ce groupe sert principalement
à la génération de monit.">
<Bundle name="gunicorn" />
</Group>
<!-- *** FTP *** -->

3
Probes/gunicorn-debian Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
# Liste les sites configures pour gunicorn (pour monitoring par ex)
ls /etc/gunicorn.d 2> /dev/null

View file

@ -52,6 +52,21 @@ service("apache",
service('nginx')
if has('gunicorn'):
# on utilise le prob gunicorn-debian, qui liste les sites actifs sur
# /etc/gunicorn.d/
re_ignore = re.compile(r'(^_|\.(dpkg-(old|dist|new|tmp)|example)$|\.pyc|\.comc$)')
for site in metadata.Probes["gunicorn-debian"].splitlines():
site = site.strip()
if re_ignore.search(site):
continue
service(None,
name="gunicorn_%s" % site,
start_cmd = "/etc/init.d/gunicorn start %s" % site,
stop_cmd = "/etc/init.d/gunicorn stop %s" % site,
pidf = "gunicorn/%s" % site,
)
service("at",
init="atd",
pidf="atd")
@ -234,12 +249,6 @@ for i in range(0,dernierecarte):
@
if hostname in ['routeur']:
@# gunicorn
@check process gunicorn with pidfile /var/run/gunicorn/blacklist.pid
@ start program = "/etc/init.d/gunicorn start"
@ stop program = "/etc/init.d/gunicorn stop"
@ if 5 restarts within 5 cycles then timeout
@
@# igmpproxy
@check process igmpproxy with pidfile /var/run/igmpproxy.pid
@ start program = "/etc/init.d/igmpproxy start"