Skip to content
This repository has been archived by the owner on May 28, 2018. It is now read-only.

Commit

Permalink
Quick hack-patch to get bytes_per_second and bytes_per_request to wor…
Browse files Browse the repository at this point in the history
…k for now.
  • Loading branch information
patyx7 committed Nov 7, 2013
1 parent 41ef5c8 commit 9aa5116
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions check_apache_status.pl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
'bytes_per_request' => 'LiB',
'accesses' => 'LiB',
'bytes_per_second' => 'LiB',
'idle_workers' => 'HiB',
'idle_workers' => 'HiB',

#'uptime' => 'LiB',
'current_requests' => 'LiB'
);
Expand All @@ -23,7 +24,7 @@
'bytes_per_request' => '1024',
'accesses' => '100000',
'bytes_per_second' => '1000',
'idle_workers' => '50',
'idle_workers' => '50',
'current_requests' => '150'
);
%warning = (
Expand All @@ -32,7 +33,7 @@
'bytes_per_request' => '768',
'accesses' => '50000',
'bytes_per_second' => '800',
'idle_workers' => '150',
'idle_workers' => '150',
'current_requests' => '70'
);
my @pretext
Expand Down Expand Up @@ -209,24 +210,42 @@ ($)
when ('/^G/') { $results{'traffic'} = $2 / 1024; }
when ('/^M/') { $results{'traffic'} = $2; }
when ('/^K/') { $results{'traffic'} = $2 * 1024; }
when ('/^B/') { $results{'traffic'} = $2 * (1024*2); }
when ('/^B/') { $results{'traffic'} = $2 * ( 1024 * 2 ); }
default { $results{'traffic'} = $2; }
}
}
elsif ( $line
=~ /([\d\.]+) requests\/sec - ([\d\.]+) B\/second - ([\d\.]+) B\/request/
=~ /([\d\.]+) requests\/sec - ([\d\.]+) ([MKGB]+)\/second - ([\d\.]+) ([MKGB]+)\/request/
)
{
$results{'requests_per_second'} = $1;
$results{'bytes_per_second'} = $2;
$results{'bytes_per_request'} = $3;
given ($3) {
when ('/^G/') { $results{'bytes_per_second'} = $2 / 1024; }
when ('/^M/') { $results{'bytes_per_second'} = $2; }
when ('/^K/') { $results{'bytes_per_second'} = $2 * 1024; }
when ('/^B/') {
$results{'bytes_per_second'} = $2 * ( 1024 * 2 );
}
default { $results{'bytes_per_second'} = $2; }
}

given ($4) {
when ('/^G/') { $results{'bytes_per_request'} = $3 / 1024; }
when ('/^M/') { $results{'bytes_per_request'} = $3; }
when ('/^K/') { $results{'bytes_per_request'} = $3 * 1024; }
when ('/^B/') {
$results{'bytes_per_request'} = $3 * ( 1024 * 2 );
}
default { $results{'bytes_per_request'} = $3; }
}

}
elsif ( $line
=~ /(\d+) requests currently being processed, (\d+) idle workers/
)
{
$results{'current_requests'} = $1;
$results{'idle_workers'} = $2;
$results{'idle_workers'} = $2;
}
}
return (%results);
Expand Down

0 comments on commit 9aa5116

Please sign in to comment.