[rrd-users] Updates from database
Pedro Goncalves
bira at tech.telepac.pt
Wed Jul 5 10:01:08 MEST 2000
Hi
Im trying to use rrdtool to generate graphics based
upon protocol usage from my network.
All my info is on a mySQL database with the followind
fields:
protocol|bytes|timestamp|nodename
i created the followins rrd database:
my
$rrd="/usr/local/rrdtool-1.0.24/databases/protocol.rrd"
;
RRDs::create ($rrd, "--start",959900218,"--step",600,
"DS:tcp_ftp:ABSOLUTE:400:U:U",
"DS:tcp_http:ABSOLUTE:400:U:U",
"DS:tcp_smtp:ABSOLUTE:400:U:U",
"DS:tcp_irc:ABSOLUTE:400:U:U",
"DS:tcp_nntp:ABSOLUTE:400:U:U",
"DS:tcp_dns:ABSOLUTE:400:U:U",
"RRA:AVERAGE:0:1:600",
"RRA:AVERAGE:0:6:600",
"RRA:AVERAGE:0:24:600",
"RRA:AVERAGE:0:288:732",
"RRA:MAX:0:24:600",
"RRA:MAX:0:288:732");
Then a script that gets the data from the mySQL and
tries to update the rrd db.(very raw perl
programming ... but im learning :-)
foreach $t (1..$sth->numrows) {
($protocol,$bytes,$timestamp,$nodename) =
$sth->fetchrow;
if ($protocol eq 'TCP-FTP')
{
$cmd = "$timestamp:$bytes";
}
elsif ($protocol eq 'TCP-DNS') {
$cmd = $cmd.":$bytes";
RRDs::update $rrd, $cmd;
if ($ERROR = RRDs::error) {
die "$0: unable to update
`$rrd': $ERROR\n";
}
print "$cmd\n";
}
else {
$cmd = $cmd.":$bytes";
}
}
this results on the following update lines:
...
959954784:23422430:26320742:6890498:207514897:30820053:
841658
959955384:20596194:28325794:1401099:209122419:30820133:
849775
959955984:10825104:28368110:15989327:209528248:30829558
:883849
...
But ...
rrdtool fetch ../databases/protocol.rrd AVERAGE --start
959900218 --end 959955984
results on
...
959955600: nan nan nan nan nan nan
959956200: nan nan nan nan nan nan
...
What im doing wrong here?????
Can you help me with this?
PS: Sorry for the this big message
Pedro Goncalves
-----------------------------------
This mail sent through Webmail Tech
--
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