pls Help urgent:- the multi record script output to poller

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
manav.sah@gmail.com
Posts: 3
Joined: Wed Jan 18, 2006 11:50 pm
Location: New Delhi
Contact:

pls Help urgent:- the multi record script output to poller

Post by manav.sah@gmail.com »

hi!...
i am trying to feed data to poller for graph from csv file that contains hundreds of record as follow......
.................................................................................................................................................
Date,Time,Tide Level,Barometer mB,Channel 2,Channel 3,Channel 4,Channel 5,Channel 6,Channel 7,
2006-01-12,0:00:00,0.668,1016.287,0.0,0.0,0.0,0.0,0.0,0.0,
2006-01-12,0:06:00,0.669,1016.288,0.0,0.0,0.0,0.0,0.0,0.0,
2006-01-12,0:12:00,0.630,1016.652,0.0,0.0,0.0,0.0,0.0,0.0,
2006-01-12,0:18:00,0.632,1016.653,0.0,0.0,0.0,0.0,0.0,0.0,
2006-01-12,0:24:00,0.623,1016.654,0.0,0.0,0.0,0.0,0.0,0.0,
2006-01-12,0:30:00,0.611,1016.655,0.0,0.0,0.0,0.0,0.0,0.0,
2006-01-12,0:36:00,0.592,1016.657,0.0,0.0,0.0,0.0,0.0,0.0,
2006-01-12,0:42:00,0.589,1016.881,0.0,0.0,0.0,0.0,0.0,0.0,
.................................................................................................................................................
<?php
$fcontents = file ('./07012006.csv');
# expects the csv file to be in the same dir as this script
for($i=1; $i<sizeof($fcontents); $i++)
{
$line = trim($fcontents[$i]);
$arr = explode(",", $line);
printf("Tide_Level:%f Barometer_md:%3.4f Channel2:%f Channel3:%f Channel4:%f Channel5:%f Channel6:%f Channel7:%f\n", $arr[2], $arr[3], $arr[4], $arr[5], $arr[6], $arr[7], $arr[8], $arr[9]);
}
?>

but not being able to do that...
in case of one record the script is running fine ...
pls guide me how to feed the multiple record.... in a single poller exceution..... :(
Best Regards
Manav Sah
Vandae Mataram.....!!!!!
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Not answering directly, but why do you want to do that? WIth standard parameters, rrdtool will average out all your input! So it doesn't matter, if you feed 1 record every 300 sec or 10 records every 30 secs or 100 records every 3 secs.
Of course, you may reduce the standard polling interval from 300sec to something lower, but cacti does not support this at the time of writing (that does not mean, it won't work... but at your own risk). There have been many postings on this subject, please search if that's what you're aiming at. This would remove the need of filling more than one record to rrd on each poller's run.
Reinhard
manav.sah@gmail.com
Posts: 3
Joined: Wed Jan 18, 2006 11:50 pm
Location: New Delhi
Contact:

Re: pls Help urgent:- the multi record script output to pol

Post by manav.sah@gmail.com »

hi!...
thanks for consideration...
actually application am not getting data on fly...
it will receive the data in csv that may contain the data of past 2- 3 hrs....
with frequence of one record per miniute...
all the data will wbe transfered to the csv file and then send to the cacti... later...
thats why i wanna to add multiple records with my own time stamop to the rrd database... is it possible ... with cacti...
Best Regards
Manav Sah
Vandae Mataram.....!!!!!
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

I'd simply fetch all the data, line by line, by a perl wrapper that feeds them directly to the rrd file via rrdtool update rrdtool will do the rest for you. And you may run the wrapper at any time if you obey to keep the time sequence right
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest