IIS plugin for pool names with spaces troubles

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

IIS plugin for pool names with spaces troubles

Post by dlukinski »

Hello XI Support

Please help with configuring nsclient.ini (attached) for running this plugin:
https://exchange.nagios.org/directory/P ... te/details

We've followed instructions and got check configured, but getting strange response:
Our app pool names got spaces so we've inserted this one, but still no luck:
' for pool names with spaces
numargs = WScript.Arguments.Unnamed.length - 1
for i = 1 to numargs
'WScript.Echo(" " + WScript.Arguments.Unnamed.Item(i))
strArgAppPool = strArgAppPool & " " & WScript.Arguments.Unnamed.Item(i)
next
-------------------------------------------------------------------------------------------------------------------

OK Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.



C:\\Program Files\\NSClient++\\scripts\\check_iisv7_apppool_state.vbs(25, 1) (null): 0x8004100E
-
You do not have the required permissions to view the files attached to this post.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: IIS plugin for pool names with spaces troubles

Post by mcapra »

For this particular plugin, does your IIS setup include the "IIS Management Scripts and Tools" component?

You might also consider trying this PowerShell script (created by @WillemDH) which I've found to be a much better solution:
https://github.com/willemdh/check_ms_ii ... ation_pool

Code: Select all

PS C:\Program Files\NSClient++\scripts> ./check_ms_iis_application_pool.ps1 -A DefaultAppPool
OK: Application Pool "DefaultAppPool" is Started.
Former Nagios employee
https://www.mcapra.com/
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: IIS plugin for pool names with spaces troubles

Post by dlukinski »

mcapra wrote:For this particular plugin, does your IIS setup include the "IIS Management Scripts and Tools" component?

You might also consider trying this PowerShell script (created by @WillemDH) which I've found to be a much better solution:
https://github.com/willemdh/check_ms_ii ... ation_pool

Code: Select all

PS C:\Program Files\NSClient++\scripts> ./check_ms_iis_application_pool.ps1 -A DefaultAppPool
OK: Application Pool "DefaultAppPool" is Started.

Thank you, how to define this PS1 script in nsclient.ini and as a command ?
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: IIS plugin for pool names with spaces troubles

Post by mcapra »

Here's how i've configured mine (NSClient++ 0.4.4.19):

Code: Select all

[/settings/external scripts/wrappings]
ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -

....

[/settings/external scripts/wrapped scripts]
check_ms_iis_application_pool=check_ms_iis_application_pool.ps1 $ARG1$
Be wary of pre-existing definitions for the scripts/wrappings section.

Executed from the Nagios XI CLI:

Code: Select all

[root@localhost libexec]# ./check_nrpe -H 192.168.4.235 -c check_ms_iis_application_pool -a '-A DefaultAppPool'
OK: Application Pool "DefaultAppPool" is Started.
Former Nagios employee
https://www.mcapra.com/
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: IIS plugin for pool names with spaces troubles

Post by dlukinski »

mcapra wrote:Here's how i've configured mine (NSClient++ 0.4.4.19):

Code: Select all

[/settings/external scripts/wrappings]
ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -

....

[/settings/external scripts/wrapped scripts]
check_ms_iis_application_pool=check_ms_iis_application_pool.ps1 $ARG1$
Be wary of pre-existing definitions for the scripts/wrappings section.

Executed from the Nagios XI CLI:

Code: Select all

[root@localhost libexec]# ./check_nrpe -H 192.168.4.235 -c check_ms_iis_application_pool -a '-A DefaultAppPool'
OK: Application Pool "DefaultAppPool" is Started.

We are now getting execution of the scripts disabled troubles:
File C:\Program Files\NSClient++\scripts\check_ms_iis_application_pool.ps1 cann
ot be loaded because the execution of scripts is disabled on this system. Pleas

e see "get-help about_signing" for more details.

At line:1 char:43

+ scripts\\\\check_ms_iis_application_pool.ps1 <<<< DefaultAppPool; exit($lastex

itcode)

+ CategoryInfo : NotSpecified: (:) [], PSSecurityException

+ FullyQualifiedErrorId : RuntimeException
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: IIS plugin for pool names with spaces troubles

Post by mcapra »

You will need to allow the execution of remotely signed scripts on each system.

From powershell:

Code: Select all

Set-ExecutionPolicy RemoteSigned
And type Y to confirm.
Former Nagios employee
https://www.mcapra.com/
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: IIS plugin for pool names with spaces troubles

Post by Box293 »

There is a Powershell section in this KB article which should help:

https://support.nagios.com/kb/article.php?id=528
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: IIS plugin for pool names with spaces troubles

Post by dlukinski »

Box293 wrote:There is a Powershell section in this KB article which should help:

https://support.nagios.com/kb/article.php?id=528

Thank you (we've got IIS app pool checks working now / please close)
Locked