From 9648a17acffe50e9bc43c15b5364eb1d94e4dfbf Mon Sep 17 00:00:00 2001 From: Antoine Durand-Gasselin Date: Fri, 29 May 2009 14:39:07 +0200 Subject: [PATCH] [uptime_switch] ajout du backbone darcs-hash:20090529123907-bd074-bac08bcba6537af04fe977fefacaf158a34fd7b2.gz --- munin/uptime_switch | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/munin/uptime_switch b/munin/uptime_switch index affa112a..117f8831 100755 --- a/munin/uptime_switch +++ b/munin/uptime_switch @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/zsh # # Plugin to measure uptime. Especially the average and max values on the # bigger graphs (yearly) can be interesting. @@ -10,21 +10,20 @@ if [ "$1" = "autoconf" ]; then exit 0 fi -if [ "$1" = "config" ]; then +switchs=(multiprise backbone\ + `host -l adm.crans.org | sed -ne 's/\(bat[a-u]-[0-9]\).*$/\1/p'`) +if [ "$1" = "config" ]; then echo "host_name uptime.switchs.crans.org" echo 'graph_title Uptime' echo 'graph_args --base 1000 -l 0 ' echo 'graph_vlabel uptime in days' -for i in multiprise \ - `host -l adm.crans.org | sed -ne 's/\(bat[a-u]-[0-9]\).*$/\1/p'`; do - echo "${i/-/}.label uptime $i"; done + for i in $switchs; do echo "${i/-/}.label uptime $i"; done exit 0 fi -for i in multiprise \ - `host -l adm.crans.org | sed -ne 's/\(bat[a-u]-[0-9]\).*$/\1/p'`; do - snmpget -t 0.05 -O v -v 1 -c public $i sysUpTimeInstance 2> /dev/null | \ +for i in $switchs; do + snmpget -t 0.05 -O v -v 1 -c public $i.adm sysUpTimeInstance 2> /dev/null | \ perl -nle "{ /\d+/; print sprintf(\"${i/-/}.value %.2f\", ($&/8640000));}"& done