[rrd-users] newbie help please.... RRDTool 'DEF' statement parsing
Matchan, Neil W
Neil.W.Matchan at team.telstra.com
Tue May 20 07:03:08 MEST 2003
Greetings all,
I'm trying to pass an array of 'defs, cdefs, area & line' definitions to RRDTool but only the 1st 'def' statement seems to be accepted.
The idea behind this is to have a Perl CGI script create graphs based upon user selected 'devices' and 'intefaces'. As these are
user selectable, the number of 'DEF, CDEF, AREA and LINE1' statements used will vary, so I can't pre-define them to the script.
The CGI builds the necessary strings and stores them in various arrays, I then use the array names in the RRDs::graph statement.
eg.
@def0[0] = "DEF:router0in1=" . $path . "/router0_fa01.rrd:ds0:MAX";
@def0[1] = "DEF:router0in2=" . $path . "/router0_fa02.rrd:ds0:MAX";
@def0[2] = "DEF:router1in1=" . $path . "/router1_fa01.rrd:ds0:MAX";
@def0[3] = "DEF:router1in2=" . $path . "/router1_fa02.rrd:ds0:MAX";
@def0[4] = "DEF:router2in1=" . $path . "/router2_fa01.rrd:ds0:MAX";
@def0[5] = "DEF:router2in2=" . $path . "/router2_fa02.rrd:ds0:MAX";
@cdef0[0] = "CDEF:aggr00=router0in1,router0in2,+,8,*";
@cdef0[1] = "CDEF:aggr01=router1in1,router1in2,+,8,*,aggr00,+";
@cdef0[2] = "CDEF:aggr02=router2in1,router2in2,+,8,*,aggr01,+";
@area[0] = "AREA:aggr02#FF0000:router2";
@area[1] = "AREA:aggr01#00FF00:router1";
@area[2] = "AREA:aggr00#0000FF:router0";
@line[0] = "LINE1:aggr02#FF0000";
@line[1] = "LINE1:aggr01#00FF00";
@line[2] = "LINE1:aggr00#0000FF";
RRDs::graph "/home/me/test.png",
"--title", "aggregated traffic test graph",
"--start", "-1d",
"--end", "now",
"--step", "300",
"--imgformat", "PNG",
"--width", "850",
"--height", "300",
"--vertical-label", "bits per second",
"@def0", # "$def0[0]", "def0[1]", "def0[2]", etc seem to work when using explicated CDEF statements.
"@cdef0",
# "CDEF:aggr00=router0in1,router0in1,+,8,*", # this works (when not commented out)
# "CDEF:aggr00=router0in1,router0in2,+,8,*", # this doesn't (I assume router0in2 isn't defined because it's DEF failed ????)
# "@area",
# "@line",
"AREA:aggr02#FF0000:router2",
"AREA:aggr01#00FF00:router1",
"AREA:aggr00#0000FF:router0",
"LINE1:aggr02#FF0000",
"LINE1:aggr01#00FF00",
"LINE1:aggr00#0000FF";
if ($ERROR = RRDs::error) {
print ("Opps $ERROR\n");
}
Can the RRDTool parser accepts a 'list' or 'array' of statements?
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