Simon, sorry about late reply. So basically I guess something like this should work:
<<<<< #!/bin/bash #executes hddtemp and prints only the temperature number without units temp=$(hddtemp -n /dev/sda) #in case $temp string is empty, a "U" value is put to the database if [ -n "$temp" ] then rrdtool update /home/martin/hdd.rrd N:$temp else rrdtool update /home/martin/hdd.rrd N:U fi >>>>> Am I correct? regards, martin 2011/6/10 Simon Hobson <li...@thehobsons.co.uk>: > Martin T wrote: > >>I'm sure it's showing zeros- when the network outage started, HDD >>temperature value went from previous value directly to zero. If I had >>a network outage and server was unreachable to a machine where >>rrdtools runs, following data was written to RRD: >> >># rrdtool fetch HDD.rrd AVERAGE -s 1307061000 -e 1307075400 >> HDD >> >>1307061600: 2.8986899863e+01 >>1307062800: 0.0000000000e+00 >>1307064000: 0.0000000000e+00 >>1307065200: 0.0000000000e+00 >>1307066400: 0.0000000000e+00 >>1307067600: 0.0000000000e+00 >>1307068800: 0.0000000000e+00 >>1307070000: 0.0000000000e+00 >>1307071200: 0.0000000000e+00 >>1307072400: 0.0000000000e+00 >>1307073600: 0.0000000000e+00 >>1307074800: 1.0011661112e+01 >>1307076000: 3.3748035371e+01 > > Yes, it's storing zeros. > >>If any additional information is needed, please ask! >> >>Am I correct, that in my case there are zeros written to the RRD in >>case of UNKNOWN value? If yes, how to change this behavior? > > No, I can assure you that if you write unknown (or don't update at > all) then you'll get unknown. > > So I'll refer you to a question I asked earlier : > >> > Are you sure you are writing unknowns and not zeroes to the database >> > OR are not writing anything ? > > I suggest you need to look at your script and see what it's doing. My > guess is that you are not correctly handing a lack of response - I > think you must use the value "U" and not just an empty string. One > useful technique is to add debugging statements and write data to a > text file. For example, if your script had something like this : > > rrdtool update "${db_file}" "${timestamp}:${value}" > > then you coould change that to : > > rrdtool update "${db_file}" "${timestamp}:${value}" > echo rrdtool update "${db_file}" "${timestamp}:${value}" >> "${debugfile}" > > Perhaps if you posted the relevant bits of your script ? > > -- > Simon Hobson > > Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed > author Gladys Hobson. Novels - poetry - short stories - ideal as > Christmas stocking fillers. Some available as e-books. > > _______________________________________________ > rrd-users mailing list > rrd-users@lists.oetiker.ch > https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users > _______________________________________________ rrd-users mailing list rrd-users@lists.oetiker.ch https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users