[rrd-users] Fwd: start time

Simon Hobson linux at thehobsons.co.uk
Fri Jul 1 14:55:29 CEST 2011

fadwa salam wrote:

>it shows ok, but when i run rrdtool fetch it does not accept the value 3600
>rrdtool fetch $rrd AVERAGE -r $period -s $time =====> ERROR: start 
>time: did you really mean month 3600?

That's because you have given it the wrong start time ! 3600s is back 
in January 1970. You want :

rrdtool fetch ${rrd} AVERAGE -r ${period} -s ${start} -e ${end}

BTW - as a general comment on coding standards, my preference is to 
include the {} even when not needed. The main reason is that there 
are several situation where they are needed, and it's easy to miss 
them out when you should include them, leading to incorrect results.
Eg, suppose your program creates several temporary files, you might 
do something like :

tmp_fil="/var/`something that generates a random name`"

<do something> > "$tmpone"
<do something else> > "$tmptwo"

This will fail because the shell expands $tmpone and $tmptwo to empty 
strings, giving the effective code :
<do something> >
<do something else> >

Whereas using :
<do something> > "${tmp}one"
<do something else> > "${tmp}two"

will work as shell expansion gives this :
<do something> > "/var/<something>one"
<do something else> > "/var/<something>two"

Quotes are also a good idea, otherwise your code breaks when someone 
uses a path containing a space, etc.

Just a couple of tips so you don't need to learn it the way most of us did ;-)

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