I am looking for a way to enumerate through the Virtual Directories (Windows Server 2003) in an App Pool and get diagnostic data (specifically WorkingSet, Private Bytes, and Virtual Bytes).
I've found plenty on how to enumerate through a server's App Pools, and getting the Virtual Directories within, but what do I need to do in order to obtain diagnostic data?
Basically I want to add a script that grabs this data for a monitoring app (NAGIOS). We have a script that already grabs the top 2 running worker processes on the server, but we don't know what app pool they belo开发者_如何学Cng to.
Thanks.
As you've discovered, it's a two-step process: you need to look up resource utilization for every worker process, and you also need to know which app pool corresponds to each worker process.
You've already figured out the first part. Here's how to do the other part: in Windows Server 2003, there's a command-line script available in Windows Server 2003 called iisapp.vbs
. See the documentation for more details. The output from this command-line tool will look like this:
W3wp.exe PID: 2232 AppPoolID: DefaultAppPool
W3wp.exe PID: 2608 AppPoolID: MyAppPool
Simply parse the output from this script and you'll be able to tie process IDs to App Pools. Then look up each process by ID or filter your existing list of enumerated processes to find the matching Process ID.
There may be additional restrictions too around security and specific IIS configuration needed. See the documentation link above.
Note that Windows Server 2008 uses a different command, appcmd list wp
, and it has different output format, so this solution is specific to Windows Server 2003.
精彩评论