From 945c02bd73369ded8a57a588151dd157ca940a42 Mon Sep 17 00:00:00 2001 From: Antoine Durand-Gasselin Date: Tue, 26 May 2009 13:12:27 +0200 Subject: [PATCH] =?UTF-8?q?[munin/uptime=5Fswitch]=20on=20r=C3=A9cup=C3=A8?= =?UTF-8?q?re=20l'uptime=20des=20switchs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit darcs-hash:20090526111227-bd074-9ba606ef1a9bd6b93d25ab79db23853ceaba6f9e.gz --- munin/uptime_switch | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 munin/uptime_switch diff --git a/munin/uptime_switch b/munin/uptime_switch new file mode 100755 index 00000000..7cb6443d --- /dev/null +++ b/munin/uptime_switch @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Plugin to measure uptime. Especially the average and max values on the +# bigger graphs (yearly) can be interesting. +# +# Contributed by Antoine Durand-Gasselin + +if [ "$1" = "autoconf" ]; then + echo yes + exit 0 +fi + +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 + exit 0 +fi + +for i in multiprise \ + `host -l adm.crans.org | sed -ne 's/\(bat[a-u]-[0-9]\).*$/\1/p'`; do + (snmpget -O v -v 1 -c public $i sysUpTimeInstance 2> /dev/null || true) | \ + perl -nle "{ /[0-9]+/; print sprintf(\"$i.value %.2f\", ($& / 8640000));}"& +done +