On Wed, Nov 27, 2002 at 09:46:38AM -0000, Simon Mullis wrote: > Is there an easy way to express the timespan as a variable or output from > RRDTool to then output via PRINT or GPRINT? I am using a web form with a > fairly free method of entering the start and end times and I think I would > have to redevelop the pages if I had to express the time in a way that would > allow me to convert into seconds easily. (I am using RRDcgi) > > Many thanks in advance for any tips or help from anyone.
You need to know this graph shows "n" seconds of data, right? If you cannot, or choose not to, calculate this in your front end then it will be hard to do as RRDtool has no such function AFAIK. However, consider the following approach: Have one extra DS called "time". In your rrdtool create command have "DS:time:GAUGE:700:U:U". Keep a MIN and a MAX RRA. Update this variable with the real time each time. In your update command do not use "N" for current time but update using "rrdtool update whatever.rrd 123456789:123456789:ds0:ds1" (where 123456789 is the output of "date +%s", ds0 and ds1 are the numbers you currently have). Now you can use this DS in your rrdtool graph command. Find the time using DEF:starttime=whatever.rrd:time:MIN DEF:endtime=whatever.rrd:time:MAX PRINT:starttime:MIN:"%12.0lf" PRINT:endtime:MAX:"%12.0lf" Now your front end application at graph time gets the selected start time and end time in seconds since the epoch which can be used to calculate the time span for this graph or do whatever else you want to do with it. HTH Alex -- Unsubscribe mailto:[EMAIL PROTECTED] Help mailto:[EMAIL PROTECTED] Archive http://www.ee.ethz.ch/~slist/rrd-users WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
