IIS App Pool monitoring

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
rferebee
Posts: 733
Joined: Wed Jul 11, 2018 11:37 am

IIS App Pool monitoring

Post by rferebee »

Ok team, I give up. I've been working at this for a week and I cannot figure it out.

I'm attempting to monitor IIS Application Pools on a Windows Server 2008 box running IIS 7. This scenario is well documented all over the Support Forum, but despite my best efforts I can't get it to work. Can you please assist?

I'm using this custom command and the accompanying PS1 script:
https://outsideit.net/monitoring-iis-application-pools/

Here is the command running directly from my Nagios host:

Code: Select all

bash-4.2$ /usr/local/nagios/libexec/check_nrpe -H 10.xxx.xxx.xxx -p 5666 -t 60 -c check_ms_iis_application_pool -a '-A <Prepaid>'
Failed to execute check_ms_iis_application_pool: 57: The parameter is incorrect.
I made a few changes (outlined here: https://support.nagios.com/forum/viewto ... =7&t=50294) to the nsclient.ini file stored on the host I'm attempting to build this check for and started getting the error shown above. Before the ini changes I was getting an error saying, "The specified application pool does not exist" (even though it does).

Not sure what else to look at. Let me know who I can PM my files to. Thank you!
Last edited by rferebee on Thu Jan 02, 2020 12:15 pm, edited 1 time in total.
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: IIS App Pool monitoring

Post by mbellerue »

I would say revert your nsclient.ini changes. I like "The specified application pool does not exist" message better than the other one.

Next, assuming PrePaid is an application pool on your IIS server, take away the less-than/greater-than signs from the sides. Those exist in the documentation as formatting. I suspect you received the "application pool does not exist" message because it was searching for literally <PrePaid>, when the pool is named PrePaid. I could be wrong, but it's worth a shot.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
rferebee
Posts: 733
Joined: Wed Jul 11, 2018 11:37 am

Re: IIS App Pool monitoring

Post by rferebee »

Ok, I'm back to:

Code: Select all

CRITICAL: Application Pool "" does not exist.
I reverted my nsclient.ini changes and I'm running the command this way now:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 10.xxx.xxx.xxx -p 5666 -t 60 -c check_ms_iis_application_pool -a '-A Prepaid'
I confirmed my list of application pools by running: C:\Windows\system32\inetsrv\appcmd list apppool from a PS window. Unfortunately, my service check isn't working for any of the application pools on the list.
Last edited by rferebee on Thu Jan 02, 2020 12:15 pm, edited 1 time in total.
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: IIS App Pool monitoring

Post by mbellerue »

Okay, go ahead and PM me your nsclient.ini file, and the script you are calling. I will take a look at it and see if I can find out what's going on.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
rferebee
Posts: 733
Joined: Wed Jul 11, 2018 11:37 am

Re: IIS App Pool monitoring

Post by rferebee »

PM sent, thank you very much for your help.
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: IIS App Pool monitoring

Post by mbellerue »

You are always welcome!

Okay, so the issue of the pool name not getting passed to the script is in your nsclient.ini file. Line 227, where you have check_ms_iis_application_pool defined.

Existing

Code: Select all

check_ms_iis_application_pool=check_ms_iis_application_pool.ps1
Change to this,

Code: Select all

check_ms_iis_application_pool=powershell check_ms_iis_application_pool.ps1 $ARG1$
That definition will likely also need to be under settings/external scripts/scripts in nsclient.ini. I think wrapped scripts is for scripts that act as wrappers for other scripts.

Give that a shot, don't forget to restart the NSClient service, and let m know how it goes.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
rferebee
Posts: 733
Joined: Wed Jul 11, 2018 11:37 am

Re: IIS App Pool monitoring

Post by rferebee »

Ok, I made those changes and the error reverted back to:

Code: Select all

Failed to execute check_ms_iis_application_pool: 57: The parameter is incorrect.
I also tried it be defining powershell.exe instead of just powershell, but that didn't make a difference.
rferebee
Posts: 733
Joined: Wed Jul 11, 2018 11:37 am

Re: IIS App Pool monitoring

Post by rferebee »

When I attempt to run the script directly from a PS window I get the following error message:

Code: Select all

PS C:\Program Files\NSClient++\scripts\powershell> .\check_ms_iis_application_pool.ps1 -A Prepaid
Get-WmiObject : Invalid namespace
At C:\Program Files\NSClient++\scripts\powershell\check_ms_iis_application_pool.ps1:317 char:53
+                 $IISStruct.ProcessId = Get-WmiObject <<<<  -NameSpace 'root\WebAdministration' -class 'WorkerProcess'
 | Where-Object {$_.AppPoolName -match $IISStruct.ApplicationPool}  | Select-Object -Expand ProcessId
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], ManagementException
    + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

OK:  Application Pool Started but no process is assigned yet "Prepaid" with 0 Applications. {CPU: 0%}{Memory: 0MB} | 'po
ol_cpu'=0%;;;0;100 'pool_memory'=0MB;;;0; 'app_count'=0
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: IIS App Pool monitoring

Post by ssax »

If you open a powershell prompt as admin, what does this output (attach in a text file):

Code: Select all

Get-WmiObject -Class "__Namespace" -Namespace "root"
Get-WmiObject -List -Class "*WorkerProcess*"
rferebee
Posts: 733
Joined: Wed Jul 11, 2018 11:37 am

Re: IIS App Pool monitoring

Post by rferebee »

Please see attached. Thank you.
You do not have the required permissions to view the files attached to this post.
Locked