On regroupe les plugins munin dans un rpertoire commun toutes les machines

darcs-hash:20060420130121-72cb0-50f87f8f01382a2ddc9afec1b1b6e02890d8d32c.gz
This commit is contained in:
salles 2006-04-20 15:01:21 +02:00
parent 674ee00ed0
commit f672fa493b
23 changed files with 1451 additions and 0 deletions

64
munin/batiments Executable file
View file

@ -0,0 +1,64 @@
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
fichier = '/var/lib/munin/tmp/batiments'
import sys,os
try :
arg = sys.argv[1]
except :
arg = ''
if arg == "config" :
print 'host_name adherents'
print 'graph_title Adhérents par batiments'
print "graph_args --base 1000 --lower-limit 0"
print "graph_vlabel nb d'adhérents"
print 'bata.label Bâtiment A'
print 'bata.draw AREA'
print 'batb.label Bâtiment B'
print 'batb.draw STACK'
print 'batc.label Bâtiment C'
print 'batc.draw STACK'
print 'batg.label Bâtiment G'
print 'batg.draw STACK'
print 'bath.label Bâtiment H'
print 'bath.draw STACK'
print 'bati.label Bâtiment I'
print 'bati.draw STACK'
print 'batj.label Bâtiment J'
print 'batj.draw STACK'
print 'batm.label Bâtiment M'
print 'batm.draw STACK'
print 'batp.label PdJ'
print 'batp.draw STACK'
print 'wifi.label Wifi'
print 'wifi.draw STACK'
print 'total.label Total'
elif arg == "fichier" :
file = open(fichier,'w')
sys.path.append('/usr/scripts/gestion')
from ldap_crans import crans_ldap
db = crans_ldap()
def count(filtre) :
data = db.search(filtre)
return len(data['adherent']) + len(data['club'])
total = 0
for bat in 'abcghijmp' :
nb = count('paiement=ok&chbre=%s*' % bat)
total += nb
file.write("bat%s.value %d\n" % (bat, nb))
nb = count('paiement=ok&chbre=EXT')
total += nb
file.write("wifi.value %d\n" % nb)
file.write("total.value %d\n" % total)
file.close()
else :
os.system('cat %s' % fichier)