summaryrefslogtreecommitdiffstats
path: root/charts.d/sensors.chart.sh
diff options
context:
space:
mode:
authorLennart Weller <lhw@ring0.de>2016-09-05 08:27:21 +0000
committerLennart Weller <lhw@ring0.de>2016-09-05 08:27:21 +0000
commit1746898cefcb17f58b5cf27b4dad3d28236f1152 (patch)
tree9207f191cf39bbd077a1e1c73d6e82123e2fc710 /charts.d/sensors.chart.sh
parentImported Upstream version 1.2.0+dfsg (diff)
downloadnetdata-1746898cefcb17f58b5cf27b4dad3d28236f1152.tar.xz
netdata-1746898cefcb17f58b5cf27b4dad3d28236f1152.zip
Imported Upstream version 1.3.0+dfsgupstream/1.3.0+dfsg
Diffstat (limited to 'charts.d/sensors.chart.sh')
-rwxr-xr-xcharts.d/sensors.chart.sh15
1 files changed, 11 insertions, 4 deletions
diff --git a/charts.d/sensors.chart.sh b/charts.d/sensors.chart.sh
index 19e938586..9652f896a 100755
--- a/charts.d/sensors.chart.sh
+++ b/charts.d/sensors.chart.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+# no need for shebang - this file is loaded from charts.d.plugin
# sensors docs
# https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface
@@ -23,6 +23,8 @@ sensors_update_every=
sensors_priority=90000
+declare -A sensors_excluded=()
+
sensors_find_all_files() {
find $1 -maxdepth $sensors_sys_depth -name \*_input -o -name temp 2>/dev/null
}
@@ -47,15 +49,20 @@ sensors_check() {
sensors_check_files() {
# we only need sensors that report a non-zero value
+ # also remove not needed sensors
- local f= v=
+ local f= v= excluded=
for f in $*
do
[ ! -f "$f" ] && continue
+ for ex in ${sensors_excluded[@]}; do
+ [[ $f =~ .*$ex$ ]] && excluded='1' && break
+ done
- v="$( cat $f )"
+ [ "$excluded" != "1" ] && v="$( cat $f )" || v=0
v=$(( v + 1 - 1 ))
[ $v -ne 0 ] && echo "$f" && continue
+ excluded=
echo >&2 "$PROGRAM_NAME: sensors: $f gives zero values"
done
@@ -206,7 +213,7 @@ sensors_create() {
fi
echo "DIMENSION $fid '$labelname' $algorithm $multiplier $divisor"
- echo >>$TMP_DIR/sensors.sh "printf \"SET $fid = \"; cat $file "
+ echo >>$TMP_DIR/sensors.sh "echo \"SET $fid = \"\$(< $file )"
done
echo >>$TMP_DIR/sensors.sh "echo END"