diff options
author | Lennart Weller <lhw@ring0.de> | 2017-01-24 15:21:16 +0000 |
---|---|---|
committer | Lennart Weller <lhw@ring0.de> | 2017-01-24 15:21:16 +0000 |
commit | ef0c127e7f95d2db2715b9e99fe758eebc7dabd3 (patch) | |
tree | ea5d62342aba06f376f3be63aab898503b56f3ec /charts.d/apcupsd.chart.sh | |
parent | update watch file and files-exclude (diff) | |
parent | New upstream version 1.5.0+dfsg (diff) | |
download | netdata-ef0c127e7f95d2db2715b9e99fe758eebc7dabd3.tar.xz netdata-ef0c127e7f95d2db2715b9e99fe758eebc7dabd3.zip |
Merge tag 'upstream/1.5.0+dfsg'
Upstream version 1.5.0+dfsg
Diffstat (limited to 'charts.d/apcupsd.chart.sh')
-rwxr-xr-x | charts.d/apcupsd.chart.sh | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/charts.d/apcupsd.chart.sh b/charts.d/apcupsd.chart.sh index df18aaa2..46a86101 100755 --- a/charts.d/apcupsd.chart.sh +++ b/charts.d/apcupsd.chart.sh @@ -1,5 +1,11 @@ # no need for shebang - this file is loaded from charts.d.plugin +# netdata +# real-time performance and health monitoring, done right! +# (C) 2016 Costa Tsaousis <costa@tsaousis.gr> +# GPL v3+ +# + apcupsd_ip=127.0.0.1 apcupsd_port=3551 @@ -12,7 +18,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 +29,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 @@ -62,7 +68,7 @@ DIMENSION output_voltage_nominal nominal absolute 1 100 CHART apcupsd.load '' "UPS Load" "percentage" ups apcupsd.load area $((apcupsd_priority)) $apcupsd_update_every DIMENSION load load absolute 1 100 -CHART apcupsd.temp '' "UPS Temperature" "Celcius" ups apcupsd.temperature line $((apcupsd_priority + 7)) $apcupsd_update_every +CHART apcupsd.temp '' "UPS Temperature" "Celsius" ups apcupsd.temperature line $((apcupsd_priority + 7)) $apcupsd_update_every DIMENSION temp temp absolute 1 100 CHART apcupsd.time '' "UPS Time Remaining" "Minutes" ups apcupsd.time area $((apcupsd_priority + 2)) $apcupsd_update_every @@ -146,7 +152,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 } |