[munin] strip wsp
darcs-hash:20100211115432-bd074-21666d2a895a1476c2af86a6968e60f6e011858e.gz
This commit is contained in:
parent
909aff2221
commit
2b2226644a
3 changed files with 14 additions and 14 deletions
|
@ -49,7 +49,7 @@ if 'config' in sys.argv :
|
|||
print "graph_args --base 1000";
|
||||
print "graph_vlabel nb clients/chaines";
|
||||
inc = 0
|
||||
chaines = chaines.values()
|
||||
chaines = chaines.values()
|
||||
chaines.sort()
|
||||
for nom in chaines :
|
||||
if not nom : continue
|
||||
|
@ -69,12 +69,12 @@ if 'config' in sys.argv :
|
|||
|
||||
if 'generate' in sys.argv :
|
||||
stats = {} # { IP : [ prises ] }
|
||||
|
||||
|
||||
for switch in all_switchs() :
|
||||
# on vérifie que le switch est pingable
|
||||
if os.system('ping -c 3 %s > /dev/null 2> /dev/null' % switch ) :
|
||||
continue
|
||||
|
||||
|
||||
sw = hpswitch(switch)
|
||||
switch=switch.split('.')[0]
|
||||
if switch[-1].isalpha() :
|
||||
|
@ -84,19 +84,19 @@ if 'generate' in sys.argv :
|
|||
bat = switch[-3].lower()
|
||||
sw_num = int(switch[-1])
|
||||
|
||||
if bat not in uplink_prises: #Adg fait de la merde avec l'annuaire
|
||||
continue
|
||||
#if bat not in uplink_prises:
|
||||
# continue
|
||||
for ip, liste in sw.multicast().items() :
|
||||
stats.setdefault(ip,[])
|
||||
for port in liste :
|
||||
num_port = 100 * sw_num + int(port)
|
||||
if num_port not in uplink_prises[bat].keys() :
|
||||
stats[ip].append('%s%03i' % (bat, num_port) )
|
||||
|
||||
|
||||
total = 0
|
||||
|
||||
f = open('/var/lib/munin/tmp/audimat','w')
|
||||
|
||||
|
||||
for ip, nom in chaines.items() :
|
||||
if not nom : continue
|
||||
nb_clients = len(stats.get(ip,[]))
|
||||
|
|
|
@ -28,7 +28,7 @@ def switch_prise(bat, prise) :
|
|||
multiprise = map(lambda x : len(x[1])>1 and x[0], reverse(BAT).items())
|
||||
while False in multiprise :
|
||||
multiprise.remove(False)
|
||||
|
||||
|
||||
try :
|
||||
arg = sys.argv[1]
|
||||
except :
|
||||
|
@ -73,7 +73,7 @@ else :
|
|||
except:
|
||||
PRISES_ENABLE -= 0
|
||||
print "enabled.value %d" % PRISES_ENABLE
|
||||
|
||||
|
||||
PRISES_ACTIVES = 0
|
||||
for switch in all_switchs(BAT) :
|
||||
try:
|
||||
|
@ -115,16 +115,16 @@ else :
|
|||
NB_PRISES += PRISES_FIXES
|
||||
print "prises.value %d" % NB_PRISES
|
||||
|
||||
|
||||
|
||||
print "reste.value %d" % int(NB_PRISES - PRISES_ENABLE - PRISES_FIXES - PRISES_CRANS)
|
||||
|
||||
|
||||
fichier = open(stats_batiments, 'r')
|
||||
#NB_ADHERENT = 0 # Plus génant qu'autre chose
|
||||
for line in fichier.readlines():
|
||||
if line[3:4] == BAT and line[:3] == "bat" :
|
||||
NB_ADHERENT = line[11:].strip()
|
||||
print "adherent.value %s" % NB_ADHERENT
|
||||
|
||||
|
||||
if BAT in BAT_CHBRES.keys() :
|
||||
print "chbres.value %d" % BAT_CHBRES[BAT]
|
||||
print "connues.value %d" % len(chbre_prises[BAT].keys())
|
||||
|
|
|
@ -34,7 +34,7 @@ elif arg == "fichier" :
|
|||
ips = [ x.ip() for x in crans_ldap().search('ip=*')['machine'] ]
|
||||
|
||||
out = file(fichier, "w")
|
||||
|
||||
|
||||
for subnet in NETs :
|
||||
total = 0
|
||||
for net in NETs[subnet]:
|
||||
|
@ -44,7 +44,7 @@ elif arg == "fichier" :
|
|||
|
||||
utilisees = len( [ ip for ip in ips if AddrInNet( ip, NETs[subnet] ) ] )
|
||||
pourcentage = int((utilisees*100)/total)
|
||||
|
||||
|
||||
nom = subnet.replace('-', '')
|
||||
out.write("%s.value %d\n" % (nom, pourcentage))
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue