Pass correct info to run funct. (#6126)
* Pass correct info to run funct. Changed to allow the correct parameters to be sent to the run function. Also changed to set apcupsd_status variable correctly. * Fixing as per comments
Steve8291 committed
May 28, 2019 at 12:25 UTC
423057b9446540e7afc493eb1d74b4e9dcc41579
2 files changed
+3
-3
collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh
+2
-2
@@ -47,8 +47,8 @@ apcupsd_check() {
47
error "cannot get information for apcupsd server ${host} on ${apcupsd_sources[${host}]}."
48
failed=$((failed + 1))
49
else
50
- apcupsd_status=$(apcupsd_get ${apcupsd_sources[${host}]} | awk '/^STATUS.*/{ print $3 }')
51
- if [ "$apcupsd_status" != "ONLINE" ] && [ "$apcupsd_status" != "ONBATT" ]; then
50
+ apcupsd_status="$(apcupsd_get ${apcupsd_sources[${host}]} | awk '/^STATUS.*/{ print $3 }')"
51
+ if [ "${apcupsd_status}" != "ONLINE" ] && [ "${apcupsd_status}" != "ONBATT" ]; then
52
error "APC UPS ${host} on ${apcupsd_sources[${host}]} is not online."
53
failed=$((failed + 1))
54
else
collectors/charts.d.plugin/charts.d.plugin.in
+1
-1
@@ -304,7 +304,7 @@ run() {
304
printf " --- END TRACE ---\n"
305
} >&2
306
fi
307
- rm "${TMP_DIR}/run.${pid}"
307
+ rm -f "${TMP_DIR}/run.${pid}"
308
309
return ${ret}
310
}