[rrd-users] Re: simple graphing
Mike Hunter
mhunter at ack.Berkeley.EDU
Tue Jan 13 20:29:18 MET 2004
On Jan 13, "Dave Stern - Former Rocket Scientist" wrote:
> I'm exceedingly new to RRDtool and am trying to find the simplest way to
> graph data from an existing file of the format
> MMM DD HH:MIN datapoint
> eg
> Jan 1 12:00 123
> Jan 1 12:15 80
> Jan 1 12:30 257
>
> I initialized the database using
>
> rrdtool create test.rrd --start N DS:in:GAUGE:900:U:U RRA:AVERAGE:0.5:1:432
>
> To insert the data, I would like to ideally do something like
> rrdtool update test.rrd `cat /tmp/data.2`
> but that cleayly wont work even if I massage the data to look like
> 1200:123
> 1215:80
> 1230:257
>
> For that matter,making a script that says
> rrdtool update test.rrd U:123
> rrdtool update test.rrd U:80
> rrdtool update test.rrd U:257
> wont do it
>
> Clearly the problem is my time format. Is there some way to tell rrdtool to
> just take the timestamp as is without calculating seconds from an epoch?
rrdtool is extremely fond of epoch seconds. Here's a fragment of perl
code that uses `date` to convert a filename such as this:
ft-v05.2004-01-13.110001-0800
to epoch seconds.
The -0800 is my GMT offset (have a look at date -u if you need to generate
that).
$time =~ s/^.*ft-v05\.(.*)/$1/;
my ($y, $m, $d, $mess, $g) = split /[-.]/, $time;
my $H = substr ($mess, 0, 2);
my $M = substr ($mess, 2, 2);
my $S = substr ($mess, 4, 2);
$g =~ s/^0//;
$g =~ s/0*$//;
my $epoch_time_cmd = "date -v-$g"."H -v$y"."y -v$m"."m -v$d"."d -v$H".
"H -v$M"."M -v$S"."S \"+%s\"";
#print "date -v-$g"."H -v$y"."y -v$m"."m -v$d"."d -v$H".
#"H -v$M"."M -v$S"."S \"+%s\"";
my $epoch_time = `$epoch_time_cmd`;
chomp $epoch_time;
Mike
--
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