root / plugins / sensors / cpu_tmp_sensors @ 97cf6d32
Historique | Voir | Annoter | Télécharger (1,14 ko)
| 1 |
#!/bin/sh |
|---|---|
| 2 |
# |
| 3 |
# Plugin to monitor the CPU temperature through lm-sensors. |
| 4 |
# v1.0 (2008-02-15) Oliver Ladner <oli@lugh.ch> |
| 5 |
# |
| 6 |
# Requirements: |
| 7 |
# - A configured lm-sensors installation |
| 8 |
# - Supported device (see http://www.lm-sensors.org/wiki/Devices) |
| 9 |
# - grep, sed and awk |
| 10 |
# |
| 11 |
# Todo: |
| 12 |
# - Ability to monitor multiple sensors like fan speeds, voltage etc. |
| 13 |
# - Better checks (availabilty of lm-sensors, sensors itself, path names) |
| 14 |
# |
| 15 |
# Parameters supported: |
| 16 |
# |
| 17 |
# config |
| 18 |
# autoconf |
| 19 |
# |
| 20 |
# Magic markers: |
| 21 |
#%# capabilities=autoconf |
| 22 |
|
| 23 |
DETECTED_SENSORS=`sensors -U -A | wc -l` |
| 24 |
|
| 25 |
case $1 in |
| 26 |
config) |
| 27 |
cat <<'EOM' |
| 28 |
graph_title CPU temperature |
| 29 |
graph_vlabel CPU temperature in °C |
| 30 |
graph_options light |
| 31 |
graph_info This graph shows CPU temperature in °C |
| 32 |
temp.label temp |
| 33 |
temp.draw LINE1 |
| 34 |
graph_category sensors |
| 35 |
temp.warning 65 |
| 36 |
temp.critical 80 |
| 37 |
EOM |
| 38 |
exit 0;; |
| 39 |
esac |
| 40 |
|
| 41 |
case $1 in |
| 42 |
autoconf) |
| 43 |
if [ "$DETECTED_SENSORS" -eq 0 ]; then |
| 44 |
echo "no" |
| 45 |
exit 1 |
| 46 |
else |
| 47 |
echo "yes" |
| 48 |
exit 0 |
| 49 |
fi |
| 50 |
esac |
| 51 |
|
| 52 |
echo -n "temp.value " |
| 53 |
sensors | grep 'CPU Temp' | sed 's/[+|°|C]//g' | awk {'print $3'}
|
