Commit 4a225f13 authored by Daniel Stan's avatar Daniel Stan

munin: s/dyson/munin-server/ (spec par bcfg2)

On s'autorise à lister les plugins à activer sur la base des groupes bcfg2
d'un serveur, au lieu de spécifier en dur le nom du serveur.
parent 13d839ee
......@@ -29,6 +29,8 @@ cron_plugins = {
# Hôtes pour lesquels le firewall est muninisé
munin_fw = sorted(["zamok", "komaz", "sable"])
# Les clés correspondent au nom du serveur, ou à un des groupes (bcfg2)
# possédé par le serveur (cf gestion/config/services.py )
hosts_plugins = {
"vo": {
"coretemp": "/usr/scripts/munin/coretemp",
......@@ -73,10 +75,6 @@ hosts_plugins = {
"coretemp": "/usr/scripts/munin/coretemp",
"bind9_rndc": "/usr/share/munin/plugins/bind9_rndc",
},
"gordon": {
"coretemp": "/usr/scripts/munin/coretemp",
"bind9_rndc": "/usr/share/munin/plugins/bind9_rndc",
},
"routeur": {
"bind9_rndc": "/usr/share/munin/plugins/bind9_rndc",
},
......@@ -100,7 +98,7 @@ hosts_plugins = {
"wiki_themes": "wiki_themes",
"wiki_users": "wiki_users",
},
"dyson": {
"munin-server": {
"audimat": "audimat",
"batiments": "batiments",
"munin": "munin",
......@@ -132,16 +130,16 @@ general_plugins = {
# Trucs spécifiques à munin.crans.org
# Onduleur
for mge_truc in ["batt", "hygro", "intensite", "temp", "temps", "tension"]:
hosts_plugins["dyson"]["mge_%s" % mge_truc] = "mge_%s" % mge_truc
hosts_plugins["munin-server"]["mge_%s" % mge_truc] = "mge_%s" % mge_truc
# Stats d'utilisation des réseaux
for net in config.NETs:
hosts_plugins["dyson"]["stats-ip_%s" % net] = "stats-ip_"
hosts_plugins["munin-server"]["stats-ip_%s" % net] = "stats-ip_"
# Stats de peuplement des bâtiments
for bat in annuaires.bat_switchs:
if bat not in ('v',):
hosts_plugins["dyson"]["stats-batiment_%s" % bat] = "stats-batiment_"
hosts_plugins["munin-server"]["stats-batiment_%s" % bat] = "stats-batiment_"
# Ping de tous les switches de bâtiments
for switch in annuaires.all_switchs(hide=[]):
......@@ -149,7 +147,7 @@ for switch in annuaires.all_switchs(hide=[]):
# (tous les switchs n'étant pas sur adm, on garde quand-même ce suffixe)
switch = switch[:switch.rindex('.crans.org')]
switch = switch.replace('-', '_')
hosts_plugins["dyson"]["ping_%s" % switch] = "ping_bat_"
hosts_plugins["munin-server"]["ping_%s" % switch] = "ping_bat_"
# On rajoute les stats de connexion
for host in hosts_plugins.keys():
......
#!/usr/bin/env python
#!/bin/bash /usr/scripts/python.sh
# -*- coding: utf-8 -*-
#
# Liste les liens à créer pour les plugins munin.
......@@ -42,7 +42,7 @@ IGNORE_PLUGINS = (
'vlan_',
)
if socket.gethostname() in services.services.get('iscsi', []):
if socket.gethostname() in services.get('iscsi', []):
IGNORE_PLUGINS += (
'diskstat',
'diskstats',
......@@ -128,6 +128,9 @@ def get_all_plugins():
result = get_munin_plugins()
custom_plugins = hosts_plugins.get(hostname, {})
for (group, hosts) in services.iteritems():
if hostname in hosts:
custom_plugins.update(hosts_plugins.get(group, {}))
custom_plugins.update(general_plugins)
for plugin, dest_file in custom_plugins.iteritems():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment