[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
|
# Daniel STAN
|
||||||
|
|
||||||
# List: print metadata.query.names_by_groups(['mail-mx-main'])
|
include("ldap_conn")
|
||||||
#print metadata.query.names_by_groups(['mail-mx-main'])
|
|
||||||
|
|
||||||
import annuaires_pg
|
import annuaires_pg
|
||||||
|
|
||||||
print """
|
print """
|
||||||
|
@ -42,19 +40,30 @@ for host in switchs:
|
||||||
|
|
||||||
print """
|
print """
|
||||||
#============================== Les bornes wifi ============================
|
#============================== Les bornes wifi ============================
|
||||||
#Idem."""
|
#On emprunte des données venant du graphe multistacké wifi_clients (sur gordon)
|
||||||
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)
|
|
||||||
|
|
||||||
out,_ = req.communicate()
|
for ap in ldap_conn.search('objectClass=borneWifi'):
|
||||||
for line in out.split('\n'):
|
# skip fake ap
|
||||||
fqdn = line.split(' ')[-1][:-1]
|
skip = False
|
||||||
if not fqdn: continue
|
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]
|
profile = fqdn.split('.',1)[0]
|
||||||
print """[wifi.crans.org;%(profile)s]
|
print """[wifi.crans.org;%(profile)s]
|
||||||
address localhost
|
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,
|
""" % { 'hostname': fqdn,
|
||||||
'profile': profile,
|
'profile': profile,
|
||||||
}
|
}
|
||||||
|
@ -91,6 +100,9 @@ for line in out.split('\n'):
|
||||||
|
|
||||||
|
|
||||||
print # Listes des serveurs
|
print # Listes des serveurs
|
||||||
|
print """
|
||||||
|
#===================== Serveurs réguliers ==================================
|
||||||
|
# """
|
||||||
all_servers = metadata.query.all()
|
all_servers = metadata.query.all()
|
||||||
all_servers.sort(key=lambda x: x.hostname)
|
all_servers.sort(key=lambda x: x.hostname)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue