[rrd-users] newbie help please - RRDTOOL GPRINT/LTIME (using Perl module)

Matchan, Neil W Neil.W.Matchan at team.telstra.com
Fri May 9 01:48:19 MEST 2003


Hi all,

I want to include the start/finish date/time's of a graphs 'period' into its legend but all I seem to be able to get is the start/finish epoch times.

I've considered using the --start & --end values but the AT-STYLE formats vary greatly and I use a mixture of then depending on what options
are used (passed in) to the perl/cgi script. 

Is there any way of getting a "year/month/day/hours/minutes" string from the rrd achieve that I can then use in a GPRINT statement?

An "rrdtool dump" shows "<!-- 2003-05-08 11:00:00 EST / 1052182800 --> <row><v> 0" so it 'looks like' the info is in there.

The end result I'm trying to get from the GPRINT statement is:
"Start Date/Time 08:00 2003-05-02, End Date/Time 11:00 2003-05-08" (or simular).


Here's the perl code I'm using:

sub makeTrafficGraph: {
  my $rrdGraphWidth = ($graphwidth / $rrdRow);
  if ($rrdRow ne "1") {
    $rrdGraphWidth = ($rrdGraphWidth - $graphwidthadjust);
  }

  my $graphTitle = ("$rrdDevice\, $interfaceName");
  if (($deviceText eq "") && ($portName ne "")) { $graphTitle = $portName };
  if (($deviceText ne "") && ($portName eq "")) { $graphTitle = $deviceText };

    my $imageName = ("$rrdname\_$rrdInterval\_$rrdPeriod\_$rrdType\_$graphType\_$rrdRow");
    RRDs::graph "$rrdroot$network$imageName.png",
    "--title", "$graphTitle",
    "--start", "$graphStartDate",                                                  # "14:10 -2w" or "11:30 20030201"
    "--end", "$graphEndDate",                                                      # "23:59 20030508"
    "--step", "300",
    "--color", "GRID#999999",
    "--color", "FONT#000000",
    "--color", "SHADEB#000000",
    "--color", "CANVAS#FFFFFF",
    "--imgformat","PNG",
    "--width=$rrdGraphWidth",                                                      # "890"
    "--base", "$graphBaseLine",                                                    # "1000"
    "--height=$graphheight",                                                       # "330"
    "--vertical-label","$graphVerticalTitle",                                      # "bits per second"
    "DEF:r01bytesave0=$rrdroot$network$rrdname\.rrd:ds0:$rrdType",                 # "rrd path/name" "MAX"
    "DEF:r01bytesave1=$rrdroot$network$rrdname\.rrd:ds1:$rrdType",                 # "rrd path/name" "MAX"
    "CDEF:r01inbound=r01bytesave0,UN,0,r01bytesave0,IF,$graphMultiplier,*",        # "8"
    "CDEF:r01outbound=r01bytesave1,UN,0,r01bytesave1,IF,$graphMultiplier,*",       # "8"
    "CDEF:graphtime=r01bytesave1,POP,LTIME",
    "AREA:r01inbound#00D000",
    "LINE1:r01inbound#00D000:$rrdDevice Inbound  $interfaceName\, Speed $speed",
    "LINE1:r01outbound#0000D0:$rrdDevice Outbound $interfaceName\, Speed $speed",
    "GPRINT:graphtime:MIN:Start Date/Time %lf, ",
    "GPRINT:graphtime:MAX:End Date/Time %lf";

    if ($ERROR = RRDs::error) {
      print $cgi->h3("ERROR Graph: $ERROR\n");
    }
}


Thanks in advance,
Neil M

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list