[munin.conf] On split wifi_clients par borne
Et on génère la liste des bornes wifi de manière plus fine.
This commit is contained in:
parent
afee462b63
commit
5f4535b5c5
1 changed files with 24 additions and 12 deletions
|
@ -4,9 +4,7 @@
|
|||
# --
|
||||
# Daniel STAN
|
||||
|
||||
# List: print metadata.query.names_by_groups(['mail-mx-main'])
|
||||
#print metadata.query.names_by_groups(['mail-mx-main'])
|
||||
|
||||
include("ldap_conn")
|
||||
import annuaires_pg
|
||||
|
||||
print """
|
||||
|
@ -42,19 +40,30 @@ for host in switchs:
|
|||
|
||||
print """
|
||||
#============================== Les bornes wifi ============================
|
||||
#Idem."""
|
||||
import subprocess
|
||||
host_serv = metadata.query.by_groups(['dns-primary'])[0].hostname
|
||||
req = subprocess.Popen(['/usr/bin/host', '-l', '148.231.138.in-addr.arpa', host_serv],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
#On emprunte des données venant du graphe multistacké wifi_clients (sur gordon)
|
||||
# """
|
||||
|
||||
out,_ = req.communicate()
|
||||
for line in out.split('\n'):
|
||||
fqdn = line.split(' ')[-1][:-1]
|
||||
if not fqdn: continue
|
||||
for ap in ldap_conn.search('objectClass=borneWifi'):
|
||||
# skip fake ap
|
||||
skip = False
|
||||
for comment in ap['info']:
|
||||
if comment.value.startswith('test') or \
|
||||
comment.value.startswith('<'):
|
||||
skip = True
|
||||
if skip:
|
||||
continue
|
||||
|
||||
fqdn = ap['host'][0].value.encode('utf-8')
|
||||
profile = fqdn.split('.',1)[0]
|
||||
print """[wifi.crans.org;%(profile)s]
|
||||
address localhost
|
||||
|
||||
wifi_clients.graph_title Clients connectés
|
||||
wifi_clients.update no
|
||||
wifi_clients.graph_category wifi
|
||||
wifi_clients.graph_order \\
|
||||
clients=crans.org;gordon.crans.org:wifi_clients.%(profile)s
|
||||
|
||||
""" % { 'hostname': fqdn,
|
||||
'profile': profile,
|
||||
}
|
||||
|
@ -91,6 +100,9 @@ for line in out.split('\n'):
|
|||
|
||||
|
||||
print # Listes des serveurs
|
||||
print """
|
||||
#===================== Serveurs réguliers ==================================
|
||||
# """
|
||||
all_servers = metadata.query.all()
|
||||
all_servers.sort(key=lambda x: x.hostname)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue