diff --git a/munin/audimat b/munin/audimat index a855d650..1faf1e3f 100644 --- a/munin/audimat +++ b/munin/audimat @@ -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,[])) diff --git a/munin/stats-batiment_ b/munin/stats-batiment_ index 509a81e1..f8c73054 100644 --- a/munin/stats-batiment_ +++ b/munin/stats-batiment_ @@ -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()) diff --git a/munin/stats-ip b/munin/stats-ip index dd305a05..43ac330c 100644 --- a/munin/stats-ip +++ b/munin/stats-ip @@ -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: