Page 4 of 5

Re: IIS App Pool monitoring

Posted: Thu Jan 02, 2020 2:55 pm
by mbellerue
Yes, I would assume that's the reason. The pool is started, and ready to accept connections, but there's no one to serve right now, so there are no processes taking up CPU and memory.

Re: IIS App Pool monitoring

Posted: Thu Jan 02, 2020 4:39 pm
by rferebee
Strange, when I attempt to create the same service check for a different Application Pool it tells me this:

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 CASH'
CRITICAL: The term 'check_ms_iis_application_pool' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
I don't understand that at all.

Re: IIS App Pool monitoring

Posted: Thu Jan 02, 2020 5:16 pm
by mbellerue
That's a Powershell error that's being returned. If you try running that same command, except against the PrePaid application pool, does it still return normally?

Re: IIS App Pool monitoring

Posted: Thu Jan 02, 2020 5:21 pm
by rferebee
Yes, it's working fine for Prepaid.

Re: IIS App Pool monitoring

Posted: Fri Jan 03, 2020 11:13 am
by mbellerue
Can you manually invoke the Powershell script against that application pool?

And just to confirm, you are not creating a new NRPE command definition per app pool, correct? You just have the one command definition, and then specify the app pool.

Re: IIS App Pool monitoring

Posted: Fri Jan 03, 2020 12:27 pm
by rferebee
I don't know how to manually invoke the script via Powershell, I don't know what the syntax would be to call it and check the Application Pool correctly.

Yes, we have one command definition and we are attempting to specifying different Application Pools in the service check.

Re: IIS App Pool monitoring

Posted: Fri Jan 03, 2020 1:05 pm
by mbellerue
Okay, just hop on to the Windows machine, open up Powershell, and navigate to NSClient's scripts directory (usually C:\Program Files\NSClient++\scripts\). Then run this,

Code: Select all

.\check_ms_iis_application_pool.ps1 -A CASH
And let's see what it returns.

Re: IIS App Pool monitoring

Posted: Fri Jan 03, 2020 4:39 pm
by rferebee
This is what is happening:

Code: Select all

PS C:\WINDOWS\system32> cd /
PS C:\> cd '.\Program Files\'
PS C:\Program Files> cd .\NSClient++\
PS C:\Program Files\NSClient++> cd .\scripts\
PS C:\Program Files\NSClient++\scripts> .\check_ms_iis_application_pool.ps1 -A CASH
CRITICAL: The term 'check_ms_iis_application_pool' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try aga
in.

Suggestion [3,General]: The command check_ms_iis_application_pool was not found, but does exist in the current location.
 Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type
: ".\check_ms_iis_application_pool". See "get-help about_Command_Precedence" for more details.
PS C:\Program Files\NSClient++\scripts> ".\check_ms_iis_application_pool" -A CASH
At line:1 char:35
+ ".\check_ms_iis_application_pool" -A CASH
+                                   ~~
Unexpected token '-A' in expression or statement.
At line:1 char:38
+ ".\check_ms_iis_application_pool" -A CASH
+                                      ~~~~
Unexpected token 'CASH' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

Re: IIS App Pool monitoring

Posted: Fri Jan 03, 2020 5:57 pm
by mbellerue
Okay, so this is really interesting. It's actually running the script. We're getting "CRITICAL: " which is the script returning a message for Nagios to report back on. It's giving the name of the script because of the Catch at line 356. I'm going to have to come back to this on Monday with some additional testing using same-named application pools on my test environment. Then I can run the script through Powershell ISE and use the debugger to see what the heck is going on.

Re: IIS App Pool monitoring

Posted: Mon Jan 06, 2020 12:26 pm
by mbellerue
Alright, I created two application pools on my Server 2016 environment, and I was able to reproduce this when I ran the Powershell script like so,

Code: Select all

".\check_ms_iis_application_pool.ps1" -A CASH
And that also failed when I ran against PrePaid.

However, it works when I run it like this,

Code: Select all

.\check_ms_iis_application_pool.ps1 -A CASH
The only difference being one doesn't have the script name in quotes. Can you try running the Powershell command again without the quotes? Also run it against both PrePaid and CASH. And if you could send in a fresh copy of your nsclient.ini file, that would be great. I'd like to see if there's something in that configuration that's adding quotes to the script name.