retrait plugin stats-ip_ (redondant)

This commit is contained in:
Daniel STAN 2015-08-13 19:09:40 +02:00
parent c6e3bf4f44
commit b9cecfbc9e
2 changed files with 0 additions and 62 deletions

View file

@ -21,7 +21,6 @@ cron_plugins = {
# %s est remplacé par le lien dans /etc/munin/plugins # %s est remplacé par le lien dans /etc/munin/plugins
"audimat": ("root", "nice -n 14 %s generate 2> /dev/null"), "audimat": ("root", "nice -n 14 %s generate 2> /dev/null"),
"batiments": ("root", "nice -n 14 %s fichier 2> /dev/null"), "batiments": ("root", "nice -n 14 %s fichier 2> /dev/null"),
"stats-ip_": ("root", "nice -n 14 %s fichier 2> /dev/null"),
"stats-ip": ("root", "nice -n 14 %s fichier 2> /dev/null"), "stats-ip": ("root", "nice -n 14 %s fichier 2> /dev/null"),
"wiki_pages": ("www-data", "%s fichier 2> /dev/null"), "wiki_pages": ("www-data", "%s fichier 2> /dev/null"),
} }
@ -153,10 +152,6 @@ general_plugins = {
for mge_truc in ["batt", "hygro", "intensite", "temp", "temps", "tension"]: for mge_truc in ["batt", "hygro", "intensite", "temp", "temps", "tension"]:
hosts_plugins["munin-server"]["mge_%s" % mge_truc] = "mge_%s" % mge_truc hosts_plugins["munin-server"]["mge_%s" % mge_truc] = "mge_%s" % mge_truc
# Stats d'utilisation des réseaux
for net in config.NETs:
hosts_plugins["munin-server"]["stats-ip_%s" % net] = "stats-ip_"
# Stats de peuplement des bâtiments # Stats de peuplement des bâtiments
for bat in annuaires.bat_switchs: for bat in annuaires.bat_switchs:
if bat not in ('v',): if bat not in ('v',):

View file

@ -1,57 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Plugin pour visualiser l'utilisation des plages ip
fichier = '/var/lib/munin/tmp/stats-ip_'
import sys, os, string
sys.path.append('/usr/scripts/gestion')
# 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"
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'] ]
file = open('%s%s.next' % (fichier, SUBNET), 'w')
total = 0
for net in NETs[SUBNET]:
total += 2 ** ( 32 - int( net.split('/')[1] ) )
# on ne prend pas en compte les adresses .0 et .255
total = total - int(total/128)
utilisees = len( [ ip for ip in ips if AddrInNet( ip, NETs[SUBNET] ) ] )
file.write("utilisees.value %d\n" % utilisees)
file.write("total.value %s\n" % total)
file.close()
os.system('mv %s%s.next %s%s' % (fichier, SUBNET, fichier, SUBNET))
else :
os.system('cat %s%s' % (fichier, SUBNET))