[rrd-users] Problems with fetch, or create?

Ryan Steele steele at agora-net.com
Tue Mar 27 23:43:24 CEST 2007


Hello list.  Let me preface this post by saying that I'm relatively new 
to using RRDTool and it's utilities, so bear with me :)

I've tried following several support guides, the FAQ, and plenty of head 
scratching, but I'm still having trouble getting a basic setup running.  
All my databases seem to be created with the same 3 dates since epoch, 
no matter what starting time I specify.  Additionally, every entry is 
'nan'.  I can confirm that the Perl script generating the data is 
outputting correct data (both syntactically and otherwise).  Perhaps it 
would be easier if I gave you some qualifying information:

Here's a quick bash script I'm using to create the .rrd databases:

#!/bin/bash

cd /var/lib/cricket/nfs-machines/

rrdtool create node-1.rrd --start `date +%s` --step=300 
DS:getattr:COUNTER:600:0:U DS:access:COUNTER:600:0:U 
DS:read:COUNTER:600:0:U DS:write:COUNTER:600:0:U RRA:LAST:0.5:1:2016 
RRA:AVERAGE:0.5:288:31 RRA:AVERAGE:0.5:104832:52

rrdtool create node-2.rrd --start `date +%s` --step=300 
DS:getattr:COUNTER:600:0:U DS:access:COUNTER:600:0:U 
DS:read:COUNTER:600:0:U DS:write:COUNTER:600:0:U RRA:LAST:0.5:1:2016 
RRA:AVERAGE:0.5:288:31 RRA:AVERAGE:0.5:104832:52

rrdtool create node-3.rrd --start `date +%s` --step=300 
DS:getattr:COUNTER:600:0:U DS:access:COUNTER:600:0:U 
DS:read:COUNTER:600:0:U DS:write:COUNTER:600:0:U RRA:LAST:0.5:1:2016 
RRA:AVERAGE:0.5:288:31 RRA:AVERAGE:0.5:104832:52

rrdtool create node-4.rrd --start `date +%s` --step=300 
DS:getattr:COUNTER:600:0:U DS:access:COUNTER:600:0:U 
DS:read:COUNTER:600:0:U DS:write:COUNTER:600:0:U RRA:LAST:0.5:1:2016 
RRA:AVERAGE:0.5:288:31 RRA:AVERAGE:0.5:104832:52

# EOF

This leaves me with 5 .rrd databases.  I then run the following Perl 
script to generate the data and feed it into the database:

#! /usr/bin/perl -w
#
# nfs.pl v1.0

use strict;
use Scalar::Util qw/ looks_like_number /;

my $datadir = '/var/lib/cricket/nfs-machines';
my ($rc, $server, $type, $cmd, $getattr, $access, $read, $write, $PDP) = '';
my (@output, @data1, @data2) = ();
my @servers = ('node-1', 'node-2', 'node-3', 'node-4');

foreach $server (@servers) {
    $cmd = "nfsstat | sed -ne '/Client nfs v3/,/^\$/p'";
    ($rc, @output) = `ssh $server "$cmd"`;
    @data1 = split(' ', $output[1]);
    @data2 = split(' ', $output[3]);

    $getattr = (looks_like_number($data1[2])) ? $data1[2] : "U";
    $access = (looks_like_number($data1[8])) ? $data1[8] : "U";
    $read = (looks_like_number($data2[0])) ? $data2[0] : "U";
    $write = (looks_like_number($data2[2])) ? $data2[2] : "U";
    $PDP = "$getattr:$access:$read:$write";
    #print "\$PDP: $PDP\n";
    system("rrdtool update $datadir/$server.rrd N:$PDP");
}

# EOF

Just for the purposes of being thorough, here's what I get if I 
uncomment the print line and comment out the system line:

server~$ /usr/share/cricket/util/nfs.pl
$PDP: 2147483647:1717558688:784600643:288183563
$PDP: 2147483647:1654431516:587786584:281792281
$PDP: 821960577:668870909:179765465:58156155
$PDP: 30156045:20561135:579457:1713888


However, when I try to insert data into the databases after creating 
them, I get the following output, including the exact same numbers 
(1174867200, 1174953600, 1175040000) no matter what I try:

server~$ rrdtool fetch node-1.rrd AVERAGE
timestamp    getattr           access            read              write

1174867200:  nan  nan  nan  nan
1174953600:  nan  nan  nan  nan
1175040000:  nan  nan  nan  nan


I'm eventually going to be using this with Cricket, but I can't put the 
cart before the horse... I need to figure out why I can't get this 
simple test to work.  Thanks alot in advance, and let me know if I've 
left anything out that you'd need to see.  As a last note, I'm using 
version 1.0.49.

Best Regards,
Ryan

-- 
Ryan Steele                         
Systems Administrator



More information about the rrd-users mailing list