(vieux) démantèlement de adm/
analyse-batg.py -> inutile analyse_upload -> inutile en l'état, il faudrait réécrire une version sudoers câbleurs. aptitude.sh -> grosse blague chambre -> inutile compress_ldap_log.sh -> (pseudo)doublon de utils/delete_ldap_log.sh avertissement_mails-perdus.py -> déplacement dans utils (peut servir) stats-ip.py -> déplacement dans utils (peut servir, quoique)
This commit is contained in:
parent
e4889fb907
commit
94bea9a366
7 changed files with 0 additions and 150 deletions
21
utils/stats_ip.py
Executable file
21
utils/stats_ip.py
Executable file
|
@ -0,0 +1,21 @@
|
|||
#! /usr/bin/env python
|
||||
# -*- coding: iso8859-15 -*-
|
||||
|
||||
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'] ]
|
||||
|
||||
for n in NETs:
|
||||
|
||||
nb_total = 0
|
||||
for net in NETs[n]:
|
||||
nb_total += 2 ** ( 32 - int( net.split('/')[1] ) )
|
||||
|
||||
nb_occupe = len( [ ip for ip in ips if AddrInNet( ip, NETs[n] ) ] )
|
||||
|
||||
print '%12s %2s%% (%s/%s)' % (n, 100*nb_occupe/nb_total, nb_occupe, nb_total)
|
Loading…
Add table
Add a link
Reference in a new issue