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
43
munin/stats-ip_
Executable file
43
munin/stats-ip_
Executable file
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: iso-8859-15 -*-
|
||||
|
||||
# Plugin pour visualiser l'utilisation des plages ip
|
||||
|
||||
import sys, string
|
||||
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'] ]
|
||||
|
||||
# On prend l'argument pour définir la plage d'ip à analyser
|
||||
SUBNET = sys.argv[0].split('_')[1]
|
||||
|
||||
try :
|
||||
arg = sys.argv[1]
|
||||
except :
|
||||
arg = ''
|
||||
|
||||
if arg == "config" :
|
||||
if len(SUBNET) == 1 : NOM = "Bâtiment %s" % string.upper(SUBNET)
|
||||
else: NOM = SUBNET
|
||||
|
||||
print 'host_name adresses-ip'
|
||||
print 'graph_title Statistiques adresses IP - %s' % NOM
|
||||
print 'graph_args --base 1000 --lower-limit 0'
|
||||
print 'graph_category network'
|
||||
print "graph_vlabel nb d'ips"
|
||||
print "utilisees.label IP utilisées"
|
||||
print "utilisees.draw AREA"
|
||||
print "total.label Total disponibles"
|
||||
|
||||
else :
|
||||
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] ) ] )
|
||||
|
||||
print "utilisees.value %d" % utilisees
|
||||
print "total.value %s" % total
|
Loading…
Add table
Add a link
Reference in a new issue