Hi,
I have data in a csv file.
The info is like this:
12-8-2013 14:00 0
12-8-2013 14:15 0
12-8-2013 14:30 0.744
12-8-2013 14:45 1.528
12-8-2013 15:00 1.612
12-8-2013 15:15 1.496
12-8-2013 15:30 1.332
It has a data and a time stamp.
On date time is the value to use.
Is there a way to import this data into cacti?
And to do this by hand and not automatic. I get the data one a week.
Kind regards,
Martijn
Importing data from CSV file to make graph
Moderators: Developers, Moderators
- phalek
- Developer
- Posts: 2838
- Joined: Thu Jan 31, 2008 6:39 am
- Location: Kressbronn, Germany
- Contact:
Re: Importing data from CSV file to make graph
- Yes it can be added.
- Yes it can be done manually
- Yes it can also be done automatically once a week
Basically you're using an external script, which parses your file and converts it to "rrdtool update" commands which stores the data into a pre-created rrd file ( that can be defined in Cacti ):
The script would look like this ( in Perl ):
- Yes it can be done manually
- Yes it can also be done automatically once a week
Basically you're using an external script, which parses your file and converts it to "rrdtool update" commands which stores the data into a pre-created rrd file ( that can be defined in Cacti ):
The script would look like this ( in Perl ):
Code: Select all
my $file = $ARGV[0];
my $rrdfile = '/var/www/html/cacti/rra/host_csv_data.rrd';
open(INPUT,'<',$file) or die 'cannot open file ['.$file.'] !'."\n";
while (my $line = <INPUT>) {
chomp($line);
if ($line =~ m/^(\d+)-(\d+)-(\d+)\s(\d+):(\d+)\s(.*)/ig) {
my $day = $1;
my $month = $2;
my $year = $3;
my $hour = $4;
my $minutes = $5;
my $seconds = 0;
my $data = $6;
my $startTime = timelocal($seconds,$minutes,$hour,$day,$month-1,$year-1900);
`rrdtool update $rrdFile $startTime:$data`;
#print "rrdtool update $rrdFile $startTime:$data\n";
}
}
close(INPUT);
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
Re: Importing data from CSV file to make graph
tnxs,
I will try this out
I will try this out
Who is online
Users browsing this forum: No registered users and 1 guest