Skip to content

Instantly share code, notes, and snippets.

@informationsea
Created December 19, 2013 03:58
Show Gist options
  • Save informationsea/8034200 to your computer and use it in GitHub Desktop.
Save informationsea/8034200 to your computer and use it in GitHub Desktop.
Munin plugin
#!/bin/sh
#. $MUNIN_LIBDIR/plugins/plugin.sh
TEMP=`ipmitool sensor|grep 'Temp'`
NUM=`echo "$TEMP"|wc -l`
if [ "$1" == "config" ];then
cat <<EOF
graph_title Temperatures
graph_vlabel degrees Celsius
graph_args --base 1000 -l 0
graph_category sensors
EOF
for i in `seq $NUM`; do
LINE="`echo "$TEMP"|sed -e "${i}q" -e d`"
echo temp${i}.label "`echo $LINE|cut -f 1 -d '|'`"
echo temp${i}.warning "`echo $LINE|cut -f 8 -d '|'`"
echo temp${i}.critical "`echo $LINE|cut -f 9 -d '|'`"
done
#NAMES=`echo -- "$TEMP"|cut -f 1 -d '|'`
#WARNING=`echo -- "$TEMP"|cut -f 8 -d '|'`
#CRITICAL=`echo -- "$TEMP"|cut -f 9 -d '|'`
#
#echo $NAMES
#echo $WARNING
#echo $CRITICAL
else
for i in `seq $NUM`; do
LINE="`echo "$TEMP"|sed -e "${i}q" -e d`"
echo temp${i}.value "`echo $LINE|cut -f 2 -d '|'`"
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment