#!/usr/bin/perl -w

##path data base
$rrd='/home/mjail/WWW/data_base/j_Use.rrd';

##last unix time registered and added ti database
$last=`last`;
$last=`rrdtool $last $rrd`;$file1='/home/mjail/WWW/data_base/dia.png';

##current date
$fecha=`date +"%c %Z"`;
$ONE_DAY_AGO=$(($NOW-86400))
$ONE_WEEK_AGO=$(($NOW-604800))
$ONE_MONTH_AGO=$(($NOW-2419200))
$ONE_YEAR_AGO=$(($NOW-29030400))$width=600;

##graphic width & height
$height=250;

## 1dia
`'/usr/local/bin/rrdtool graph $file1 --imgformat PNG --start -1day --end $last --width $width --height $height \'`;
`'DEF:mem_Matrix=$totMem_matrix:AVERAGE \'`;
`'COMMENT:"          %mem uso Matrix\\n" \'`;
`'DEF:cpu_matrix=$totCpu_matrix:AVERAGE \'`;
`'COMMENT:"         %cpu uso Matrix\\n" \'`;
`'COMMENT:"           " COMMENT:"          %mem       %cpu       time Último\\n" \'`;
`'COMMENT:"           " \'`;
`'GPRINT:mem_Matrix:MIN:"0" \'`;
`'GPRINT:mem_Matrix:MAX:"100" \'`;
`'GPRINT:mem_Matrix:AVERAGE:"100" \'`;
`'GPRINT:mem_Matrix:LAST:"100\\n" \COMMENT:"           " \'`;
`'GPRINT:cpu_matrix:MIN:"0" \'`;
`'GPRINT:cpu_matrix:MAX:"100" \'`;
`'GPRINT:int_c:AVERAGE:"100"  \'`;
`'GPRINT:cpu_matrix:LAST:"100\\n" COMMENT:"\\s"\'`;
`'LINE1:mem_Matrix\#FF8000:'mem_Matrix'  \'`;
`'LINE1:cpu_matrix#8080F0:'cpu_matrix'  COMMENT:"Actualizado: $fecha \\c"'`;
