summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Mashchenko <ilya@netdata.cloud>2024-06-19 16:18:30 +0300
committerGitHub <noreply@github.com>2024-06-19 16:18:30 +0300
commit7fc605b7f1066179bc42634d36bf7b68dc0d006d (patch)
treea8d6ef17a8316ba5ac883e1ffe8da88e433deaa4
parentd4346b3be25c1f24fb3e126f42ab54cbdadef8ab (diff)
fix apcupsd status (#17960)
-rw-r--r--src/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh b/src/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh
index da9cd19c33..0eba816745 100644
--- a/src/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh
+++ b/src/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh
@@ -163,6 +163,7 @@ BEGIN {
load = 0;
temp = 0;
time = 0;
+ online = 0;
nompower = 0;
load_usage = 0;
selftest_OK = 0;
@@ -197,25 +198,25 @@ BEGIN {
/^ITEMP.*/ { temp = \$3 * 100 };
/^NOMPOWER.*/ { nompower = \$3 };
/^TIMELEFT.*/ { time = \$3 * 100 };
-/^STATUS.*/ { online=(\$3 != \"COMMLOST\" && !(\$3 == \"SHUTTING\" && \$4 == \"DOWN\"))?1:0; };
+/^STATUS.*/ { online=(\$0 !~ \"COMMLOST\" && \$0 !~ \"SHUTTING\") ? 1 : 0; };
/^SELFTEST.*/ { selftest_OK = (\$3 == \"OK\") ? 1 : 0;
selftest_NO = (\$3 == \"NO\") ? 1 : 0;
selftest_BT = (\$3 == \"BT\") ? 1 : 0;
selftest_NG = (\$3 == \"NG\") ? 1 : 0;
};
-/^STATUS.*/ { status_ONLINE = (\$3 == \"ONLINE\") ? 1 : 0;
- status_CAL = (\$3 == \"CAL\") ? 1 : 0;
- status_TRIM = (\$3 == \"TRIM\") ? 1 : 0;
- status_BOOST = (\$3 == \"BOOST\") ? 1 : 0;
- status_ONBATT = (\$3 == \"ONBATT\") ? 1 : 0;
- status_OVERLOAD = (\$3 == \"OVERLOAD\") ? 1 : 0;
- status_LOWBATT = (\$3 == \"LOWBATT\") ? 1 : 0;
- status_REPLACEBATT = (\$3 == \"REPLACEBATT\") ? 1 : 0;
- status_NOBATT = (\$3 == \"NOBATT\") ? 1 : 0;
- status_SLAVE = (\$3 == \"SLAVE\") ? 1 : 0;
- status_SLAVEDOWN = (\$3 == \"SLAVEDOWN\") ? 1 : 0;
- status_COMMLOST = (\$3 == \"COMMLOST\") ? 1 : 0;
- status_SHUTTING_DOWN = (\$3 == \"SHUTTING\" && \$4 == \"DOWN\") ? 1 : 0;
+/^STATUS.*/ { status_ONLINE = (\$0 ~ \"ONLINE\") ? 1 : 0;
+ status_CAL = (\$0 ~ \"CAL\") ? 1 : 0;
+ status_TRIM = (\$0 ~ \"TRIM\") ? 1 : 0;
+ status_BOOST = (\$0 ~ \"BOOST\") ? 1 : 0;
+ status_ONBATT = (\$0 ~ \"ONBATT\") ? 1 : 0;
+ status_OVERLOAD = (\$0 ~ \"OVERLOAD\") ? 1 : 0;
+ status_LOWBATT = (\$0 ~ \"LOWBATT\") ? 1 : 0;
+ status_REPLACEBATT = (\$0 ~ \"REPLACEBATT\") ? 1 : 0;
+ status_NOBATT = (\$0 ~ \"NOBATT\") ? 1 : 0;
+ status_SLAVE = (\$0 ~ \"SLAVE\") ? 1 : 0;
+ status_SLAVEDOWN = (\$0 ~ \"SLAVEDOWN\") ? 1 : 0;
+ status_COMMLOST = (\$0 ~ \"COMMLOST\") ? 1 : 0;
+ status_SHUTTING_DOWN = (\$0 ~ \"SHUTTING\") ? 1 : 0;
};
END {