Skip to content

Instantly share code, notes, and snippets.

@nanawel
Created May 26, 2015 22:02
Show Gist options
  • Save nanawel/3fc847ef434553a591c1 to your computer and use it in GitHub Desktop.
Save nanawel/3fc847ef434553a591c1 to your computer and use it in GitHub Desktop.
Munin plugin to monitor Tenki sensor Temperature
#!/bin/sh
#
# Plugin to monitor Tenki sensor Temperature
#
# Magic markers (optional - only used by munin-config and some installation scripts):
#%# family=contrib
TENKIGET=/usr/local/bin/usbtenkiget
WARN=30
CRIT=38
SENSORID=${0##*/tenkitemp_}
if [ "$1" = "autoconf" ]; then
if [ -x $TENKIGET ]; then
echo yes
exit 0
else
echo no
exit 1
fi
elif [ "$1" = "config" ]; then
echo "graph_title Tenki Temperature Sensor"
echo "graph_args --base 1000"
echo "graph_vlabel Celsius"
echo "graph_category sensors"
echo "graph_info This graph shows Temperature data from sensor $SENSORID"
echo "temp.label temp"
echo "temp.type GAUGE"
echo "temp.info Celsius."
echo "temp.colour 00ff00"
echo "temp.warning $WARN"
echo "temp.critical $CRIT"
exit 0
elif [ "$1" = "suggest" ]; then
$TENKIGET -l | sed -n 's/.*Channel \([0-9]\{1,\}\):.*/\1/p'
exit 0
elif [ $SENSORID = "" ]; then
echo Missing sensor ID. Try "suggest".
exit 2
fi
temp=$($TENKIGET -i $SENSORID)
echo "temp.value $temp"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment