[munin-server] auto genconf a partir de bcfg2

Ignore-this: 551f9701e7c9776afeed0117dc764bb5
Ce script récupère les différentes infos provenant de bcfg2 (clients, hostname,
services associés) et génère la configuration munin associée. Pour l'instant,
on ne génère qu'une version de test qui n'est pas utilisée en prod: sur vo,
je vais prochainement faire un symlink, pour tester sans écraser le site web
à chaque fois.

darcs-hash:20130120022727-28565-4b1281b25ac0f01144ed821b65e031efc1b50a91.gz
This commit is contained in:
Daniel STAN 2013-01-20 03:27:27 +01:00
parent f50cbe47e4
commit 3eb690da0b
3 changed files with 88 additions and 0 deletions

View file

@ -0,0 +1,82 @@
#!/usr/bin/env python
# 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'])
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 = ['backbone','batb-4'] # Todo: real list
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
@# 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()])