Posted: Tue Aug 24, 2004 3:48 pm Post subject: Interesting PHP fucntion to help in debugging cacti
Hi all
I have found an interesting PHP function to help in debugging cacti when things goes wrong. It is the debug_backtrace fucntion.
Below is an example of results and where I have put this command to get those results
a) After putting var_dump(debug_backtrace()); in rrd.php I have played
c:\php\php.exe c:\apache2\htdocs\cacti\poller.php
The results below show the folloing fucntion has been called
["function"]=> string(15) "rrdtool_execute"
in ["file"]=> c:\apache2\htdocs\cacti\lib\rrd.php"
line ["line"]=> int(291)
.......
b) In graph mangement when debug is turn on you also have some trace
c) The ideal would be to direct the result in a file, but I know yet how to do it very easily
--------------------------------------------------------------------------------
in rrd.php - rrdtool_execute function - I have put the fucntion has shown below
---------------------------------------------
/* if we want to see the error output from rrdtool; make sure to specify this */
if (($output_flag == RRDTOOL_OUTPUT_STDERR) && (empty($rrd_struc["using_proc_open"]))) {
$command_line .= " 2>&1";
}
var_dump(debug_backtrace()); /*********************************/
/* use popen to eliminate the zombie issue */