[rrd-users] Please, How to plot several lines in one graphic

Leonardo Barbosa e Oliveira leob at dcc.ufmg.br
Tue Mar 5 16:04:28 MET 2002





Dear Sirs,

I would like to plot graphics without know, previously,
how many lines I have to plot.

I try to do via perl, but it doesnt work

sub  ErradoCriaGrafico {
    # Parametros - O nome do RRD e do titulo que serah dado ao eixo Y do
grafico
    # e  o inicio e fim do eixo Y (tempo)
    my ($rrd, $titulo, $nomeFigura,$diretorio, $nomeEixoY,
$horaComecaPlotar, $horaTerminaPlotar, $linhaHorizontal, $legenda,
@trafegoNomes) = @_; 
    my $def  = '';
    my $ERROR;
    my $line = '';
    my $quantidadeTrafego = @trafegoNomes;
    my $count;
    my $limiteSuperior = ((5 * $linhaHorizontal)/4);
    my $figura = $diretorio . $nomeFigura;
    my @cor =
('00FF00','0000FF','555555','FF00FF','FFFF00','00FFFF','FF0000');


    
    for ($count = 0; $count < $quantidadeTrafego; $count++) {
    	$def  = $def  . "DEF:$count=$rrd:$trafegoNomes[$count]:AVERAGE ";
	$line = $line . "LINE3:$count#$cor[$count]:$legenda";
    }

   # WHEN THE VARIABLE $line IS CALLED BELLOW, IT DOES NOT UNDERESTAND
   # WHAT I DO AND NOT PLOT ALL THE LINES (IT PLOT ONE INSTEAD

    RRDs::graph "$figura",
                "--title", "Grafico $titulo", 
		"--height", "200 ",
	        "--width", "500 ",                    
                "--upper-limit", "$limiteSuperior",
		"--start", "$horaComecaPlotar",
                "--end", "$horaTerminaPlotar",
		"--lower-limit", "0",
		"--interlace",
		"--imgformat", "PNG",
		"--width", "450",
                "--vertical-label", "$nomeEixoY",
		"$def",
		"$line",
	        "HRULE:$linhaHorizontal#FF0000:Limite para geracao de
alarme";
    if ($ERROR = RRDs::error) {
        print"Content-type: text/html\n\n"; 
        print "ERROR: $ERROR\n";
    }
}    


[]'s!
     
     Leonardo

      "You are what you eat"
                 Garfield 
         
-------------------- 		 
Leonardo Barbosa e Oliveira	
Lab. ATM/DCC/UFMG/Brasil - leob at dcc.ufmg.br
Projeto ReMAV BH2 - http://www.dcc.ufmg.br/~admbh2
Grupo de Gerencia, Operacao e Manutencao da Rede



--
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