From addb52bb18ba356fc1cb5888b1fe5b809137346d Mon Sep 17 00:00:00 2001 From: "Costa Tsaousis (ktsaou)" Date: Thu, 20 Oct 2016 22:04:28 +0300 Subject: better log management for charts.d.plugin - fixes #1144 --- charts.d/apcupsd.chart.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'charts.d/apcupsd.chart.sh') 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 } -- cgit v1.2.3