[rrd-users] Whole numbers.

Eduardo Bragatto eduardo at bragatto.com
Sat Jan 8 17:29:38 CET 2011


On Jan 8, 2011, at 9:56 AM, Paul Halliday wrote:

>    stamp=`date -v-${i}d -v0H -v0M -v+${int}S +"%s"`

I'm not familiarized with that "date" syntax. I noticed "-v" does  
exist on my Mac but not in Linux (although I've never seen it before).

Because your code does not have any reference to the variable ${i} and  
is incomplete, it's hard to understand what updates were made to rrd.

Ideally we would like to see the update commands and not the script  
(e.g. just put an "echo" before the "rrdtool update" call and when you  
run we will see exactly what would happen).

Anyway, replacing some of the variables above with values that *seems*  
to make sense, I got this:

$ date -v-1d -v0H -v0M -v+300S +"%s"
1294365923
$ date -v-1d -v0H -v0M -v+600S +"%s"
1294366225
$ date -v-1d -v0H -v0M -v+900S +"%s"
1294366528

Obviously the result is not what we expect.

I suggest you to drop that complex date syntax (since it's not  
compatible with lots of other unix systems) and round the number using  
"bc" or something else:

$ echo `date +%s` "/ 300 * 300" | bc
1294503900

When you divide and multiply an integer by another one, rounding  
occurs automatically and fixes your timestamp.

I hope you can get your problem solved from this...

Best regards,
Eduardo Bragatto.



More information about the rrd-users mailing list