Hi, I'm sorry if I bother you with perl problem (lack of skills?) you might not care about - in that case could someone point me to a correct perl mailing list to be bothered.
I'm trying to make a perl script to create graphs, much like in http://martybugs.net/linux/hddtemp2.cgi Only I would like to pass different amount of data to CreateGraph function each time and have that function to loop through parameters and create DEF and LINE/GRAPH -lines based on that. Something along the lines of (doesn't work but cannot figure out what I'm doing wrong): ------------------------------- &CreateGraph("$computer", "day", "$harddrives); &CreateGraph("$computer", "week", "$harddrives); sub CreateGraph { # creates graph # inputs: $_[0]: computer id # $_[1]: interval (ie, day, week, month, year) # $_[2]: hard drive names for computer (ie, hda, hdb, hdc) $size = scalar @_; # get total amount of parameters $defs = ''; $graphs = ''; for($i = 2; $i < $size; $i++) { $defs .= "DEF:$_[$i]=$rrd/$_[$i].rrd:temp:AVERAGE "; $graphs .= "LINE2:$_[$i]#FF9900:$_[$i]\\: "; $graphs .= "GPRINT:$_[$i]:MIN: Min\\: %2.lf ", $graphs .= "GPRINT:$_[$i]:MAX: Max\\: %2.lf ", $graphs .= "GPRINT:$_[$i]:AVERAGE: Avg\\: %4.1lf ", $graphs .= "GPRINT:$_[$i]:LAST: Current\\: %2.lf degrees C\\n ", } RRDs::graph "$img/$_[0]/hddtemp-$_[1].png", "--lazy", "-s -1$_[1]", "-t hdd temperature :: hard disk drives", "-h", "80", "-w", "600", "-a", "PNG", "-v degrees C", "--slope-mode", "$defs", "$graphs"; if ( = RRDs::error) { print "$0: unable to generate $_[1] graph: $ERROR\n"; } } ------------------------------------ Could anyone help me on this? -- Jaakko Kemppainen [email protected] _______________________________________________ rrd-users mailing list [email protected] https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
