Here's /usr/local/bin/apache-stats
:
#!/usr/bin/perl # # apache-stats use LWP::Simple; my $stats=get("http://servername/server-status?auto"); $stats =~ s/.*BusyServers: (\d+)//; my $b = $1; print "$b\n"; $stats =~ s/.*IdleServers: (\d+)//; print $b + $1 . "\n"; print "\n\n";
Note that in Apache 2.0, you want "BusyThreads" rather than "BusyServers", and similarly for IdleThreads.
Then, in your mrtg.cfg
,
Target[apache_child]: `/usr/local/bin/apache-stats` MaxBytes[apache_child]: 100000 Options[apache_child]: growright,gauge,nopercent,dorelpercent Title[apache_child]: Apache Statistics PageTop[apache_child]: <h1>Active Apache child processes</h1> XSize[apache_child]: 500 YSize[apache_child]: 200 WithPeak[apache_child]: dwmy YLegend[apache_child]: No. of child processes ShortLegend[apache_child]: processes LegendI[apache_child]: active: LegendO[apache_child]: total:
Tweak as needed. That should get you started.
Posted by rbowen at April 2, 2003 10:16 PM | TrackBack