[rrd-users] [rrd] Can't I turn off data smoothing for GAUGE?

Simon Hobson linux at thehobsons.co.uk
Thu Aug 19 20:42:36 CEST 2010

Philip Peake wrote:

>My data gathering script is in perl.
>It has an inner loop which sleeps for 30 seconds, which means that 
>processing is going to take it over the 30 second boundary.
>What I did was:
>$t = time();
>$t = $t - ($t%30);
>and use $t in place of "N".

I'd suggest you need to sleep for less than 30s - otherwise you keep 
creeping later and later until you end up 29 seconds behind. Then you 
trip over the 30 seconds and miss an update altogether.

I suspect sleeping for 30-(t%30) is probably more like what you want.

I've got a script that does something a bit similar - except it's 
collecting data every 2 seconds. I run it from cron every minute (so 
I don't need to bother about how to start it and restart it if it 
stops), and it just loops round 29 times doing read-sleep-read-sleep. 
Sometimes I'll get an error if the last update goes over the minute 
and is the same time (or even later) than the next minutes invocation.
But since it's for something that's not critical either on timing or 
accuracy then I'm not that bothered.

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.

More information about the rrd-users mailing list