Web Hosting Talk







View Full Version : Anyone know script to find Apache virtualhost from top output


nipl
08-29-2004, 06:15 PM
Does anyone know of a Perl/PHP script that can determine the respective Apache Virtualhosts from the list of high-load PID's in output of "top" ?

Or even a script that takes a Apache PID as input and gives the Apache Virtualhost connected with that PID - I'll do the parsing of "top" output myself. Basically, my need is to find the Apache virtualhost (all processes running as user 'apache') that is showing up in top 5 processes on the server.

I don't use Cpanel - so don't need suggestions on the lines of "Oh, its in Cpanel scripts" :p

nipl
08-29-2004, 06:40 PM
An update on this... the web-based /server-status displays the virtualhost so a PHP script could web-fetch the server-status url and parse the contents based on PID - but that's a rather patchwork kind of approach.

The apache server-status is (almost) doing what I needed - if anyone's come across Perl or PHP equivalent code for that Apache function, do help me out here.