From 4bc4fd5c07b586d0f4227d4320d195e2434f762e Mon Sep 17 00:00:00 2001 From: Jonny007-MKD Date: Sat, 3 Oct 2020 16:49:06 +0200 Subject: [PATCH] Add temperature as status output, too --- README.md | 2 +- check_rpi_temperature.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index edb1723..1cf5f79 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Icinga2/Nagios check program for Raspberry Pi temperature ## Requirements - `bc` for floating point calculation -- Adding executing user to video group: `sudo adduser nagios video` +- Adding executing user to video group: `sudo adduser nagios video`. Otherwise "VCHI initialization failed" ## Arguments diff --git a/check_rpi_temperature.sh b/check_rpi_temperature.sh index d30df3f..149ee03 100755 --- a/check_rpi_temperature.sh +++ b/check_rpi_temperature.sh @@ -74,10 +74,10 @@ fi temp=${output/temp=/} temp=${temp/\'C/} -unit="°C" +unit="'C" if $FAHRENHEIT; then temp=$(bc <<< "scale=1; ($temp * 1.8) + 32") - unit="°F" + unit="'F" fi @@ -91,7 +91,7 @@ elif [ $w -eq 1 ]; then else result="OK" fi -echo "$result | 'temperature'=$temp;$unit;$WARN;$CRIT;-40;85" +echo "$result. $temp$unit | 'temperature'=$temp;$unit;$WARN;$CRIT;-40;85" case $result in