[Orca-dev] Code portion for procallator to monitor apache1&2

Neculai Macarie mack at nexc.ro
Mon Sep 22 11:19:24 PDT 2003


Hi!

This is a quick hack to make procallator work with apache (I know it should
have been a patch, but I'm just learning my way with patches):

somewhere at the top of the file:
$SERVER_STATUS_URL="http://192.168.1.1/server-status?auto";
$APACHE2=0;


in the main look:
   #
   # Web server status
   #
   $content = get( $SERVER_STATUS_URL ) or die("Could not retrieve status
URL!");

   if( $APACHE2 == 0 ){
       ($busy_servers) = ($content =~ /BusyServers: (\d*)/gi);
       ($idle_servers) = ($content =~ /IdleServers: (\d*)/gi);
       ($req_per_sec)   = ($content =~ /ReqPerSec: ([\.\d]*)/gi);
       ($bytes_per_sec) = ($content =~ /BytesPerSec: ([\.\d]*)/gi);
       ($bytes_per_req) = ($content =~ /BytesPerReq: ([\.\d]*)/gi);
   }
   else {
       ($busy_servers)  = ($content =~ /BusyWorkers: (\d*)/gi);
       ($idle_servers)  = ($content =~ /IdleWorkers: (\d*)/gi);
       ($req_per_sec)   = ($content =~ /ReqPerSec: ([\.\d]*)/gi);
       ($bytes_per_sec) = ($content =~ /BytesPerSec: ([\.\d]*)/gi);
       ($bytes_per_req) = ($content =~ /BytesPerReq: ([\.\d]*)/gi);
   }
   put_output( "http_srv_busy", $busy_servers,
               "http_srv_idle", $idle_servers,
               "http_req/s",    $req_per_sec,
               "http_bytes/s",  $bytes_per_sec,
               "http_bytes/req",$bytes_per_req
   );

These are the entries from the config file:
plot {
title                   %g Web Server Busy and Idle servers
source                  orcallator
data                    http_srv_busy
data                    http_srv_idle
plot_min                0
line_type               area
line_type               stack
legend                  HTTP busy
legend                  HTTP idle
color                   0000ff
color                   00ff00
y_legend                Nr
}


plot {
title                   %g Web Server Bytes per sec and per request
source                  orcallator
data                    http_bytes/s
data                    http_bytes/req
line_type               line2
line_type               line2
plot_min                0
legend                  Bytes/s
legend                  Bytes/req
y_legend                Nr
}

PS: I will try and make a patch agains procallator.in, but it might take
some time.

Any suggestions welcomed (even desired).

HTH,
<mack />






More information about the Orca-dev mailing list