Cmd.php - Runtime Patch

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

Moderators: Developers, Moderators

Post Reply
maenu

Cmd.php - Runtime Patch

Post by maenu »

With MRTG I had big performance problems..
the runtime of the poller was longer than the polling interval.
to prevent this, I created the following patch to cmd.php which logs the runtime of cmd.php

have fun..

kind regards,
maenu

P.S: a warning function, if the runtime exceeds the polling interval would be nice..

Code: Select all

runtime-cmd.php.diff
*** cmd.php     2003-07-14 07:36:16.000000000 +0200
--- ../cacti/cmd.php    2003-07-17 08:49:58.000000000 +0200
***************
*** 25,29 ****
   +-------------------------------------------------------------------------+
  */
! $start = time();
  ini_set("max_execution_time", "0");
  
--- 25,36 ----
   +-------------------------------------------------------------------------+
  */
! 
! function getmicrotime(){ 
!     list($usec, $sec) = explode(" ",microtime()); 
!     return ((float)$usec + (float)$sec); 
! } 
! 
! 
! $start = getmicrotime();
  ini_set("max_execution_time", "0");
  
***************
*** 102,106 ****
  /* insert the current date/time for graphs */
  db_execute("replace into settings (name,value) values ('date',NOW())");
! print "time: " . (time()-$start) . "\n";
  //print_r($update_cache_array);
  
--- 109,115 ----
  /* insert the current date/time for graphs */
  db_execute("replace into settings (name,value) values ('date',NOW())");
! 
! // logs the runtime 
! log_data("Runtime (in s) : " . (getmicrotime()-$start),true);
  //print_r($update_cache_array);
  
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest