root / plugins / raspberry-pi / rpi_temp @ 5a2f9abf
Historique | Voir | Annoter | Télécharger (706 octets)
| 1 |
#! /bin/sh |
|---|---|
| 2 |
|
| 3 |
: <<=cut |
| 4 |
|
| 5 |
=head1 NAME |
| 6 |
|
| 7 |
rpi_temp - monitor the temperature of a Raspberry device |
| 8 |
|
| 9 |
|
| 10 |
=head1 AUTHORS |
| 11 |
|
| 12 |
Copyright (C) 2013 Steve Schnepp <steve.schnepp@pwkf.org> |
| 13 |
|
| 14 |
|
| 15 |
=head1 LICENSE |
| 16 |
|
| 17 |
GNU Library General Public License v2 only |
| 18 |
|
| 19 |
SPDX-License-Identifier: LGPL-2.0-only |
| 20 |
|
| 21 |
=cut |
| 22 |
|
| 23 |
|
| 24 |
if [ ! -r "/sys/class/thermal/thermal_zone0/temp" ] |
| 25 |
then |
| 26 |
echo "# Cannot read CPU Temp" |
| 27 |
exit 1 |
| 28 |
fi |
| 29 |
|
| 30 |
|
| 31 |
if [ "$1" = "config" ] |
| 32 |
then |
| 33 |
cat <<EOF |
| 34 |
graph_title CPU Temp |
| 35 |
graph_category system |
| 36 |
graph_vlabel C |
| 37 |
thermal_zone0.label Current CPU Temp |
| 38 |
EOF |
| 39 |
exit 0 |
| 40 |
fi |
| 41 |
|
| 42 |
# values |
| 43 |
TEMP_MILLI_C=$(cat /sys/class/thermal/thermal_zone0/temp) |
| 44 |
|
| 45 |
echo "thermal_zone0.value $(echo "$TEMP_MILLI_C" | awk '{printf("%0.3f", $1 / 1000)}')"
|
| 46 |
|
| 47 |
exit 0 |
