crans_bcfg2/Python/etc/munin/munin-test.conf
Daniel STAN 354d60a8a1 [munin.conf] genauto liste switchs
munin.conf is still wip, mais comme la modif traînait non commitée,
je la fait passer pour ne plus vous embêter avec.
2013-04-16 11:43:42 +02:00

85 lines
2.3 KiB
Python
Executable file

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This is work in progress, please do not commit
# --
# Daniel STAN
# List: print metadata.query.names_by_groups(['mail-mx-main'])
#print metadata.query.names_by_groups(['mail-mx-main'])
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.split('.')[0] for x in annuaires_pg.all_switchs() ] + ['backbone']
for host in switchs:
print '[switchs.crans.org;%s]' % host
print ' address localhost\n'
#@[switchs.crans.org;supervision.switchs.crans.org]
#@update no
### Todo: bornes: host -l 148.231.138.in-addr.arpa
#
#@# 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
for client in metadata.query.all():
print """[%(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 metadata.query.all()])