[rrd-users] RRDs::create dumps core SunOS 4.1.4 PERL 5.005_03

Owen DeLong owen at dixon.DeLong.SJ.CA.US
Mon Oct 11 22:46:22 MEST 1999


I built and installed RRD 1.0.7 and most of it is working fine.
I can call rrdtool create with no problem.  RRDs::update only
seems to store unknown.  The examples dump core on calls to
RRDs::create as well.

Can anyone see or think of anything obvious that I am missing?

I'm stumped.

Owen

Here is the code I'm having trouble with.  I was using a DBM database
to store temperatures and running an expire.  The "logger" program
referred to below is simply the program which acquires the temperature
samples from the probes and puts the data into the database.  This
program is intended to overwrite the RRD database (if any) that the
RRD logger would be storing the data into (the cp command at the end).
The RRD logger updates both the RRD and DBM databases.  By doing
this, the program below will create an RRD database which contains
up to the minute information, then set it in place so that samples
going forward are added to it as well as the DBM.  Then, the DBM
capability will be removed from logger and conversion will be complete.

The code below expands any existing averages to look like they occured
at 1 minute intervals so that RRD doesn't think there are insufficient
samples for it's longer-term averages to be valid.  It's crufty, but
it works, and I only need this to work once. :-)

My bigger concern is that the RRDs stuff appears not to work.  As such,
I need to get that going.


#!/bin/perl
# Create RRD Database from DBM database
#
# Run this from a directory other than the one you want the RRD's in.
# The RRD version of logger should be running before you start this.

use POSIX;
use Getopt::Std;
use NDBM_File;
use RRDs;

$|=1;

$LOGDIR="/var/log/therm";
if (int(@ARGV))
{
        push @PROBES,shift(@ARGV) while (@ARGV);
}
else
{
        @PROBES=("comp", "attic", "outside", "garage");
}

foreach(@PROBES)
{
        $probe=$_;
        print "\n$probe...";
        system("rm -f ". $probe .".rrd");
        print "removed...";
        tie (%LOG, 'NDBM_File', $LOGDIR."/".$probe,
                O_RONLY,0) ||
                die "Couldn't access database for $probe.";
        print "Connected...";

# This dumps core
       RRDs::create (
               "$probe.rrd",
               "--start", $LOG{"oldest"}-60,
               "--step", 60,
               "DS:temp:GAUGE:60:U:U",
               "RRA:AVERAGE:.5:5:288",
               "RRA:AVERAGE:.5:60:4320",
               "RRA:AVERAGE:.5:1440:365",
               "RRA:MIN:.5:5:288",
               "RRA:MIN:.5:60:4320",
               "RRA:MIN:.5:1440:365",
               "RRA:MAX:.5:5:288",
               "RRA:MAX:.5:60:4320",
               "RRA:MAX:.5:1440:365"
       );

# This works.
#        $first=$LOG{"oldest"}-60;
#        system("/usr/local/rrdtool/bin/rrdtool create " . 
#                "$probe.rrd -s 60 -b $first ". 
#                "DS:temp:GAUGE:60:U:U RRA:AVERAGE:.5:5:288 " . 
#                "RRA:AVERAGE:.5:60:4320 RRA:AVERAGE:.5:1440:365 " . 
#                "RRA:MIN:.5:5:288 RRA:MIN:.5:60:4320 " . 
#                "RRA:MIN:.5:1440:365 RRA:MAX:.5:5:288 " . 
#                "RRA:MAX:.5:60:4320 RRA:MAX:.5:1440:365");

        print "Created...\n";
# This works.
#        open OUT, "|xargs /usr/local/rrdtool/bin/rrdtool update $probe.rrd" || die "Couldn't update.";
        for ($t=$LOG{"oldest"}; $t <= $LOG{"newest"}; $t+=60)
        {
                if (defined($LOG{$t}) && $LOG{$t} > 15)
                {
                        print "\r",scalar(localtime($t)), " -> ", scalar(localtime($LOG{"newest"}));
                        $temp=$LOG{$t};
                }
                else
                {
                        print "$LOG{$t}-";
                }
# This works
#               print OUT "$t:$temp\n";
# This stores unknown
                RRDs::update("$probe.rrd", $t.":".$temp);
        }
#        close OUT;
#       system("cp $probe.rrd /var/log/therm");
}
print "\n";

--
* To unsubscribe from the rrd-users mailing list, send a message with the
  subject: unsubscribe to rrd-users-request at list.ee.ethz.ch



More information about the rrd-users mailing list