IIS App Pool monitoring

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: IIS App Pool monitoring

Post by mbellerue »

Ack! I bet with Server 2008 you're still on Powershell 2. Can you upgrade to Powershell 4?
https://www.microsoft.com/en-us/downloa ... x?id=40855
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 »

Let me speak with the person responsible for this server and I'll get back to you ASAP.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: IIS App Pool monitoring

Post by ssax »

Sounds good, we'll keep an eye out.
rferebee
Posts: 733
Joined: Wed Jul 11, 2018 11:37 am

Re: IIS App Pool monitoring

Post by rferebee »

Ok, we got PS 4.0 installed. Now I'm seeing this:

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'
check_ms_iis_application_pool.ps1 : The term
'check_ms_iis_application_pool.ps1' 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.
At line:1 char:1
+ check_ms_iis_application_pool.ps1 -A Prepaid
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (check_ms_iis_application_pool.p
   s1:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
Do you want me to resend my nsclient.ini and the check_ms_iis_application_pool.ps1 scripts?
Last edited by rferebee on Thu Jan 02, 2020 12:14 pm, edited 1 time in total.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: IIS App Pool monitoring

Post by ssax »

Yes, please attach them/

Try changing it to:

Code: Select all

[/settings/external scripts/scripts]
check_ms_iis_application_pool = cmd /c echo If (-Not (Test-Path "scripts\check_ms_iis_application_pool.ps1") ) { Write-Host "UNKNOWN: Script `"check_ms_iis_application_pool.ps1`" not found."; exit(3) }; scripts\check_ms_iis_application_pool.ps1 $ARGS$; exit($lastexitcode) | powershell.exe /noprofile -command -
Then restart the nsclient++ service and try again.
rferebee
Posts: 733
Joined: Wed Jul 11, 2018 11:37 am

Re: IIS App Pool monitoring

Post by rferebee »

PM sent with files requested.

Not getting this response after making the change you recommended:

Code: Select all

[[email protected] ~]$ /usr/local/nagios/libexec/check_nrpe -H 10.xxx.xxx.xxx -p 5666 -t 60 -c check_ms_iis_application_pool -a '-A Prepaid'
UNKNOWN: Script "check_ms_iis_application_pool.ps1" not found.
Last edited by rferebee on Thu Jan 02, 2020 12:14 pm, edited 1 time in total.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: IIS App Pool monitoring

Post by ssax »

Do you have the powershell script in the C:\Program Files\NSClient++\scripts directory on the remote system?

Please replace your nsclient.ini with the one I've PM'ed you, make sure the .ps1 plugin is in the scripts directory, then restart the nsclient++ service in services.msc and test again from the XI server.
rferebee
Posts: 733
Joined: Wed Jul 11, 2018 11:37 am

Re: IIS App Pool monitoring

Post by rferebee »

Ok, I made the requested changes, ran the check and received this as the return:

Code: Select all

[[email protected] ~]$ /usr/local/nagios/libexec/check_nrpe -H 10.xxx.xxx.xxx -p 5666 -t 60 -c check_ms_iis_application_pool -a '-A Prepaid'
Get-WmiObject : Invalid namespace "root\WebAdministration"
At C:\Program Files\NSClient++\scripts\check_ms_iis_application_pool.ps1:317
char:40
+ $IISStruct.ProcessId = Get-WmiObject -NameSpace
'root\WebAdminis ...
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-WmiObject], Management
Exception
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.C
ommands.GetWmiObjectCommand

OK: Application Pool Started but no process is assigned yet "Prepaid" with 0 Applications. {CPU: 0%}{Memory: 0MB} |'pool_cpu'=0%;;;0;100 'pool_memory'=0MB;;;0 'app_count'=0
Last edited by rferebee on Thu Jan 02, 2020 12:14 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, we need to install the scripting tools.

Code: Select all

install-windowsfeature -name Web-Scripting-Tools
Then try the script again. If it fails with the same invalid namespace, run this command and show us the output.

Code: Select all

get-windowsfeature
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, so we finally got the Web Scripting Tools installed. I apologize, I was told by the system administrator that they had already been installed. Turns out they were not...

We've got the check partially working 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'
OK: Application Pool Started but no process is assigned yet "Prepaid" with 0 Applications. {CPU: 0%}{Memory: 0MB} |'pool_cpu'=0%;;;0;100 'pool_memory'=0MB;;;0 'app_count'=0
Is the reason the check isn't reporting any CPU and Memory is because there are no processes assigned to it and 0 applications?
Locked