On regroupe les plugins munin dans un rpertoire commun toutes les machines
darcs-hash:20060420130121-72cb0-50f87f8f01382a2ddc9afec1b1b6e02890d8d32c.gz
This commit is contained in:
parent
674ee00ed0
commit
f672fa493b
23 changed files with 1451 additions and 0 deletions
41
munin/stats-ip
Executable file
41
munin/stats-ip
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: iso-8859-15 -*-
|
||||
|
||||
# Plugin pour visualiser l'utilisation des plages ip
|
||||
|
||||
import sys
|
||||
sys.path.append('/usr/scripts/gestion')
|
||||
|
||||
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'] ]
|
||||
|
||||
try :
|
||||
arg = sys.argv[1]
|
||||
except :
|
||||
arg = ''
|
||||
|
||||
if arg == "config" :
|
||||
print 'host_name adresses-ip'
|
||||
print 'graph_title Statistiques adresses IP'
|
||||
print 'graph_args --base 1000 --lower-limit 0'
|
||||
print 'graph_category network'
|
||||
print "graph_vlabel % d'utilisation"
|
||||
for subnet in NETs.keys():
|
||||
nom = subnet.replace('-', '')
|
||||
print "%s.label %s" % (nom, subnet)
|
||||
print "%s.warning 92" % nom
|
||||
print "%s.critical 98" % nom
|
||||
|
||||
else :
|
||||
for subnet in NETs :
|
||||
total = 0
|
||||
for net in NETs[subnet]:
|
||||
total += 2 ** ( 32 - int( net.split('/')[1] ) )
|
||||
utilisees = len( [ ip for ip in ips if AddrInNet( ip, NETs[subnet] ) ] )
|
||||
pourcentage = int((utilisees*100)/total)
|
||||
|
||||
nom = subnet.replace('-', '')
|
||||
print "%s.value %d" % (nom, pourcentage)
|
Loading…
Add table
Add a link
Reference in a new issue