diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2021-09-30 23:32:45 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2021-09-30 23:32:45 +0200 |
commit | 536bd24438799a15686415b054f57676b053702d (patch) | |
tree | ac5b93d2a342166c3d2d11a867934ec725b7273e /plugins/check_sensors | |
parent | cf666ed055e1e76c5acf0d323d87438bfb8342d6 (diff) | |
download | monitoring_custom-536bd24438799a15686415b054f57676b053702d.tar.gz |
move
Diffstat (limited to 'plugins/check_sensors')
-rwxr-xr-x | plugins/check_sensors | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/plugins/check_sensors b/plugins/check_sensors new file mode 100755 index 0000000..8cb1e20 --- /dev/null +++ b/plugins/check_sensors @@ -0,0 +1,30 @@ +#!/bin/bash + +# °C +WARN=75 +CRIT=85 + +PERFDATA="|" +IS_WARN="false" +IS_CRIT="false" + +TEXT=(OK WARNING CRITICAL UNKOWN) +LEVEL=0 + +DATA=( $(sensors | \ + grep "^Core" | \ + sed -n "s|^Core\s[0-9]\+:\s\++\([0-9]\+\.[0-9]\+\).*$|\1|p" ) ) + +for (( i=0; i<${#DATA[@]}; i++ )); do + (( $(echo "${DATA[$i]} > $WARN" | bc -l ) )) && IS_WARN="true" + (( $(echo "${DATA[$i]} > $CRIT" | bc -l ) )) && IS_CRIT="true" + PERFDATA+=" core_$i=${DATA[$i]}C" +done + +[ $IS_WARN = true ] && LEVEL=1 +[ $IS_CRIT = true ] && LEVEL=2 +[ ${#DATA[@]} -eq 0 ] && LEVEL=3 + +echo "sensors ${TEXT[$LEVEL]}$PERFDATA" + +exit $LEVEL |