diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:19:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:20:17 +0000 |
commit | a64a253794ac64cb40befee54db53bde17dd0d49 (patch) | |
tree | c1024acc5f6e508814b944d99f112259bb28b1be /collectors/charts.d.plugin/hddtemp/hddtemp.chart.sh | |
parent | New upstream version 1.10.0+dfsg (diff) | |
download | netdata-upstream/1.11.0+dfsg.tar.xz netdata-upstream/1.11.0+dfsg.zip |
New upstream version 1.11.0+dfsgupstream/1.11.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | collectors/charts.d.plugin/hddtemp/hddtemp.chart.sh (renamed from charts.d/hddtemp.chart.sh) | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/charts.d/hddtemp.chart.sh b/collectors/charts.d.plugin/hddtemp/hddtemp.chart.sh index 3aada1751..e90310981 100644 --- a/charts.d/hddtemp.chart.sh +++ b/collectors/charts.d.plugin/hddtemp/hddtemp.chart.sh @@ -1,9 +1,10 @@ +# shellcheck shell=bash # no need for shebang - this file is loaded from charts.d.plugin +# SPDX-License-Identifier: GPL-3.0-or-later # netdata # real-time performance and health monitoring, done right! # (C) 2016 Costa Tsaousis <costa@tsaousis.gr> -# GPL v3+ # # contributed by @paulfantom with PR #511 @@ -30,13 +31,14 @@ hddtemp_create() { local all all=$(nc $hddtemp_host $hddtemp_port ) unset hddtemp_disks - hddtemp_disks=( `grep -Po '/dev/[^|]+' <<< "$all" | cut -c 6-` ) + # shellcheck disable=SC2190,SC2207 + hddtemp_disks=( $(grep -Po '/dev/[^|]+' <<< "$all" | cut -c 6-) ) fi # local disk_names # disk_names=(`sed -e 's/||/\n/g;s/^|//' <<< "$all" | cut -d '|' -f2 | tr ' ' '_'`) echo "CHART hddtemp.temperature 'disks_temp' 'temperature' 'Celsius' 'Disks temperature' 'hddtemp.temp' line $((hddtemp_priority)) $hddtemp_update_every" - for i in `seq 0 $((${#hddtemp_disks[@]}-1))`; do + for i in $(seq 0 $((${#hddtemp_disks[@]}-1))); do # echo "DIMENSION ${hddtemp_disks[i]} ${disk_names[i]} absolute 1 1" echo "DIMENSION ${hddtemp_disks[$i]} '' absolute 1 1" done @@ -44,13 +46,14 @@ hddtemp_create() { } # _update is called continuously, to collect the values -hddtemp_last=0 -hddtemp_count=0 +#hddtemp_last=0 +#hddtemp_count=0 hddtemp_update() { # local all=( `nc $hddtemp_host $hddtemp_port | sed -e 's/||/\n/g;s/^|//' | cut -d '|' -f3` ) # local all=( `nc $hddtemp_host $hddtemp_port | awk 'BEGIN { FS="|" };{i=4; while (i <= NF) {print $i+0;i+=5;};}'` ) OLD_IFS=$IFS set -f + # shellcheck disable=SC2207 IFS="|" all=( $(nc $hddtemp_host $hddtemp_port 2>/dev/null) ) set +f IFS=$OLD_IFS |