diff options
author | paulfantom <paulfantom@gmail.com> | 2016-06-08 01:19:03 +0200 |
---|---|---|
committer | paulfantom <paulfantom@gmail.com> | 2016-06-08 01:22:46 +0200 |
commit | c5edd9644412ab8961bb6cbff7aa926bda567888 (patch) | |
tree | 9d0aca8dc5c6305d090f9d51669313fbc13d9255 /charts.d/hddtemp.chart.sh | |
parent | 3b75b49d6a47e1f20d630c857ad89d7322f1599a (diff) |
hddtemp_update() return 1 if there is no data
Diffstat (limited to 'charts.d/hddtemp.chart.sh')
-rwxr-xr-x | charts.d/hddtemp.chart.sh | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/charts.d/hddtemp.chart.sh b/charts.d/hddtemp.chart.sh index 91bac6cff5..fea9f8018c 100755 --- a/charts.d/hddtemp.chart.sh +++ b/charts.d/hddtemp.chart.sh @@ -43,10 +43,15 @@ hddtemp_update() { # 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 - IFS="|" all=( $(nc $hddtemp_host $hddtemp_port) ) + IFS="|" all=( $(nc $hddtemp_host $hddtemp_port 2>/dev/null) ) set +f IFS=$OLD_IFS + # check if there is some data + if [ -z "${all[3]}" ]; then + return 1 + fi + # write the result of the work. echo "BEGIN hddtemp.temperature $1" end=${#hddtemp_disks[@]} |