[rrd-users] Newbie needs help!

David Edward Shapiro David.Edward.Shapiro at btitele.com
Fri Nov 16 20:27:27 MET 2001


Please help!  I searched on the web, scan through archives, and read the
manuals, but I still do not know how to get this working:

I am trying to use rrdtool for the first time, but I am having some
difficulty.  I wrote a simple script after collecting some data, but it just
gives me nan values for everthing when I do a fetch.  The idea was that I
have another program that mails a message on a system external to our
internal network and the internal mail server bounces it back.  I log the
send time and return time.  I converted the send times and return time into
utc time and for each start time I made a value that equaled the delta of
the send and return.  I realize it would be highly unusual if you looked at
this for me, but I was hoping you would because you are the father of rrd.  

I have a file called roundtrip.log that has the following:

sent: Thu Nov 15 14:36:15 2001  receive: Thu Nov 15 14:37:17 2001
sent: Thu Nov 15 14:39:16 2001  receive: Thu Nov 15 14:40:12 2001
sent: Thu Nov 15 14:42:14 2001  receive: Thu Nov 15 14:43:17 2001
sent: Thu Nov 15 14:45:15 2001  receive: Thu Nov 15 14:46:36 2001
sent: Thu Nov 15 14:48:15 2001  receive: Thu Nov 15 14:49:59 2001
sent: Thu Nov 15 14:51:14 2001  receive: Thu Nov 15 14:52:30 2001
sent: Thu Nov 15 14:54:15 2001  receive: Thu Nov 15 14:55:29 2001
sent: Thu Nov 15 14:57:14 2001  receive: Thu Nov 15 14:59:13 2001
sent: Thu Nov 15 15:00:15 2001  receive: Thu Nov 15 15:01:32 2001
sent: Thu Nov 15 15:03:14 2001  receive: Thu Nov 15 15:03:43 2001
sent: Thu Nov 15 15:06:14 2001  receive: Thu Nov 15 15:07:35 2001
sent: Thu Nov 15 15:09:15 2001  receive: Thu Nov 15 15:10:15 2001
sent: Thu Nov 15 15:12:14 2001  receive: Thu Nov 15 15:13:19 2001
sent: Thu Nov 15 15:15:14 2001  receive: Thu Nov 15 15:16:06 2001
sent: Thu Nov 15 15:18:15 2001  receive: Thu Nov 15 15:19:12 2001
sent: Thu Nov 15 15:21:14 2001  receive: Thu Nov 15 15:22:05 2001
sent: Thu Nov 15 15:24:15 2001  receive: Thu Nov 15 15:25:34 2001
sent: Thu Nov 15 15:27:15 2001  receive: Thu Nov 15 15:28:51 2001
sent: Thu Nov 15 15:30:14 2001  receive: Thu Nov 15 15:32:07 2001
sent: Thu Nov 15 15:33:15 2001  receive: Thu Nov 15 15:34:15 2001
sent: Thu Nov 15 15:36:15 2001  receive: Thu Nov 15 15:37:07 2001
sent: Thu Nov 15 15:39:15 2001  receive: Thu Nov 15 15:41:12 2001
sent: Thu Nov 15 15:42:15 2001  receive: Thu Nov 15 15:43:01 2001
sent: Thu Nov 15 15:45:15 2001  receive: Thu Nov 15 15:46:35 2001
sent: Thu Nov 15 15:48:14 2001  receive: Thu Nov 15 15:50:10 2001
sent: Thu Nov 15 15:51:14 2001  receive: Thu Nov 15 15:52:56 2001
sent: Thu Nov 15 15:57:16 2001  receive: Thu Nov 15 15:58:35 2001
sent: Thu Nov 15 16:00:16 2001  receive: Thu Nov 15 16:01:24 2001
sent: Thu Nov 15 16:03:16 2001  receive: Thu Nov 15 16:04:53 2001
sent: Thu Nov 15 16:06:16 2001  receive: Thu Nov 15 16:07:49 2001
sent: Thu Nov 15 16:09:16 2001  receive: Thu Nov 15 16:09:50 2001
sent: Thu Nov 15 16:12:16 2001  receive: Thu Nov 15 16:13:25 2001
sent: Thu Nov 15 16:15:16 2001  receive: Thu Nov 15 16:16:24 2001
sent: Thu Nov 15 16:18:16 2001  receive: Thu Nov 15 16:19:16 2001
sent: Thu Nov 15 16:21:16 2001  receive: Thu Nov 15 16:22:33 2001
sent: Thu Nov 15 16:24:16 2001  receive: Thu Nov 15 16:25:18 2001
sent: Thu Nov 15 16:27:16 2001  receive: Thu Nov 15 16:28:20 2001
sent: Thu Nov 15 16:30:16 2001  receive: Thu Nov 15 16:31:45 2001
sent: Thu Nov 15 16:33:16 2001  receive: Thu Nov 15 16:33:59 2001

I created the mailmon.rrd and graphic with this perl script:

#!/usr/bin/perl

use Time::Local;
#use strict;
my $rrd_created = 0;
my ($mday,$mon,$year) = (localtime(time))[3,4,5];
my $today = timelocal(0,0,12,$mday,$mon,$year);

open(TEST,">output");
###################################################################
# Get data needed to create and graph using rrd
###################################################################
open(DATA,"roundtrip.log");
###################################################################
# Process each line of the data file
###################################################################
foreach my $line (<DATA>) {
        chomp($line);
        my @line = split(/\s+/,$line);
        ###################################################################
        # Get sent data information converted to utc time
        ###################################################################
        my $sent_month =
(Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[($line)[2]];
        my $sent_mday = $line[3];
        my $sent_time = $line[4]; my ($sent_hr,$sent_min,$sent_sec) =
split(/:/,$sent_time);
        my $sent_year = $line[5];
        my $sent_utc_seconds =
timelocal($sent_sec,$sent_min,$sent_hr,$sent_mday,$sent_month,$sent_year);
        ###################################################################
        # Get receive data information converted to utc time
        ###################################################################
        my $receive_month =
(Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[($line)[8]];
        my $receive_mday = $line[9];
        my $receive_time = $line[10]; my
($receive_hr,$receive_min,$receive_sec) = split(/:/,$receive_time);
        my $receive_year = $line[11];
        my $receive_utc_seconds =
timelocal($receive_sec,$receive_min,$receive_hr,$receive_mday,$receive_month
,$receive_year);
        ###################################################################
        # Get the delta of the sent/receive time
        ###################################################################
        my $delta = int ($receive_utc_seconds - $sent_utc_seconds); chomp
$delta;
        ###################################################################
        #  Create the rrd shell
        ###################################################################
        if (not $rrd_created) {
        print "Creating mailmon.rrd...\n";
                if (-e "/home/davidsh/rrd/mailmon.rrd") {
                        print "Removing previous rrd...\n";
                        system("rm /home/davidsh/rrd/mailmon.rrd");
                }
                print "Using start date: $sent_utc_seconds\n";
                my $start = $sent_utc_seconds - 1;
		    # Not working....getting nan for everything when I run
fetch on this
                #
heart min max
                #
beat
                #system "rrdtool create mailmon.rrd --start $start
DS:delivery:COUNTER:999:U:U RRA:AVERAGE:0.5:1:1200";
                system "rrdtool create mailmon.rrd --step 1 --start $start
DS:delivery:GAUGE:999:U:U RRA:AVERAGE:0.5:1:1200";

                $rrd_created = $sent_utc_seconds;
        }
        print TEST "rrdtool update mailmon.rrd $sent_utc_seconds:$delta\n";
        #print "Updating rrd with $sent_utc_seconds:$delta\n";
        #system("rrdtool update mailmon.rrd $sent_utc_seconds:$delta");
}
print "Making graph...\n";
print "Using today's date as end time: $today\n";
system("rrdtool graph mailmon.gif --start $rrd_created --end $today
DEF:mydelivery=mailmon.rrd:delivery:AVERAGE LINE2:mydelivery#FF0000 ");


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