importing daily data summaries into cacti

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
kalil
Posts: 9
Joined: Wed Apr 21, 2010 12:14 pm

importing daily data summaries into cacti

Post by kalil »

I have 2 problems. . .

1. I have production data collected every 10 minutes but I will only have access to the data 1x per day, when I can pull the files. Is there a way I can pull that into cacti on a daily interval and respect the 10 minute interval? (most important)

2. I have a year's worth of data similar to described above. How can I import this data into cacti in order to graph it? (less important, and the answer to #1 might well cover this)

Any tips and guides are greatly appreciated.
Thank you!
kalil
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: importing daily data summaries into cacti

Post by noname »

If I were you..

[On server]
1) Create a RRD file with 10min-step settings
2) Update once per day with daily data which have 144 values of each 10min by using cron

[On Cacti]
Import the above RRD file to make graph
- Externally Updated RRDs - Cacti Docs

Here is a sample code.
To create RRD file:
rrdtool create /var/www/cacti/rra/test_10min.rrd \
--start=now-2d \
--step 600 \
DS:testvalue:GAUGE:1200:0:100 \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:3:700 \
RRA:AVERAGE:0.5:12:775 \
RRA:AVERAGE:0.5:144:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:3:700 \
RRA:MAX:0.5:12:775 \
RRA:MAX:0.5:144:797 \
RRA:LAST:0.5:1:600 \
RRA:LAST:0.5:3:700 \
RRA:LAST:0.5:12:775 \
RRA:LAST:0.5:144:797 \
red is specific settings for 10min. See Cacti's default (=5min).
green(--start) is dependent on your purpose. In this case, I'm using "now-2d" because I want to update data of yesterday in next step.

Assumed daily data:

Code: Select all

9/7/2011,0:00,66
9/7/2011,0:10,58
9/7/2011,0:20,44
9/7/2011,0:30,85
9/7/2011,0:40,7
9/7/2011,0:50,0
9/7/2011,1:00,14
9/7/2011,1:10,76
...
9/7/2011,23:30,18
9/7/2011,23:40,87
9/7/2011,23:50,77
It's like CSV.
month/day/year,hour:minute,value

To update RRD file:

Code: Select all

#!/usr/local/bin/perl

use RRDs;

$rrdfile = "/var/www/cacti/rra/test_10min.rrd";

while (<STDIN>) {
        chomp;
        ($date, $time, $value) = split(/,/);
        @params = (@params, "$date $time\@$value");
}

RRDs::update($rrdfile, @params);

$err = RRDs::error;
die $err if $err;
% cat test_data.csv | perl test_update_10min.pl

If you didn't install RRDs perl module, use rrdtool binary instead.

Results:
% rrdtool dump test_10min.rrd | less
...
<!-- 2011-09-06 23:40:00 JST / 1315320000 --> <row><v> NaN </v></row>
<!-- 2011-09-06 23:50:00 JST / 1315320600 --> <row><v> NaN </v></row>
<!-- 2011-09-07 00:00:00 JST / 1315321200 --> <row><v> NaN </v></row>
<!-- 2011-09-07 00:10:00 JST / 1315321800 --> <row><v> 5.8000000000e+01 </v></row>
<!-- 2011-09-07 00:20:00 JST / 1315322400 --> <row><v> 4.4000000000e+01 </v></row>
<!-- 2011-09-07 00:30:00 JST / 1315323000 --> <row><v> 8.5000000000e+01 </v></row>
<!-- 2011-09-07 00:40:00 JST / 1315323600 --> <row><v> 7.0000000000e+00 </v></row>
<!-- 2011-09-07 00:50:00 JST / 1315324200 --> <row><v> 0.0000000000e+00 </v></row>
<!-- 2011-09-07 01:00:00 JST / 1315324800 --> <row><v> 1.4000000000e+01 </v></row>
<!-- 2011-09-07 01:10:00 JST / 1315325400 --> <row><v> 7.6000000000e+01 </v></row>
...
<!-- 2011-09-07 23:30:00 JST / 1315405800 --> <row><v> 1.8000000000e+01 </v></row>
<!-- 2011-09-07 23:40:00 JST / 1315406400 --> <row><v> 8.7000000000e+01 </v></row>
<!-- 2011-09-07 23:50:00 JST / 1315407000 --> <row><v> 7.7000000000e+01 </v></row>
That's just a example.
Please refer several documents for detail.
- RRDtool Documentation

Good luck :)
kalil
Posts: 9
Joined: Wed Apr 21, 2010 12:14 pm

Re: importing daily data summaries into cacti

Post by kalil »

Thank you! I'll give it a shot.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests