[monit] monitor des serveurs non-nfs
ie 2 dom0 et ovh. On pourrait envisager de généraliser, si on veut se passer du lagguy shitty /usr/scripts en nfs
This commit is contained in:
parent
0bd12f0956
commit
12c23579e9
1 changed files with 15 additions and 3 deletions
|
@ -8,14 +8,26 @@ info["perms"] = 0644
|
|||
@#
|
||||
@# A ne modifier que sur bcfg2
|
||||
|
||||
include('ip')
|
||||
|
||||
if has('wheezy'):
|
||||
monit_p = '/usr/bin/monit'
|
||||
else:
|
||||
monit_p = '/usr/sbin/monit'
|
||||
|
||||
if has('external'):
|
||||
@# Copie de `monit status` vers vert
|
||||
print "* * * * * root ( %s status | nc -q0 vert.adm.crans.org 5000 ) 2> /dev/null" % monit_p
|
||||
def has_shared_scripts(client):
|
||||
return ('external' not in client.groups) and (
|
||||
('nfs' in client.groups) or ('crans-nfs' in client.groups))
|
||||
|
||||
if has('autostatus'):
|
||||
comment("Seveurs ne possedant pas de nfs :")
|
||||
for client in metadata.query.all():
|
||||
if not has_shared_scripts(client):
|
||||
print "* * * * * root ( /bin/nc %s 4242 || true ) > /usr/scripts/var/monit/status/%s 2> /dev/null" % (client.hostname, client.hostname.split('.', 1)[0])
|
||||
|
||||
if not has_shared_scripts(metadata):
|
||||
comment("Pas de nfs: attente de connexion depuis le serveur d'autostatus")
|
||||
print '* * * * * root ( /bin/nc -w 60 -l -p 4242 -s %s -c "%s status" || true ) 2> /dev/null' % (admip(), monit_p)
|
||||
else:
|
||||
@# Copie de `monit status` sur le nfs
|
||||
print "* * * * * root %s status > /usr/scripts/var/monit/status/`hostname` 2> /dev/null" % monit_p
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue