summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve8291 <hambling8@gmail.com>2019-05-28 12:25:18 -0400
committerChris Akritidis <43294513+cakrit@users.noreply.github.com>2019-05-28 18:25:18 +0200
commit423057b9446540e7afc493eb1d74b4e9dcc41579 (patch)
treed69826a94008b130c9f21084314997dac1c95489
parente11a4e4a5dc5231ffb2f58ff05f32156c052766a (diff)
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
-rw-r--r--collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh4
-rwxr-xr-xcollectors/charts.d.plugin/charts.d.plugin.in2
2 files changed, 3 insertions, 3 deletions
diff --git a/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh b/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh
index 1c1ce67b76..31ff931605 100644
--- a/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh
+++ b/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh
@@ -47,8 +47,8 @@ apcupsd_check() {
error "cannot get information for apcupsd server ${host} on ${apcupsd_sources[${host}]}."
failed=$((failed + 1))
else
- apcupsd_status=$(apcupsd_get ${apcupsd_sources[${host}]} | awk '/^STATUS.*/{ print $3 }')
- if [ "$apcupsd_status" != "ONLINE" ] && [ "$apcupsd_status" != "ONBATT" ]; then
+ 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
diff --git a/collectors/charts.d.plugin/charts.d.plugin.in b/collectors/charts.d.plugin/charts.d.plugin.in
index a3f0aa9543..0df6c30c3a 100755
--- a/collectors/charts.d.plugin/charts.d.plugin.in
+++ b/collectors/charts.d.plugin/charts.d.plugin.in
@@ -304,7 +304,7 @@ run() {
printf " --- END TRACE ---\n"
} >&2
fi
- rm "${TMP_DIR}/run.${pid}"
+ rm -f "${TMP_DIR}/run.${pid}"
return ${ret}
}