mirror of
https://github.com/cmur2/munin-pcsensor.git
synced 2024-12-22 02:54:26 +01:00
32 lines
697 B
Bash
Executable File
32 lines
697 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Where is pcsensor located?
|
|
PCSENSOR="/usr/local/bin/pcsensor"
|
|
|
|
if [ ! -e ${PCSENSOR} ]; then
|
|
echo "pcsensor executable not found" >&2
|
|
exit -1
|
|
fi
|
|
|
|
if [ "${1}" = "config" ]; then
|
|
echo "graph_title TEMPer USB Thermometer"
|
|
echo "graph_scale no"
|
|
echo "graph_vlabel Celsius"
|
|
echo "graph_category sensors"
|
|
echo "graph_info This graph shows the temperature reported by the first attached TEMPer USB Thermometer"
|
|
|
|
echo "temp.label temperatue"
|
|
echo "temp.type GAUGE"
|
|
else
|
|
TEMP=$(${PCSENSOR} -cm)
|
|
if [[ $? != 0 ]]; then
|
|
sleep 2
|
|
TEMP=$(${PCSENSOR} -cm)
|
|
if [[ $? != 0 ]]; then
|
|
sleep 6
|
|
TEMP=$(${PCSENSOR} -cm)
|
|
fi
|
|
fi
|
|
echo "temp.value $(echo -n "$TEMP" | head -n 1)"
|
|
fi
|