summaryrefslogtreecommitdiffstats
path: root/collectors/charts.d.plugin/apcupsd
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-02-21 19:34:01 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-02-21 19:34:01 +0000
commit66564c2324abc58b24327b763e1113ff781156a2 (patch)
tree2480212cd47149a3fda5225b57689d0126546e23 /collectors/charts.d.plugin/apcupsd
parentAdding upstream version 1.12.0. (diff)
downloadnetdata-66564c2324abc58b24327b763e1113ff781156a2.tar.xz
netdata-66564c2324abc58b24327b763e1113ff781156a2.zip
Adding upstream version 1.12.1.upstream/1.12.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/charts.d.plugin/apcupsd')
-rw-r--r--collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh b/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh
index b4b92cdc5..f5c4d7959 100644
--- a/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh
+++ b/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh
@@ -46,11 +46,14 @@ apcupsd_check() {
if [ $? -ne 0 ]; then
error "cannot get information for apcupsd server ${host} on ${apcupsd_sources[${host}]}."
failed=$((failed + 1))
- elif [ "$(apcupsd_get "${apcupsd_sources[${host}]}" | awk '/^STATUS.*/{ print $3 }')" != "ONLINE" ]; then
- error "APC UPS ${host} on ${apcupsd_sources[${host}]} is not online."
- failed=$((failed + 1))
else
- working=$((working + 1))
+ apcupsd_status = "$(apcupsd_get ${apcupsd_sources[${host}]} | awk '/^STATUS.*/{ print $3 }')"
+ if [ ${apcupsd_status} != "ONLINE" ] && [ ${apcupsd_status} != "ONBATT" ]; then
+ error "APC UPS ${host} on ${apcupsd_sources[${host}]} is not online."
+ failed=$((failed + 1))
+ else
+ working=$((working + 1))
+ fi
fi
done
@@ -143,7 +146,7 @@ BEGIN {
/^LOADPCT.*/ { load = \$3 * 100 };
/^ITEMP.*/ { temp = \$3 * 100 };
/^TIMELEFT.*/ { time = \$3 * 100 };
-/^STATUS.*/ { online=(\$3 == \"ONLINE\")?1:0 };
+/^STATUS.*/ { online=(\$3 == \"ONLINE\" || \$3 == \"ONBATT\")?1:0 };
END {
print \"BEGIN apcupsd_${host}.online $1\";
print \"SET online = \" online;