summaryrefslogtreecommitdiffstats
path: root/collectors/charts.d.plugin/ap
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--collectors/charts.d.plugin/ap/README.md2
-rw-r--r--collectors/charts.d.plugin/ap/ap.chart.sh91
-rw-r--r--collectors/charts.d.plugin/apache/README.md8
-rw-r--r--collectors/charts.d.plugin/apache/apache.chart.sh79
-rw-r--r--collectors/charts.d.plugin/apcupsd/README.md7
-rw-r--r--collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh189
6 files changed, 189 insertions, 187 deletions
diff --git a/collectors/charts.d.plugin/ap/README.md b/collectors/charts.d.plugin/ap/README.md
index eb4e80707..962a8565e 100644
--- a/collectors/charts.d.plugin/ap/README.md
+++ b/collectors/charts.d.plugin/ap/README.md
@@ -82,3 +82,5 @@ To edit this file on your system run `/etc/netdata/edit-config charts.d/ap.conf`
## Auto-detection
The plugin is able to auto-detect if you are running access points on your linux box.
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fap%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/ap/ap.chart.sh b/collectors/charts.d.plugin/ap/ap.chart.sh
index ccc36120c..a2d04c0a7 100644
--- a/collectors/charts.d.plugin/ap/ap.chart.sh
+++ b/collectors/charts.d.plugin/ap/ap.chart.sh
@@ -56,8 +56,7 @@ ap_check() {
ap_create() {
local ssid dev
- for dev in "${!ap_devs[@]}"
- do
+ for dev in "${!ap_devs[@]}"; do
ssid="${ap_devs[${dev}]}"
# create the chart with 3 dimensions
@@ -99,14 +98,13 @@ ap_update() {
# for each dimension
# remember: KEEP IT SIMPLE AND SHORT
- for dev in "${!ap_devs[@]}"
- do
- echo
- echo "DEVICE ${dev}"
+ for dev in "${!ap_devs[@]}"; do
+ echo
+ echo "DEVICE ${dev}"
iw "${dev}" station dump
- done | awk "
+ done | awk '
function zero_data() {
- dev = \"\";
+ dev = "";
c = 0;
rb = 0;
tb = 0;
@@ -121,32 +119,32 @@ ap_update() {
e = 0;
}
function print_device() {
- if(dev != \"\" && length(dev) > 0) {
- print \"BEGIN ap_clients.\" dev;
- print \"SET clients = \" c;
- print \"END\";
- print \"BEGIN ap_bandwidth.\" dev;
- print \"SET received = \" rb;
- print \"SET sent = \" tb;
- print \"END\";
- print \"BEGIN ap_packets.\" dev;
- print \"SET received = \" rp;
- print \"SET sent = \" tp;
- print \"END\";
- print \"BEGIN ap_issues.\" dev;
- print \"SET retries = \" tr;
- print \"SET failures = \" tf;
- print \"END\";
+ if(dev != "" && length(dev) > 0) {
+ print "BEGIN ap_clients." dev;
+ print "SET clients = " c;
+ print "END";
+ print "BEGIN ap_bandwidth." dev;
+ print "SET received = " rb;
+ print "SET sent = " tb;
+ print "END";
+ print "BEGIN ap_packets." dev;
+ print "SET received = " rp;
+ print "SET sent = " tp;
+ print "END";
+ print "BEGIN ap_issues." dev;
+ print "SET retries = " tr;
+ print "SET failures = " tf;
+ print "END";
if( c == 0 ) c = 1;
- print \"BEGIN ap_signal.\" dev;
- print \"SET signal = \" int(s / c);
- print \"END\";
- print \"BEGIN ap_bitrate.\" dev;
- print \"SET receive = \" int(rt / c);
- print \"SET transmit = \" int(tt / c);
- print \"SET expected = \" int(e / c);
- print \"END\";
+ print "BEGIN ap_signal." dev;
+ print "SET signal = " int(s / c);
+ print "END";
+ print "BEGIN ap_bitrate." dev;
+ print "SET receive = " int(rt / c);
+ print "SET transmit = " int(tt / c);
+ print "SET expected = " int(e / c);
+ print "END";
}
zero_data();
}
@@ -155,28 +153,27 @@ ap_update() {
}
/^DEVICE / {
print_device();
- dev = \$2;
+ dev = $2;
}
/^Station/ { c++; }
- /^[ \\t]+rx bytes:/ { rb += \$3; }
- /^[ \\t]+tx bytes:/ { tb += \$3; }
- /^[ \\t]+rx packets:/ { rp += \$3; }
- /^[ \\t]+tx packets:/ { tp += \$3; }
- /^[ \\t]+tx retries:/ { tr += \$3; }
- /^[ \\t]+tx failed:/ { tf += \$3; }
- /^[ \\t]+signal:/ { x = \$2; s += x * 1000; }
- /^[ \\t]+rx bitrate:/ { x = \$3; rt += x * 1000; }
- /^[ \\t]+tx bitrate:/ { x = \$3; tt += x * 1000; }
- /^[ \\t]+expected throughput:(.*)Mbps/ {
- x=\$3;
- sub(/Mbps/, \"\", x);
+ /^[ \t]+rx bytes:/ { rb += $3; }
+ /^[ \t]+tx bytes:/ { tb += $3; }
+ /^[ \t]+rx packets:/ { rp += $3; }
+ /^[ \t]+tx packets:/ { tp += $3; }
+ /^[ \t]+tx retries:/ { tr += $3; }
+ /^[ \t]+tx failed:/ { tf += $3; }
+ /^[ \t]+signal:/ { x = $2; s += x * 1000; }
+ /^[ \t]+rx bitrate:/ { x = $3; rt += x * 1000; }
+ /^[ \t]+tx bitrate:/ { x = $3; tt += x * 1000; }
+ /^[ \t]+expected throughput:(.*)Mbps/ {
+ x=$3;
+ sub(/Mbps/, "", x);
e += x * 1000;
}
END {
print_device();
}
- "
+ '
return 0
}
-
diff --git a/collectors/charts.d.plugin/apache/README.md b/collectors/charts.d.plugin/apache/README.md
index 890cee984..273979107 100644
--- a/collectors/charts.d.plugin/apache/README.md
+++ b/collectors/charts.d.plugin/apache/README.md
@@ -1,10 +1,10 @@
+# Apache
+
> THIS MODULE IS OBSOLETE.
-> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
+> USE [THE PYTHON ONE](../../python.d.plugin/apache) - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
---
-# Apache Plugin (apache)
-
The `apache` collector visualizes key performance data for an apache web server.
## Example netdata charts
@@ -125,3 +125,5 @@ curl "http://127.0.0.1:80/server-status?auto"
netdata will be able to do it too.
Notice: You may need to have the default `000-default.conf ` website enabled in order for the status mod to work.
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fapache%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/apache/apache.chart.sh b/collectors/charts.d.plugin/apache/apache.chart.sh
index 95876432f..7d09ee676 100644
--- a/collectors/charts.d.plugin/apache/apache.chart.sh
+++ b/collectors/charts.d.plugin/apache/apache.chart.sh
@@ -52,21 +52,20 @@ apache_key_connsasynckeepalive=
apache_key_connsasyncclosing=
apache_detect() {
local i=0
- for x in "${@}"
- do
+ for x in "${@}"; do
case "${x}" in
- 'Total Accesses') apache_key_accesses=$((i + 1)) ;;
- 'Total kBytes') apache_key_kbytes=$((i + 1)) ;;
- 'ReqPerSec') apache_key_reqpersec=$((i + 1)) ;;
- 'BytesPerSec') apache_key_bytespersec=$((i + 1)) ;;
- 'BytesPerReq') apache_key_bytesperreq=$((i + 1)) ;;
- 'BusyWorkers') apache_key_busyworkers=$((i + 1)) ;;
- 'IdleWorkers') apache_key_idleworkers=$((i + 1));;
- 'ConnsTotal') apache_key_connstotal=$((i + 1)) ;;
- 'ConnsAsyncWriting') apache_key_connsasyncwriting=$((i + 1)) ;;
- 'ConnsAsyncKeepAlive') apache_key_connsasynckeepalive=$((i + 1)) ;;
- 'ConnsAsyncClosing') apache_key_connsasyncclosing=$((i + 1)) ;;
- 'Scoreboard') apache_key_scoreboard=$((i)) ;;
+ 'Total Accesses') apache_key_accesses=$((i + 1)) ;;
+ 'Total kBytes') apache_key_kbytes=$((i + 1)) ;;
+ 'ReqPerSec') apache_key_reqpersec=$((i + 1)) ;;
+ 'BytesPerSec') apache_key_bytespersec=$((i + 1)) ;;
+ 'BytesPerReq') apache_key_bytesperreq=$((i + 1)) ;;
+ 'BusyWorkers') apache_key_busyworkers=$((i + 1)) ;;
+ 'IdleWorkers') apache_key_idleworkers=$((i + 1)) ;;
+ 'ConnsTotal') apache_key_connstotal=$((i + 1)) ;;
+ 'ConnsAsyncWriting') apache_key_connsasyncwriting=$((i + 1)) ;;
+ 'ConnsAsyncKeepAlive') apache_key_connsasynckeepalive=$((i + 1)) ;;
+ 'ConnsAsyncClosing') apache_key_connsasyncclosing=$((i + 1)) ;;
+ 'Scoreboard') apache_key_scoreboard=$((i)) ;;
esac
i=$((i + 1))
@@ -74,20 +73,19 @@ apache_detect() {
# we will not check of the Conns*
# keys, since these are apache 2.4 specific
- [ -z "${apache_key_accesses}" ] && error "missing 'Total Accesses' from apache server: ${*}" && return 1
- [ -z "${apache_key_kbytes}" ] && error "missing 'Total kBytes' from apache server: ${*}" && return 1
- [ -z "${apache_key_reqpersec}" ] && error "missing 'ReqPerSec' from apache server: ${*}" && return 1
+ [ -z "${apache_key_accesses}" ] && error "missing 'Total Accesses' from apache server: ${*}" && return 1
+ [ -z "${apache_key_kbytes}" ] && error "missing 'Total kBytes' from apache server: ${*}" && return 1
+ [ -z "${apache_key_reqpersec}" ] && error "missing 'ReqPerSec' from apache server: ${*}" && return 1
[ -z "${apache_key_bytespersec}" ] && error "missing 'BytesPerSec' from apache server: ${*}" && return 1
[ -z "${apache_key_bytesperreq}" ] && error "missing 'BytesPerReq' from apache server: ${*}" && return 1
[ -z "${apache_key_busyworkers}" ] && error "missing 'BusyWorkers' from apache server: ${*}" && return 1
[ -z "${apache_key_idleworkers}" ] && error "missing 'IdleWorkers' from apache server: ${*}" && return 1
- [ -z "${apache_key_scoreboard}" ] && error "missing 'Scoreboard' from apache server: ${*}" && return 1
+ [ -z "${apache_key_scoreboard}" ] && error "missing 'Scoreboard' from apache server: ${*}" && return 1
- if [ ! -z "${apache_key_connstotal}" ] && \
- [ ! -z "${apache_key_connsasyncwriting}" ] && \
- [ ! -z "${apache_key_connsasynckeepalive}" ] && \
- [ ! -z "${apache_key_connsasyncclosing}" ]
- then
+ if [ ! -z "${apache_key_connstotal}" ] &&
+ [ ! -z "${apache_key_connsasyncwriting}" ] &&
+ [ ! -z "${apache_key_connsasynckeepalive}" ] &&
+ [ ! -z "${apache_key_connsasyncclosing}" ]; then
apache_has_conns=1
else
apache_has_conns=0
@@ -103,15 +101,13 @@ apache_get() {
ret=$?
IFS="${oIFS}"
- if [ $ret -ne 0 ] || [ "${#apache_response[@]}" -eq 0 ]
- then
+ if [ $ret -ne 0 ] || [ "${#apache_response[@]}" -eq 0 ]; then
return 1
fi
# the last line on the apache output is "Scoreboard"
# we use this label to detect that the output has a new word count
- if [ ${apache_keys_detected} -eq 0 ] || [ "${apache_response[${apache_key_scoreboard}]}" != "Scoreboard" ]
- then
+ if [ ${apache_keys_detected} -eq 0 ] || [ "${apache_response[${apache_key_scoreboard}]}" != "Scoreboard" ]; then
apache_detect "${apache_response[@]}" || return 1
apache_keys_detected=1
fi
@@ -131,20 +127,20 @@ apache_get() {
apache_busyworkers="${apache_response[${apache_key_busyworkers}]}"
apache_idleworkers="${apache_response[${apache_key_idleworkers}]}"
- if [ -z "${apache_accesses}" ] || \
- [ -z "${apache_kbytes}" ] || \
- [ -z "${apache_reqpersec}" ] || \
- [ -z "${apache_bytespersec}" ] || \
- [ -z "${apache_bytesperreq}" ] || \
- [ -z "${apache_busyworkers}" ]
- [ -z "${apache_idleworkers}" ]
+ if
+ [ -z "${apache_accesses}" ] ||
+ [ -z "${apache_kbytes}" ] ||
+ [ -z "${apache_reqpersec}" ] ||
+ [ -z "${apache_bytespersec}" ] ||
+ [ -z "${apache_bytesperreq}" ] ||
+ [ -z "${apache_busyworkers}" ]
+ [ -z "${apache_idleworkers}" ]
then
error "empty values got from apache server: ${apache_response[*]}"
return 1
fi
- if [ ${apache_has_conns} -eq 1 ]
- then
+ if [ ${apache_has_conns} -eq 1 ]; then
apache_connstotal="${apache_response[${apache_key_connstotal}]}"
apache_connsasyncwriting="${apache_response[${apache_key_connsasyncwriting}]}"
apache_connsasynckeepalive="${apache_response[${apache_key_connsasynckeepalive}]}"
@@ -159,8 +155,7 @@ apache_check() {
apache_get
# shellcheck disable=2181
- if [ $? -ne 0 ]
- then
+ if [ $? -ne 0 ]; then
# shellcheck disable=2154
error "cannot find stub_status on URL '${apache_url}'. Please set apache_url='http://apache.server:80/server-status?auto' in $confd/apache.conf"
return 1
@@ -191,8 +186,7 @@ CHART apache_local.net '' "apache Bandwidth" "kilobits/s" bandwidth apache.net a
DIMENSION sent '' incremental 8 1
EOF
- if [ ${apache_has_conns} -eq 1 ]
- then
+ if [ ${apache_has_conns} -eq 1 ]; then
cat <<EOF2
CHART apache_local.connections '' "apache Connections" "connections" connections apache.connections line $((apache_priority + 2)) $apache_update_every
DIMENSION connections '' absolute 1 1
@@ -240,9 +234,8 @@ SET busy = $((apache_busyworkers))
END
VALUESEOF
- if [ ${apache_has_conns} -eq 1 ]
- then
- cat <<VALUESEOF2
+ if [ ${apache_has_conns} -eq 1 ]; then
+ cat <<VALUESEOF2
BEGIN apache_local.connections $1
SET connections = $((apache_connstotal))
END
diff --git a/collectors/charts.d.plugin/apcupsd/README.md b/collectors/charts.d.plugin/apcupsd/README.md
index e69de29bb..59739efcd 100644
--- a/collectors/charts.d.plugin/apcupsd/README.md
+++ b/collectors/charts.d.plugin/apcupsd/README.md
@@ -0,0 +1,7 @@
+# apcupsd
+
+*Under construction*
+
+Collects UPS metrics
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fapcupsd%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh b/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh
index e26ef566a..b4b92cdc5 100644
--- a/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh
+++ b/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh
@@ -11,7 +11,7 @@ apcupsd_ip=
apcupsd_port=
declare -A apcupsd_sources=(
- ["local"]="127.0.0.1:3551"
+ ["local"]="127.0.0.1:3551"
)
# how frequently to collect UPS data
@@ -35,46 +35,40 @@ apcupsd_check() {
require_cmd apcaccess || return 1
# backwards compatibility
- if [ "${apcupsd_ip}:${apcupsd_port}" != ":" ]
- then
- apcupsd_sources["local"]="${apcupsd_ip}:${apcupsd_port}"
+ if [ "${apcupsd_ip}:${apcupsd_port}" != ":" ]; then
+ apcupsd_sources["local"]="${apcupsd_ip}:${apcupsd_port}"
fi
- local host working=0 failed=0
- for host in "${!apcupsd_sources[@]}"
- do
- run apcupsd_get "${apcupsd_sources[${host}]}" >/dev/null
- # shellcheck disable=2181
- if [ $? -ne 0 ]
- then
- error "cannot get information for apcupsd server ${host} on ${apcupsd_sources[${host}]}."
- failed=$((failed + 1))
- elif [ "$(apcupsd_get "${apcupsd_sources[${host}]}" | awk '/^STATUS.*/{ print $3 }')" != "ONLINE" ]
- then
- error "APC UPS ${host} on ${apcupsd_sources[${host}]} is not online."
- failed=$((failed + 1))
- else
- working=$((working + 1))
- fi
- done
-
- if [ ${working} -eq 0 ]
- then
- error "No APC UPSes found available."
- return 1
- fi
+ local host working=0 failed=0
+ for host in "${!apcupsd_sources[@]}"; do
+ run apcupsd_get "${apcupsd_sources[${host}]}" >/dev/null
+ # shellcheck disable=2181
+ if [ $? -ne 0 ]; then
+ error "cannot get information for apcupsd server ${host} on ${apcupsd_sources[${host}]}."
+ failed=$((failed + 1))
+ elif [ "$(apcupsd_get "${apcupsd_sources[${host}]}" | awk '/^STATUS.*/{ print $3 }')" != "ONLINE" ]; then
+ error "APC UPS ${host} on ${apcupsd_sources[${host}]} is not online."
+ failed=$((failed + 1))
+ else
+ working=$((working + 1))
+ fi
+ done
+
+ if [ ${working} -eq 0 ]; then
+ error "No APC UPSes found available."
+ return 1
+ fi
return 0
}
apcupsd_create() {
- local host src
- for host in "${!apcupsd_sources[@]}"
- do
- src=${apcupsd_sources[${host}]}
+ local host src
+ for host in "${!apcupsd_sources[@]}"; do
+ src=${apcupsd_sources[${host}]}
- # create the charts
- cat <<EOF
+ # create the charts
+ cat <<EOF
CHART apcupsd_${host}.charge '' "UPS Charge for ${host} on ${src}" "percentage" ups apcupsd.charge area $((apcupsd_priority + 1)) $apcupsd_update_every
DIMENSION battery_charge charge absolute 1 100
@@ -103,12 +97,14 @@ DIMENSION temp temp absolute 1 100
CHART apcupsd_${host}.time '' "UPS Time Remaining for ${host} on ${src}" "Minutes" ups apcupsd.time area $((apcupsd_priority + 2)) $apcupsd_update_every
DIMENSION time time absolute 1 100
+CHART apcupsd_${host}.online '' "UPS ONLINE flag for ${host} on ${src}" "boolean" ups apcupsd.online line $((apcupsd_priority + 8)) $apcupsd_update_every
+DIMENSION online online absolute 0 1
+
EOF
- done
+ done
return 0
}
-
apcupsd_update() {
# the first argument to this function is the microseconds since last update
# pass this parameter to the BEGIN statement (see bellow).
@@ -117,10 +113,9 @@ apcupsd_update() {
# for each dimension
# remember: KEEP IT SIMPLE AND SHORT
- local host working=0 failed=0
- for host in "${!apcupsd_sources[@]}"
- do
- apcupsd_get "${apcupsd_sources[${host}]}" | awk "
+ local host working=0 failed=0
+ for host in "${!apcupsd_sources[@]}"; do
+ apcupsd_get "${apcupsd_sources[${host}]}" | awk "
BEGIN {
battery_charge = 0;
@@ -130,70 +125,76 @@ BEGIN {
input_voltage_min = 0;
input_voltage_max = 0;
input_frequency = 0;
- output_voltage = 0;
+ output_voltage = 0;
output_voltage_nominal = 0;
load = 0;
temp = 0;
time = 0;
}
-/^BCHARGE.*/ { battery_charge = \$3 * 100 };
-/^BATTV.*/ { battery_voltage = \$3 * 100 };
-/^NOMBATTV.*/ { battery_voltage_nominal = \$3 * 100 };
-/^LINEV.*/ { input_voltage = \$3 * 100 };
-/^MINLINEV.*/ { input_voltage_min = \$3 * 100 };
-/^MAXLINEV.*/ { input_voltage_max = \$3 * 100 };
-/^LINEFREQ.*/ { input_frequency = \$3 * 100 };
-/^OUTPUTV.*/ { output_voltage = \$3 * 100 };
-/^NOMOUTV.*/ { output_voltage_nominal = \$3 * 100 };
-/^LOADPCT.*/ { load = \$3 * 100 };
-/^ITEMP.*/ { temp = \$3 * 100 };
-/^TIMELEFT.*/ { time = \$3 * 100 };
+/^BCHARGE.*/ { battery_charge = \$3 * 100 };
+/^BATTV.*/ { battery_voltage = \$3 * 100 };
+/^NOMBATTV.*/ { battery_voltage_nominal = \$3 * 100 };
+/^LINEV.*/ { input_voltage = \$3 * 100 };
+/^MINLINEV.*/ { input_voltage_min = \$3 * 100 };
+/^MAXLINEV.*/ { input_voltage_max = \$3 * 100 };
+/^LINEFREQ.*/ { input_frequency = \$3 * 100 };
+/^OUTPUTV.*/ { output_voltage = \$3 * 100 };
+/^NOMOUTV.*/ { output_voltage_nominal = \$3 * 100 };
+/^LOADPCT.*/ { load = \$3 * 100 };
+/^ITEMP.*/ { temp = \$3 * 100 };
+/^TIMELEFT.*/ { time = \$3 * 100 };
+/^STATUS.*/ { online=(\$3 == \"ONLINE\")?1:0 };
END {
- print \"BEGIN apcupsd_${host}.charge $1\";
- print \"SET battery_charge = \" battery_charge;
- print \"END\"
-
- print \"BEGIN apcupsd_${host}.battery_voltage $1\";
- print \"SET battery_voltage = \" battery_voltage;
- print \"SET battery_voltage_nominal = \" battery_voltage_nominal;
- print \"END\"
-
- print \"BEGIN apcupsd_${host}.input_voltage $1\";
- print \"SET input_voltage = \" input_voltage;
- print \"SET input_voltage_min = \" input_voltage_min;
- print \"SET input_voltage_max = \" input_voltage_max;
- print \"END\"
-
- print \"BEGIN apcupsd_${host}.input_frequency $1\";
- print \"SET input_frequency = \" input_frequency;
- print \"END\"
-
- print \"BEGIN apcupsd_${host}.output_voltage $1\";
- print \"SET output_voltage = \" output_voltage;
- print \"SET output_voltage_nominal = \" output_voltage_nominal;
- print \"END\"
-
- print \"BEGIN apcupsd_${host}.load $1\";
- print \"SET load = \" load;
- print \"END\"
-
- print \"BEGIN apcupsd_${host}.temp $1\";
- print \"SET temp = \" temp;
+ print \"BEGIN apcupsd_${host}.online $1\";
+ print \"SET online = \" online;
print \"END\"
- print \"BEGIN apcupsd_${host}.time $1\";
- print \"SET time = \" time;
- print \"END\"
+ if (online == 1) {
+ print \"BEGIN apcupsd_${host}.charge $1\";
+ print \"SET battery_charge = \" battery_charge;
+ print \"END\"
+
+ print \"BEGIN apcupsd_${host}.battery_voltage $1\";
+ print \"SET battery_voltage = \" battery_voltage;
+ print \"SET battery_voltage_nominal = \" battery_voltage_nominal;
+ print \"END\"
+
+ print \"BEGIN apcupsd_${host}.input_voltage $1\";
+ print \"SET input_voltage = \" input_voltage;
+ print \"SET input_voltage_min = \" input_voltage_min;
+ print \"SET input_voltage_max = \" input_voltage_max;
+ print \"END\"
+
+ print \"BEGIN apcupsd_${host}.input_frequency $1\";
+ print \"SET input_frequency = \" input_frequency;
+ print \"END\"
+
+ print \"BEGIN apcupsd_${host}.output_voltage $1\";
+ print \"SET output_voltage = \" output_voltage;
+ print \"SET output_voltage_nominal = \" output_voltage_nominal;
+ print \"END\"
+
+ print \"BEGIN apcupsd_${host}.load $1\";
+ print \"SET load = \" load;
+ print \"END\"
+
+ print \"BEGIN apcupsd_${host}.temp $1\";
+ print \"SET temp = \" temp;
+ print \"END\"
+
+ print \"BEGIN apcupsd_${host}.time $1\";
+ print \"SET time = \" time;
+ print \"END\"
+ }
}"
- # shellcheck disable=SC2181
- if [ $? -ne 0 ]
- then
- failed=$((failed + 1))
- error "failed to get values for APC UPS ${host} on ${apcupsd_sources[${host}]}" && return 1
- else
- working=$((working + 1))
- fi
- done
+ # shellcheck disable=SC2181
+ if [ $? -ne 0 ]; then
+ failed=$((failed + 1))
+ error "failed to get values for APC UPS ${host} on ${apcupsd_sources[${host}]}" && return 1
+ else
+ working=$((working + 1))
+ fi
+ done
[ $working -eq 0 ] && error "failed to get values from all APC UPSes" && return 1