[rrd-users] Re: Collecting data at different intervals

Chris Fedde chris at fedde.littleton.co.us
Tue Feb 29 17:56:20 MET 2000


Karsten Thygesen writes:
 +---------------
 | 
 | Hi
 | 
 | I would like to use RRD to generate some statistics from various
 | programs, but I would like to combine RRD tool with Dan bernsteins
 | daemontools's multilog package, which can give me a trigger once it
 | rotates the logfiles. The logfiles is rotated based on size, not time,
 | so it is impossible for me to predict the interval at wich I will get
 | data.
 | 
 | How can I feed this kind og information into rrd tool?
 | 
 | Best regards,
 | Karsten
 +---------------

I'm going to assume that your logfiles contain some kind of time stamp.  This
time stamp can be used in the update but you will probably need to convert
it to epoch seconds.  Here is an example that uses a bit of perl to convert
syslog dates formats into as required by rrdtool update.

    #!/usr/bin/perl

    use Time::ParseDate;
    while (<>)
    {
	next unless /thttpd/;
	next unless (($bytes) = /(\d+) bytes/);
	$date = parsedate(substr($_, 0, 15));
	print "update thttpd.rrd $date:$bytes\n";
    }

This thing prints something that can be piped into "rrdtool -".

The Time::ParseDate is available from CPAN. It's an amazing little
module that understands a broad range of date formats. It's also
a bit faster than the methods in Date::Manip.  One drawback is that
it is limited to dates inside the UNIX epoch.

chris

__
Chris Fedde	  <chris at fedde.littleton.co.us>
303 773 9134

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



More information about the rrd-users mailing list