Tweaking des plugins munin
darcs-hash:20080914174748-ffbb2-f90ffd8cb29070a3d0ed1c63d3b7302e07815ae4.gz
This commit is contained in:
parent
31539859ee
commit
cceeea27bb
4 changed files with 25 additions and 12 deletions
|
@ -93,7 +93,7 @@ if 'generate' in sys.argv :
|
||||||
|
|
||||||
total = 0
|
total = 0
|
||||||
|
|
||||||
f = open('/tmp/audimat','w')
|
f = open('/var/lib/munin/tmp/audimat','w')
|
||||||
|
|
||||||
for ip, nom in chaines.items() :
|
for ip, nom in chaines.items() :
|
||||||
if not nom : continue
|
if not nom : continue
|
||||||
|
@ -112,6 +112,6 @@ if 'generate' in sys.argv :
|
||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
try :
|
try :
|
||||||
print file("/tmp/audimat").read()
|
print file("/var/lib/munin/tmp/audimat").read()
|
||||||
except :
|
except :
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -74,6 +74,12 @@ if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_if_([^_]+)_(.+)$/)
|
||||||
$host = $1;
|
$host = $1;
|
||||||
$port = $2;
|
$port = $2;
|
||||||
}
|
}
|
||||||
|
if ($host !~ /\.adm\.crans\.org$/)
|
||||||
|
{
|
||||||
|
$host .= ".adm.crans.org";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "Host:$host\nName:$name\niface:$iface\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,10 +5,9 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
sys.path.append('/usr/scripts/gestion')
|
sys.path.append('/usr/scripts/gestion')
|
||||||
|
|
||||||
from ldap_crans import crans_ldap
|
|
||||||
from config import NETs
|
from config import NETs
|
||||||
from iptools import AddrInNet
|
|
||||||
|
fichier = "/var/lib/munin/tmp/stats-ip"
|
||||||
|
|
||||||
try :
|
try :
|
||||||
arg = sys.argv[1]
|
arg = sys.argv[1]
|
||||||
|
@ -27,9 +26,15 @@ if arg == "config" :
|
||||||
print "%s.warning 92" % nom
|
print "%s.warning 92" % nom
|
||||||
print "%s.critical 98" % 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'] ]
|
ips = [ x.ip() for x in crans_ldap().search('ip=*')['machine'] ]
|
||||||
|
|
||||||
|
out = file(fichier, "w")
|
||||||
|
|
||||||
for subnet in NETs :
|
for subnet in NETs :
|
||||||
total = 0
|
total = 0
|
||||||
for net in NETs[subnet]:
|
for net in NETs[subnet]:
|
||||||
|
@ -41,4 +46,6 @@ else :
|
||||||
pourcentage = int((utilisees*100)/total)
|
pourcentage = int((utilisees*100)/total)
|
||||||
|
|
||||||
nom = subnet.replace('-', '')
|
nom = subnet.replace('-', '')
|
||||||
print "%s.value %d" % (nom, pourcentage)
|
out.write("%s.value %d\n" % (nom, pourcentage))
|
||||||
|
else:
|
||||||
|
print file(fichier).read()
|
||||||
|
|
|
@ -8,10 +8,6 @@ fichier = '/var/lib/munin/tmp/stats-ip_'
|
||||||
import sys, os, string
|
import sys, os, string
|
||||||
sys.path.append('/usr/scripts/gestion')
|
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
|
# On prend l'argument pour définir la plage d'ip à analyser
|
||||||
SUBNET = sys.argv[0].split('_')[1]
|
SUBNET = sys.argv[0].split('_')[1]
|
||||||
|
|
||||||
|
@ -35,6 +31,10 @@ if arg == "config" :
|
||||||
|
|
||||||
elif arg == "fichier" :
|
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'] ]
|
ips = [ x.ip() for x in crans_ldap().search('ip=*')['machine'] ]
|
||||||
|
|
||||||
file = open('%s%s.next' % (fichier, SUBNET), 'w')
|
file = open('%s%s.next' % (fichier, SUBNET), 'w')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue