hddtemp_update() return 1 if there is no data
paulfantom committed
Jun 8, 2016 at 01:19 UTC
c5edd9644412ab8961bb6cbff7aa926bda567888
1 file changed
+6
-1
charts.d/hddtemp.chart.sh
+6
-1
@@ -43,10 +43,15 @@ hddtemp_update() {
43
# local all=( `nc $hddtemp_host $hddtemp_port | awk 'BEGIN { FS="|" };{i=4; while (i <= NF) {print $i+0;i+=5;};}'` )
44
OLD_IFS=$IFS
45
set -f
46
- IFS="|" all=( $(nc $hddtemp_host $hddtemp_port) )
46
+ IFS="|" all=( $(nc $hddtemp_host $hddtemp_port 2>/dev/null) )
47
set +f
48
IFS=$OLD_IFS
49
50
+ # check if there is some data
51
+ if [ -z "${all[3]}" ]; then
52
+ return 1
53
+ fi
54
+
55
# write the result of the work.
56
echo "BEGIN hddtemp.temperature $1"
57
end=${#hddtemp_disks[@]}