[rrd-users] For..next loops within RRDs Perl module calls

m_elias m_elias at fastmail.fm
Wed Aug 17 20:33:28 CEST 2011


Thanks for the replies, I am now till the stage in my project where it is
time to write this code. I'm pretty sure I can make it work as Mr Thornton
suggested, but I'm curious about Mr Rushworth's suggestion. Martin, can you
elaborate a bit more on your array passing technique? I'm not clear as to
what is all happening. Below is a sample of how I've been generating graphs
with the RRDs module. It shows only a few DEFs but my goal is to graph as
many temp sensors as each bin has rrd files (6-13) with one graph per bin.
$_[0] is the bin number and $_[1] the time frame.

	RRDs::graph("$img/bin$_[0]-temps-$_[1].png",
		"-s", "-$_[1]",
		"-t", "$_[0] Waterlevels: $_[1]",
		"-h", "$gheight", "-w", "$gwidth",
		"-a", "PNG",
		"-v", "Temp C",

		"DEF:sensor1=$rrd/bin$_[0]-1.temps.rrd:Temp:AVERAGE",
		"DEF:sensor2=$rrd/bin$_[0]-2.temps.rrd:Temp:AVERAGE",
                .
                .
                .
		"DEF:sensor10=$rrd/bin$_[0]-10.temps.rrd:Temp:AVERAGE",

		"CDEF:nan=sensor1,UN,INF,UNKN,IF",
		"AREA:nan#FF000070",
		
		"LINE1:sensor1#32CD32:Sensor 1",		
		"LINE2:sensor2#4169E1:Sensor 2",
                .
                .
                .
		"LINE10:sensor10#4169E1:Sensor 10");

So I just push all the bits into an array, each section in quotes being an
element?

push (@array, "-s");
push (@array, "-$_[1]");
push (@array, "-t");
etc

Then I'm confused by the "my ($avg,$xsize,$ysize) =" bit in front of
"RRDs::graph @array;" .

Thanks, again.

--
View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/For-next-loops-within-RRDs-Perl-module-calls-tp6435876p6696565.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.



More information about the rrd-users mailing list