@cryptotaxi247 / netdata-1 / commits / 732f6d2af

add an option to exclude some sensors

paulfantom committed Jun 8, 2016 at 12:07 UTC 732f6d2af3c471a11b5e0abdcb4595782afc7987
1 file changed +8 -2
charts.d/sensors.chart.sh
+8 -2
@@ -23,6 +23,8 @@ sensors_update_every=
23
24 sensors_priority=90000
25
26 +declare -A sensors_excluded=()
27 +
28 sensors_find_all_files() {
29 find $1 -maxdepth $sensors_sys_depth -name \*_input -o -name temp 2>/dev/null
30 }
@@ -47,13 +49,17 @@ sensors_check() {
49
50 sensors_check_files() {
51 # we only need sensors that report a non-zero value
52 + # also remove not needed sensors
53
51 - local f= v=
54 + local f= v= excluded=
55 for f in $*
56 do
57 [ ! -f "$f" ] && continue
58 + for ex in ${sensors_excluded[@]}; do
59 + [[ $f =~ .*$ex$ ]] && excluded='1' && break
60 + done
61
56 - v="$( cat $f )"
62 + [ "$excluded" != "1" ] && v="$( cat $f )" || v=0
63 v=$(( v + 1 - 1 ))
64 [ $v -ne 0 ] && echo "$f" && continue
65