munin-node: dehardcoding des IPs

Et on rajoute une fonction kikoo pour lister toutes les IPs associées à une
liste de clients.
This commit is contained in:
Daniel STAN 2014-02-05 00:01:40 +01:00
parent 74bfd06b06
commit b9b889e238
2 changed files with 34 additions and 4 deletions

View file

@ -1,11 +1,17 @@
# -*- coding: utf-8; mode: python -*-
import sys
include("ip")
if '/usr/scripts/' not in sys.path:
sys.path.append('/usr/scripts/')
from gestion import config
info["owner"] = "root"
info["group"] = "root"
# Remplacement du nom d'hôte pour les hôtes particuliers
# (deprecated)
munin_hostname = {
"canard": "canard.ferme.crans.org",
"jouvence": "poulet.ferme.crans.org",
@ -47,10 +53,13 @@ print "host_name %s" % munin_hostname
@
if not has("users"):
@# On autorise tout adm et localhost
@allow ^10\.231\.136\..*$
@allow ^127\.0\.0\.1$
@allow ^2a01:240:fe3d:c804:.*$
@cidr_allow 127.0.0.0/8
@cidr_allow ::1/128
for net in config.NETs['adm'] + config.prefix['adm']:
print "cidr_allow " + net
else:
@# On autorise seulement le serveur munin
@allow ^10\.231\.136\.81$
@allow ^2a01:240:fe3d:c804:20f:1fff:fe66:e592$
for ip in ips_of_metadata(metadata.query.by_profiles(['munin-server'])):
print "cidr_allow %s/%d" % (ip, (128 if ':' in ip else 32))