From 2e8c6b07d6bc516a970db09c6de17ea5a3c8d40d Mon Sep 17 00:00:00 2001 From: priiduonu Date: Mon, 22 Mar 2021 15:09:20 +0200 Subject: [PATCH] Update ups-apcups.sh (#361) Filter out `LINEV` value as some APC models also return `MAXLINEV` and `MINLINEV` values in `apcaccess` output, therefore ruining the final output. --- snmp/ups-apcups.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snmp/ups-apcups.sh b/snmp/ups-apcups.sh index 64b55c3..378f2d6 100755 --- a/snmp/ups-apcups.sh +++ b/snmp/ups-apcups.sh @@ -19,7 +19,7 @@ BIN_GREP='/usr/bin/grep' ################################################################ TMP=$($BIN_APCS 2>/dev/null) -for value in "LINEV:[0-9]+" "LOADPCT:[0-9.]+" "BCHARGE:[0-9.]+" "TIMELEFT:[0-9.]+" "^BATTV:[0-9.]+" "NOMINV:[0-9]+" "NOMBATTV:[0-9.]+" +for value in "^LINEV:[0-9]+" "LOADPCT:[0-9.]+" "BCHARGE:[0-9.]+" "TIMELEFT:[0-9.]+" "^BATTV:[0-9.]+" "NOMINV:[0-9]+" "NOMBATTV:[0-9.]+" do OUT=$(echo "$TMP" | $BIN_TR -d ' ' | $BIN_GREP -Eo "$value" | $BIN_CUT -d ":" -f 2) if [ -n "$OUT" ]; then @@ -27,4 +27,4 @@ do else echo "Unknown" fi -done \ No newline at end of file +done