From 50485bedfd9818165aa1d039d0abe95a559134b7 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 8 Feb 2019 08:31:03 +0100 Subject: Merging upstream version 1.12.0. Signed-off-by: Daniel Baumann --- collectors/charts.d.plugin/nut/README.md | 2 ++ collectors/charts.d.plugin/nut/nut.chart.sh | 35 +++++++++++------------------ 2 files changed, 15 insertions(+), 22 deletions(-) (limited to 'collectors/charts.d.plugin/nut') diff --git a/collectors/charts.d.plugin/nut/README.md b/collectors/charts.d.plugin/nut/README.md index 71906f55a..3e1699363 100644 --- a/collectors/charts.d.plugin/nut/README.md +++ b/collectors/charts.d.plugin/nut/README.md @@ -57,3 +57,5 @@ nut_update_every=2 ``` --- + +[![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%2Fnut%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]() diff --git a/collectors/charts.d.plugin/nut/nut.chart.sh b/collectors/charts.d.plugin/nut/nut.chart.sh index 7e252f325..933d3561d 100644 --- a/collectors/charts.d.plugin/nut/nut.chart.sh +++ b/collectors/charts.d.plugin/nut/nut.chart.sh @@ -34,8 +34,7 @@ nut_get_all() { nut_get() { run -t $nut_timeout upsc "$1" - if [ "${nut_clients_chart}" -eq "1" ] - then + if [ "${nut_clients_chart}" -eq "1" ]; then printf "ups.connected_clients: " run -t $nut_timeout upsc -c "$1" | wc -l fi @@ -51,27 +50,23 @@ nut_check() { require_cmd upsc || return 1 - [ -z "$nut_ups" ] && nut_ups="$( nut_get_all )" + [ -z "$nut_ups" ] && nut_ups="$(nut_get_all)" - for x in $nut_ups - do + for x in $nut_ups; do nut_get "$x" >/dev/null # shellcheck disable=SC2181 - if [ $? -eq 0 ] - then - if [ ! -z "${nut_names[${x}]}" ] - then - nut_ids[$x]="$( fixid "${nut_names[${x}]}" )" + if [ $? -eq 0 ]; then + if [ ! -z "${nut_names[${x}]}" ]; then + nut_ids[$x]="$(fixid "${nut_names[${x}]}")" else - nut_ids[$x]="$( fixid "$x" )" + nut_ids[$x]="$(fixid "$x")" fi continue fi error "cannot get information for NUT UPS '$x'." done - if [ ${#nut_ids[@]} -eq 0 ] - then + if [ ${#nut_ids[@]} -eq 0 ]; then # shellcheck disable=SC2154 error "Cannot find UPSes - please set nut_ups='ups_name' in $confd/nut.conf" return 1 @@ -84,8 +79,7 @@ nut_create() { # create the charts local x - for x in "${nut_ids[@]}" - do + for x in "${nut_ids[@]}"; do cat <