diff --git a/munin/audimat b/munin/audimat index 7834251f..773f058f 100755 --- a/munin/audimat +++ b/munin/audimat @@ -93,7 +93,7 @@ if 'generate' in sys.argv : total = 0 - f = open('/tmp/audimat','w') + f = open('/var/lib/munin/tmp/audimat','w') for ip, nom in chaines.items() : if not nom : continue @@ -112,6 +112,6 @@ if 'generate' in sys.argv : #################################################################### try : - print file("/tmp/audimat").read() + print file("/var/lib/munin/tmp/audimat").read() except : pass diff --git a/munin/snmp__if__ b/munin/snmp__if__ index a6fa8574..ef42236a 100755 --- a/munin/snmp__if__ +++ b/munin/snmp__if__ @@ -67,13 +67,19 @@ if (defined $ARGV[0] and $ARGV[0] eq "snmpconf") if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_if_([^_]+)_(.+)$/) { $host = $1; - $name = $2; + $name = $2; $iface = $3; if ($host =~ /^([^:]+):(\d+)$/) { $host = $1; $port = $2; } + if ($host !~ /\.adm\.crans\.org$/) + { + $host .= ".adm.crans.org"; + } + + print "Host:$host\nName:$name\niface:$iface\n"; } else { diff --git a/munin/stats-ip b/munin/stats-ip index 56d4e2e2..dd305a05 100755 --- a/munin/stats-ip +++ b/munin/stats-ip @@ -5,10 +5,9 @@ import sys sys.path.append('/usr/scripts/gestion') - -from ldap_crans import crans_ldap from config import NETs -from iptools import AddrInNet + +fichier = "/var/lib/munin/tmp/stats-ip" try : arg = sys.argv[1] @@ -27,9 +26,15 @@ if arg == "config" : print "%s.warning 92" % nom print "%s.critical 98" % nom -else : +elif arg == "fichier" : + + from ldap_crans import crans_ldap + from iptools import AddrInNet + 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]: @@ -41,4 +46,6 @@ else : pourcentage = int((utilisees*100)/total) nom = subnet.replace('-', '') - print "%s.value %d" % (nom, pourcentage) + out.write("%s.value %d\n" % (nom, pourcentage)) +else: + print file(fichier).read() diff --git a/munin/stats-ip_ b/munin/stats-ip_ index f50b8db0..a1fe817e 100755 --- a/munin/stats-ip_ +++ b/munin/stats-ip_ @@ -8,10 +8,6 @@ fichier = '/var/lib/munin/tmp/stats-ip_' import sys, os, string sys.path.append('/usr/scripts/gestion') -from ldap_crans import crans_ldap -from config import NETs -from iptools import AddrInNet - # On prend l'argument pour définir la plage d'ip à analyser SUBNET = sys.argv[0].split('_')[1] @@ -34,6 +30,10 @@ if arg == "config" : print "total.label Total disponibles" elif arg == "fichier" : + + from ldap_crans import crans_ldap + from config import NETs + from iptools import AddrInNet ips = [ x.ip() for x in crans_ldap().search('ip=*')['machine'] ]