[rrd-users] Graphing...

Cesare Tensi tensi at mclink.it
Tue Jun 17 11:09:07 MEST 2003


Hy folks,

maybe there is a FAQ (or explained on documentation) but I'm still crazing because the script that I wrote doesn't graph any data, the Perl script doesn't write nothing or  seems to not fetch data from DB. I searched also on Google, founded some script around Web but I'm still not found the solution...

The script is launched from a directory, DB is located on a dir and images on another. The script is following:

Thanks for any comments.

Cesare

--------- CUT
#!/usr/bin/perl -w

use Time::localtime;
use Time::Local;
use Date::Manip;
use RRDs;

my $tm        = localtime;
my $today     = sprintf ("%02d-%02d-%02d %02d:%02d:%02d",
      $tm->mday, $tm->mon+1, $tm->year+1900, $tm->hour, $tm->min, $tm->sec);
my $yesterday = &DateCalc("today","-1 day",\$err);
$yesterday    = &UnixDate($yesterday,"%d-%m-%Y");
my $today_zip = sprintf ("%02d%02d%02d", $tm->hour, $tm->min, $tm->sec);
my $today_log = sprintf ("%02d-%02d-%02d_%02d:%02d:%02d",
      $tm->mday, $tm->mon+1, $tm->year+1900, $tm->hour, $tm->min, $tm->sec);

my $rrdtool="/opt/GNU/rrdtool/bin/rrdtool";
my $DIR_INPUT="/opt/GNU/Stats/incoming/rmims1";
my $rrd_dir="/opt/GNU/Stats/DB";
my $rrdfile="rmims1_x25.rrd";
my $image_store = "/opt/GNU/Stats/images";

my (@data);

$_ = "$yesterday";
m#^(\d{2})-(\d{2})-(\d{4})$#;
$yesterday_begin = timelocal(0, 0, 0, $1, $2, $3-1900);
$yesterday_end   = timelocal(59, 59, 23, $1, $2, $3-1900);

push @data , "--imgformat=PNG";
push @data , "--lower-limit=0";
push @data , "--width=640";
push @data , "--height=480";
push @data , "--base=1000";

RRDs::graph ("$image_store/rmims1.X25.rx.DAILY.png",
      "--start=$yesterday_begin", "--end=$yesterday_end",
      @data,
      "DEF:a=$rrd_dir/$rrdfile:bytes_rx:AVERAGE",
      "AREA:a#00ff00:Incoming");
--------- CUT

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