summaryrefslogtreecommitdiffstats
path: root/charts.d/apcupsd.chart.sh
diff options
context:
space:
mode:
authorLennart Weller <lhw@ring0.de>2017-01-24 15:21:09 +0000
committerLennart Weller <lhw@ring0.de>2017-01-24 15:21:09 +0000
commit3ed3b02ed96ddab1c084811f3579b3a2aec83e04 (patch)
tree7a61ab288ae47800c4f11be5677d6ad8288dcd98 /charts.d/apcupsd.chart.sh
parentNew upstream version 1.4.0+dfsg (diff)
downloadnetdata-3ed3b02ed96ddab1c084811f3579b3a2aec83e04.tar.xz
netdata-3ed3b02ed96ddab1c084811f3579b3a2aec83e04.zip
New upstream version 1.5.0+dfsgupstream/1.5.0+dfsg
Diffstat (limited to 'charts.d/apcupsd.chart.sh')
-rwxr-xr-xcharts.d/apcupsd.chart.sh18
1 files changed, 12 insertions, 6 deletions
diff --git a/charts.d/apcupsd.chart.sh b/charts.d/apcupsd.chart.sh
index df18aaa2e..46a86101c 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
}