puppet/munin/files/plugins/sensors_temp
2009-09-12 11:25:56 +03:00

55 lines
1.1 KiB
Bash
Executable file

#!/bin/sh
#
# Plugin to monitor temperature readings
#
# Parameters:
#
# config (required)
# autoconf (optional - only used by munin-config)
#
# Magic markers (optional - used by munin-config and some installation
# scripts):
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if ( sysctl -a hw.sensors 2>/dev/null >/dev/null ); then
echo yes
exit 0
else
if [ $? -eq 127 ]
then
echo "no (sysctl program not found)"
exit 1
else
echo no
exit 1
fi
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title temperature readings'
echo 'graph_args -l 0 --base 1000'
echo 'graph_vlabel degC ${graph_period}'
echo 'graph_category sensors'
echo 'graph_period second'
echo 'graph_info Temperature readings on mainboard and CPU'
echo 'mb.label mainboard'
echo 'mb.type GAUGE'
echo 'mb.min 15'
echo 'mb.max 150'
echo 'mb.info mainboard temperature (TSENS1).'
echo 'cpu.label CPU'
echo 'cpu.type GAUGE'
echo 'cpu.min 15'
echo 'cpu.max 150'
echo 'cpu.info CPU temperature (TSENS2).'
exit 0
fi
sysctl -a | awk '/TSENS1/ { print "mb.value " $4 } /TSENS2/ { print "cpu.value " $4 }'