summaryrefslogtreecommitdiffstats
path: root/charts.d/apcupsd.chart.sh
diff options
context:
space:
mode:
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2016-10-20 22:04:28 +0300
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2016-10-20 22:04:28 +0300
commitaddb52bb18ba356fc1cb5888b1fe5b809137346d (patch)
tree61f3294473d70f9f96e2e302837ff844a70e3207 /charts.d/apcupsd.chart.sh
parentc6d3138cc7ddb21bac33df2fc9f16c6e76ff1426 (diff)
better log management for charts.d.plugin - fixes #1144
Diffstat (limited to 'charts.d/apcupsd.chart.sh')
-rwxr-xr-xcharts.d/apcupsd.chart.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/charts.d/apcupsd.chart.sh b/charts.d/apcupsd.chart.sh
index df18aaa2e8..41cb39f9cd 100755
--- a/charts.d/apcupsd.chart.sh
+++ b/charts.d/apcupsd.chart.sh
@@ -12,7 +12,7 @@ apcupsd_timeout=3
apcupsd_priority=90000
apcupsd_get() {
- timeout $apcupsd_timeout apcaccess status "$1:$2"
+ run -t $apcupsd_timeout apcaccess status "$1:$2"
}
apcupsd_check() {
@@ -23,14 +23,14 @@ apcupsd_check() {
require_cmd apcaccess || return 1
- apcupsd_get $apcupsd_ip $apcupsd_port >/dev/null
+ run apcupsd_get $apcupsd_ip $apcupsd_port >/dev/null
if [ $? -ne 0 ]
then
- echo >&2 "apcupsd: ERROR: Cannot get information for apcupsd server."
+ error "cannot get information for apcupsd server."
return 1
elif [ $(apcupsd_get $apcupsd_ip $apcupsd_port | awk '/^STATUS.*/{ print $3 }') != "ONLINE" ]
then
- echo >&2 "apcupsd: ERROR: UPS not online."
+ error "APC UPS not online."
return 1
fi
@@ -146,7 +146,7 @@ END {
print \"SET time = \" time;
print \"END\"
}"
- [ $? -ne 0 ] && echo >&2 "apcupsd: failed to get values" && return 1
+ [ $? -ne 0 ] && error "failed to get values" && return 1
return 0
}