scripts/munin/uptime_switch
Antoine Durand-Gasselin ce0ff42016 [munin/uptime_switch] timeout plus faible, manifesteement munin n'aime pas les tirets dans les noms de variables
darcs-hash:20090526141940-bd074-676eb42d7bbf85bb2226f8ce59875eb53f9138c5.gz
2009-05-26 16:19:40 +02:00

30 lines
817 B
Bash
Executable file

#!/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 -t 0.05 -O v -v 1 -c public $i sysUpTimeInstance 2> /dev/null | \
perl -nle "{ /\d+/; print sprintf(\"${i/-/}.value %.2f\", ($&/8640000));}"&
done