119 lines
3.2 KiB
Python
Executable file
119 lines
3.2 KiB
Python
Executable file
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
# This is work in progress, please do not commit
|
|
# --
|
|
# Daniel STAN
|
|
|
|
include("ldap_conn")
|
|
import annuaires_pg
|
|
|
|
print """
|
|
# The next three variables specifies where the location of the RRD
|
|
# databases, the HTML output, and the logs, severally. They all
|
|
# must be writable by the user running munin-cron.
|
|
dbdir /var/lib/munin
|
|
htmldir /var/www/munin
|
|
logdir /var/log/munin
|
|
rundir /var/run/munin
|
|
|
|
# Envoi automatique des alertes par mail.
|
|
contact.roots.command mail -s "Munin - ${var:host} : ${var:graph_title}" nobody@crans.org
|
|
contact.impression.command mail -s "Munin - ${var:graph_title}" impression@crans.org
|
|
|
|
# Nagios
|
|
contact.nagios.command /usr/sbin/send_nsca -H localhost -c /etc/send_nsca.cfg -to 120
|
|
contacts nagios
|
|
|
|
# Les graphes sont réalisés via le CGI
|
|
graph_strategy cgi
|
|
cgiurl /cgi-bin
|
|
cgiurl_graph /cgi-bin/munin-cgi-graph
|
|
|
|
#============================== Les switchs ================================
|
|
#Il ne s'agit pas de clients bcfg2 et ne sont par ailleurs pas des nœuds munin
|
|
"""
|
|
switchs = [ x[:x.rindex('.crans.org')] for x in annuaires_pg.all_switchs(hide=[]) ]
|
|
for host in switchs:
|
|
print '[switchs.crans.org;%s]' % host
|
|
print ' address localhost\n'
|
|
|
|
|
|
print """
|
|
#============================== Les bornes wifi ============================
|
|
#On emprunte des données venant du graphe multistacké wifi_clients (sur gordon)
|
|
# """
|
|
|
|
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,
|
|
}
|
|
|
|
|
|
#@[switchs.crans.org;supervision.switchs.crans.org]
|
|
#@update no
|
|
|
|
#
|
|
#@# Les adherents
|
|
#@[association.crans.org;adherents]
|
|
#@ address localhost
|
|
#@
|
|
#@# Les adresses ips
|
|
#@[association.crans.org;adresses-ip]
|
|
#@ address localhost
|
|
#@
|
|
#@# Les stats wiki
|
|
#@[association.crans.org;web.wiki]
|
|
#@ address niomniom.adm.crans.org
|
|
#@
|
|
#@# Les stats web (sur zamok)
|
|
#@[association.crans.org;web.zamok]
|
|
#@ address zamok.adm.crans.org
|
|
#@
|
|
#@# statistiques
|
|
#@[association.crans.org;jabber]
|
|
#@ address xmpp.adm.crans.org
|
|
#@
|
|
#@# Imprimante
|
|
#@[association.crans.org;canon]
|
|
#@ address zamok.adm.crans.org
|
|
#@ contacts impression
|
|
|
|
|
|
print # Listes des serveurs
|
|
print """
|
|
#===================== Serveurs réguliers ==================================
|
|
# """
|
|
all_servers = metadata.query.all()
|
|
all_servers.sort(key=lambda x: x.hostname)
|
|
|
|
for client in all_servers:
|
|
print """[crans.org;%(profile)s]
|
|
address %(hostname)s
|
|
apt.graph yes
|
|
postfix_mailqueue.deferred.warning 1000
|
|
""" % { 'hostname': client.hostname,
|
|
'profile': client.profile,
|
|
}
|
|
|
|
print "[crans.org;]"
|
|
print " node_order " + " \\\n ".join([c.profile for c in all_servers])
|