Problem with popen and rrdtool

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
Roke
Posts: 20
Joined: Thu Jun 24, 2010 1:14 pm

Problem with popen and rrdtool

Post by Roke »

Hi,

Im new on php but im having some problems with the popen function, i have this code:

if($fp = popen("/usr/bin/rrdtool fetch $_name AVERAGE",'r')){

trim(fgets($fp, 4096));
print $line;
while(!feof($fp)){
print $line;
$line = trim(fgets($fp, 4096));
}
}else print "ERROR";


I get not result and no error, i get a blank html but if i put

if($fp = popen("/usr/bin/rrdtool fetch /var/www/cacti/rra/1/32.rrd AVERAGE",'r')){

And i write the value of $_name i get results on the web. Why if i pass the value in a variable i get no result.

There is no error in the values, i think is format conversion. Maybe $_name is not totally a string and can give problem?

Best Regards.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

This is which version of cacti, please?
R.
Roke
Posts: 20
Joined: Thu Jun 24, 2010 1:14 pm

Post by Roke »

Version 0.8.7g

I want to get the total bandwith in a period of time.
Roke
Posts: 20
Joined: Thu Jun 24, 2010 1:14 pm

Post by Roke »

Now im using the function of cacti called bandwidth_summation

bandwidth_summation($local_data_id, $start_time, $end_time, $rra_steps, $ds_steps)

When i called for a period of 1 day with rra_steps =1 ds_steps=300 works great but when i put a bigger period, for example 7 days the results are wrong.

THe result of the function isnt the same of the graphic :(
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest