Page 3 of 5

Re: IIS App Pool monitoring

Posted: Fri Dec 27, 2019 3:29 pm
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

Re: IIS App Pool monitoring

Posted: Fri Dec 27, 2019 3:46 pm
by rferebee
Let me speak with the person responsible for this server and I'll get back to you ASAP.

Re: IIS App Pool monitoring

Posted: Fri Dec 27, 2019 4:52 pm
by ssax
Sounds good, we'll keep an eye out.

Re: IIS App Pool monitoring

Posted: Fri Dec 27, 2019 5:43 pm
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?

Re: IIS App Pool monitoring

Posted: Fri Dec 27, 2019 5:51 pm
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.

Re: IIS App Pool monitoring

Posted: Fri Dec 27, 2019 6:13 pm
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.

Re: IIS App Pool monitoring

Posted: Mon Dec 30, 2019 10:10 am
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.

Re: IIS App Pool monitoring

Posted: Mon Dec 30, 2019 10:34 am
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

Re: IIS App Pool monitoring

Posted: Mon Dec 30, 2019 2:10 pm
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

Re: IIS App Pool monitoring

Posted: Thu Jan 02, 2020 12:11 pm
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?