I am running Apache 1.3.29 on a redhat 7.3 Box.
I always got strange numbers of busy/idle Servers.
I got BusyServers: 1 IdleServers: 6 when I run
/usr/bin/lynx -dump http://localhost/server-status?auto | /usr/bin/head -9
so I had to change the unix_apachestats.pl like this
#!/usr/bin/perl
# Copyright - Rolf Poser - rolf@stasolutions.co.za
# 07 December 2003 under the GPL license agreement!
#
# Version 0.2 - PLEASE SEE README.txt for more information.
#
# USAGE:
#
# perl unix_apachestats.pl <hostname>
#
# <hostname> is optional and can be an IP address or host name.
# If none is given, "localhost" is assumed.
#
# LOCAL SETTINGS:
#
# Change the values below to point to the right places for your installation
#
$BASH="/bin/bash";
$LYNX="/usr/bin/lynx";
$HEAD="/usr/bin/head";
#
# YOU SHOULDN"T NEED TO CHANGE ANYTHING BEYOND THIS POINT..
#
#$hostname = "www.mailkast.com";
$hostname = "localhost";
#my $hostname = $ARGV[0];
chomp $hostname;
if ($hostname eq '') {
$hostname = "localhost";
}
$URL = "http:\/\/".$hostname."\/server-status?auto";
$output = `$BASH -c '$LYNX -dump $URL | $HEAD -9'`;
$output =~ /Total Accesses: (.*)/;
print "apache_total_hits:".$1." ";
$output =~ /Total kBytes: (.*)/;
print "apache_total_kbytes:".$1." ";
$output =~ /BusyServers: (.*)/;
print "apache_busy_workers:".$1." ";
$output =~ /IdleServers: (.*)/;
print "apache_idle_workers:".$1;
Wrong output of unix_apachestats.pl
Moderators: Developers, Moderators
I didn't get the data on my server for some reason (Redhat 7.3).
I had to replace the lynx command with the wget command and after that everything went fine.
$output = `/bin/bash -c 'wget --quiet -O - \"http:\/\/localhost\/server-status"'`;
$output =~ /Total accesses: (.*) - Total Traffic: (.*) MB/;
$tt= $2*1000;
print "apache_total_hits:".$1." ";
print "apache_total_kbytes:".$tt." ";
$output =~ /(.*) requests currently being processed, (.*) idle servers/;
print "apache_busy_workers:".$1." ";
print "apache_idle_workers:".$2." ";
I had to replace the lynx command with the wget command and after that everything went fine.
$output = `/bin/bash -c 'wget --quiet -O - \"http:\/\/localhost\/server-status"'`;
$output =~ /Total accesses: (.*) - Total Traffic: (.*) MB/;
$tt= $2*1000;
print "apache_total_hits:".$1." ";
print "apache_total_kbytes:".$tt." ";
$output =~ /(.*) requests currently being processed, (.*) idle servers/;
print "apache_busy_workers:".$1." ";
print "apache_idle_workers:".$2." ";
Who is online
Users browsing this forum: No registered users and 4 guests