Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Interesting PHP fucntion to help in debugging cacti

 
Post new topic   Reply to topic    Cacti Forum Index -> Help: Unstable Development Versions
Author Message
Didier
Guest





PostPosted: Tue Aug 24, 2004 3:48 pm    Post subject: Interesting PHP fucntion to help in debugging cacti Reply with quote

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 */


--------------------------------------------------------------------------------

************ For an update of the rrd here th results **********************


C:\Documents and Settings\Didier>c:\php\php.exe c:\apache2\htdocs\cacti\poller.p
hp
Content-type: text/html
X-Powered-By: PHP/4.3.7

08/24/2004 10:29:09 PM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Proces
s
Waiting on 1/1 pollers.
08/24/2004 10:29:10 PM - POLLER: Poller[0] RRD: c:/rrdtool/rrdtool.exe update C:
\apache2\htdocs\cacti\rra\localhost_myds2_1001.rrd --template myds2 1093379350:1
36
array(3) {
[0]=>
array(4) {
["file"]=>
string(35) "c:\apache2\htdocs\cacti\lib\rrd.php"
["line"]=>
int(291)
["function"]=>
string(15) "rrdtool_execute"
["args"]=>
array(5) {
[0]=>
&string(91) "update C:\apache2\htdocs\cacti\rra\localhost_myds2_1001.rrd -
-template myds2 1093379350:136"
[1]=>
&bool(true)
[2]=>
&int(1)
[3]=>
&array(3) {
["fd"]=>
resource(37) of type (process)
["pipes"]=>
array(3) {
[0]=>
resource(34) of type (stream)
[1]=>
resource(35) of type (stream)
[2]=>
resource(36) of type (stream)
}
["using_proc_open"]=>
bool(true)
}
[4]=>
&string(6) "POLLER"
}
}
[1]=>
array(4) {
["file"]=>
string(3 "c:\apache2\htdocs\cacti\lib\poller.php"
["line"]=>
int(239)
["function"]=>
string(23) "rrdtool_function_update"
["args"]=>
array(2) {
[0]=>
&array(1) {
["C:\apache2\htdocs\cacti\rra\localhost_myds2_1001.rrd"]=>
array(3) {
["time"]=>
int(1093379350)
["local_data_id"]=>
string(4) "1001"
["items"]=>
array(1) {
["myds2"]=>
string(3) "136"
}
}
}
[1]=>
&array(3) {
["fd"]=>
resource(37) of type (process)
["pipes"]=>
array(3) {
[0]=>
resource(34) of type (stream)
[1]=>
resource(35) of type (stream)
[2]=>
resource(36) of type (stream)
}
["using_proc_open"]=>
bool(true)
}
}
}
[2]=>
array(4) {
["file"]=>
string(34) "c:\apache2\htdocs\cacti\poller.php"
["line"]=>
int(150)
["function"]=>
string(21) "process_poller_output"
["args"]=>
array(1) {
[0]=>
&array(3) {
["fd"]=>
resource(37) of type (process)
["pipes"]=>
array(3) {
[0]=>
resource(34) of type (stream)
[1]=>
resource(35) of type (stream)
[2]=>
resource(36) of type (stream)
}
["using_proc_open"]=>
bool(true)
}
}
}
}
08/24/2004 10:29:10 PM - SYSTEM STATS: Time: 1.0738 s, Method: cmd.php, Processe
s: 1, Threads: N/A, Hosts: 1, Hosts/Process: 1
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Help: Unstable Development Versions All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group