summaryrefslogtreecommitdiffstats
path: root/charts.d/nut.chart.sh
diff options
context:
space:
mode:
authorKyle Lucy <kmlucy@gmail.com>2018-06-25 23:34:06 -0400
committerKyle Lucy <kmlucy@gmail.com>2018-06-25 23:34:06 -0400
commitec0d897da8e8a25457156fe8a855f20d142bddfc (patch)
tree6400e118c4afd08241df1af3bd8f4d05729ad250 /charts.d/nut.chart.sh
parent6497d7efe8f6f63a4939a028cf6bd875960172e1 (diff)
add ability to alias nut UPS names
Diffstat (limited to 'charts.d/nut.chart.sh')
-rw-r--r--charts.d/nut.chart.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/charts.d/nut.chart.sh b/charts.d/nut.chart.sh
index 36eb5587b1..19dd641b5d 100644
--- a/charts.d/nut.chart.sh
+++ b/charts.d/nut.chart.sh
@@ -24,6 +24,7 @@ nut_clients_chart=0
nut_priority=90000
declare -A nut_ids=()
+declare -A nut_names=()
nut_get_all() {
run -t $nut_timeout upsc -l
@@ -56,7 +57,12 @@ nut_check() {
nut_get "$x" >/dev/null
if [ $? -eq 0 ]
then
- nut_ids[$x]="$( fixid "$x" )"
+ if [ ! -z "${nut_names[${x}]}" ]
+ then
+ nut_ids[$x]="$( fixid "${nut_names[${x}]}" )"
+ else
+ nut_ids[$x]="$( fixid "$x" )"
+ fi
continue
fi
error "cannot get information for NUT UPS '$x'."