diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2016-10-20 22:04:28 +0300 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2016-10-20 22:04:28 +0300 |
commit | addb52bb18ba356fc1cb5888b1fe5b809137346d (patch) | |
tree | 61f3294473d70f9f96e2e302837ff844a70e3207 /charts.d/nut.chart.sh | |
parent | c6d3138cc7ddb21bac33df2fc9f16c6e76ff1426 (diff) |
better log management for charts.d.plugin - fixes #1144
Diffstat (limited to 'charts.d/nut.chart.sh')
-rwxr-xr-x | charts.d/nut.chart.sh | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/charts.d/nut.chart.sh b/charts.d/nut.chart.sh index 3c8e1c9d05..e2b3a85c54 100755 --- a/charts.d/nut.chart.sh +++ b/charts.d/nut.chart.sh @@ -15,11 +15,11 @@ nut_priority=90000 declare -A nut_ids=() nut_get_all() { - timeout $nut_timeout upsc -l + run -t $nut_timeout upsc -l } nut_get() { - timeout $nut_timeout upsc "$1" + run -t $nut_timeout upsc "$1" } nut_check() { @@ -42,12 +42,12 @@ nut_check() { nut_ids[$x]="$( fixid "$x" )" continue fi - echo >&2 "nut: ERROR: Cannot get information for NUT UPS '$x'." + error "cannot get information for NUT UPS '$x'." done if [ ${#nut_ids[@]} -eq 0 ] then - echo >&2 "nut: Please set nut_ups='ups_name' in $confd/nut.conf" + error "Cannot find UPSes - please set nut_ups='ups_name' in $confd/nut.conf" return 1 fi @@ -179,9 +179,9 @@ END { print \"SET temp = \" temp; print \"END\" }" - [ $? -ne 0 ] && unset nut_ids[$i] && echo >&2 "nut: failed to get values for '$i', disabling it." + [ $? -ne 0 ] && unset nut_ids[$i] && error "failed to get values for '$i', disabling it." done - [ ${#nut_ids[@]} -eq 0 ] && echo >&2 "nut: no UPSes left active." && return 1 + [ ${#nut_ids[@]} -eq 0 ] && error "no UPSes left active." && return 1 return 0 } |