[rrd-users] No graphic line's show up
Sjaak Nabuurs
sjaak at vsm-hosting.nl
Fri Apr 25 16:18:23 MEST 2003
Hi all
I'm just new and read the man pages but English isn't my main language so
maybe I'm missing something
I modify the example file run this script in a 5 min cron
and the strange thing is that the for next loop work nicely.
if I put data into the http_mrtg.rrd it works great.
When i look into the database with rrdtool dump i see a lot of figures and
this looks real good
But no way i can get a nice graph.
I'm getting @##@^^#@^@!
What could be wrong ?
I guess somthing wrong with timing
#! /usr/bin/perl
#makes things work when run without install
use lib qw( ../perl-shared/blib/lib ../perl-shared/blib/arch );
# this is for after install
use lib qw( /usr/local/rrdtool/lib/perl ../lib/perl );
use RRDs;
use strict;
my $start=time;
my $rrd="/usr/local/rrdtool/examples/http_mrtg.rrd";
my $name = $0;
$name =~ s/\.pl.*//g;
my $file = "/usr/local/rrdtool/examples/http_mrg.data";
my @tmp="";
my $teller = 0 ;
my $ERROR = "";
my $gelezen = "";
my @waardes="";
my $pngfile = "/var/www/html/http.png";
my $t;
my $makedb ="no";
if ($makedb eq "yes") {
RRDs::create ($rrd, "--start",$start-1, "--step",300,
"DS:a:GAUGE:600:U:U",
"DS:b:GAUGE:600:U:U",
"DS:c:GAUGE:600:U:U",
"DS:d:GAUGE:600:U:U",
"DS:e:GAUGE:600:U:U",
"DS:f:GAUGE:600:U:U",
"RRA:AVERAGE:0.5:1:300",
"RRA:AVERAGE:0.5:12:300",
"RRA:AVERAGE:0.5:12:300",
"RRA:AVERAGE:0.5:12:300",
"RRA:AVERAGE:0.5:12:300",
"RRA:AVERAGE:0.5:12:300",
);
my $ERROR = RRDs::error;
die "$0: unable to create `$rrd': $ERROR\n" if $ERROR;
};
# grep the http data from iptables and do other stuff
system("/usr/local/rrdtool/examples/grep_http_mrtg.sh");
# read the data file (just grepped) and drop data into the rrd
open(LIST,"$file");
@waardes=<LIST>;
close(LIST);
foreach $gelezen(@waardes)
{
# chomp($gelezen);
$tmp[$teller] = $gelezen;
$teller++;
}
RRDs::update $rrd, "$start:".($tmp[0]). ":".($tmp[1]).
":".($tmp[2]). ":".($tmp[3]).":".($tmp[4]). ":".($tmp[5]);
if ($ERROR = RRDs::error) {
die "$0: unable to update `$rrd': $ERROR\n";
}
# the database dump with rrdtool dump look's okay
# generate example in a FORNEXT LOOP This works fine showed a nice graph
# for ($t=$start; $t<$start+300*300; $t+=300){
# RRDs::update $rrd, "$t:".(sin($t/3000)*50+70). " $t:".(sin($t/100)*50+30).
" $t:".(sin($t/3000)*30+300).
" $t:".(sin($t/3000)*50+10). " $t:".(sin($t/200)*50+10). "
$t:".(sin($t/5000)*50+30)
;
# if ($ERROR = RRDs::error) {
# die "$0: unable to update `$rrd': $ERROR\n";
# }
# }
RRDs::graph "$pngfile",
"--title", "HTTP data transfer, loadbalancing router VSM.",
"--vertical-label", "Waardes in Mbits",
"--start", "now",
"--end", "start+1d",
"--lower-limit=0",
"--interlace",
"--imgformat","PNG",
"--height=400",
"--width=800",
"DEF:a=$rrd:a:AVERAGE",
"DEF:b=$rrd:b:AVERAGE",
"DEF:c=$rrd:c:AVERAGE",
"DEF:d=$rrd:d:AVERAGE",
"DEF:e=$rrd:e:AVERAGE",
"DEF:f=$rrd:f:AVERAGE",
"LINE2:a#ff00ff:eth0",
"LINE2:b#0022e9:eth1",
"LINE2:c#ff2200:eth2",
"LINE2:d#00ccff:eth3",
"LINE2:e#00ff00:eth4",
"LINE2:f#cc22e9:eth5",
;
if ($ERROR = RRDs::error) {
print "ERROR: $ERROR\n";
};
--
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