Anyone know script to find Apache virtualhost from top output

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

 

 

 

 

Top