]> arthur.barton.de Git - netdata.git/commitdiff
hddtemp_update() return 1 if there is no data
authorpaulfantom <paulfantom@gmail.com>
Tue, 7 Jun 2016 23:19:03 +0000 (01:19 +0200)
committerpaulfantom <paulfantom@gmail.com>
Tue, 7 Jun 2016 23:22:46 +0000 (01:22 +0200)
charts.d/hddtemp.chart.sh

index 91bac6cff592c83360ae1fbceb5d1bfe6473956d..fea9f8018cb2e231cec4be326f9aefdff910a2f3 100755 (executable)
@@ -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[@]}