Page 1 of 1
IIS plugin for pool names with spaces troubles
Posted: Tue Aug 09, 2016 11:46 am
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
-
Re: IIS plugin for pool names with spaces troubles
Posted: Tue Aug 09, 2016 12:49 pm
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.
Re: IIS plugin for pool names with spaces troubles
Posted: Tue Aug 09, 2016 1:05 pm
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 ?
Re: IIS plugin for pool names with spaces troubles
Posted: Tue Aug 09, 2016 1:19 pm
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.
Re: IIS plugin for pool names with spaces troubles
Posted: Tue Aug 09, 2016 1:54 pm
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
Re: IIS plugin for pool names with spaces troubles
Posted: Tue Aug 09, 2016 2:39 pm
by mcapra
You will need to allow the execution of remotely signed scripts on each system.
From powershell:
And type Y to confirm.
Re: IIS plugin for pool names with spaces troubles
Posted: Tue Aug 09, 2016 8:05 pm
by Box293
There is a Powershell section in this KB article which should help:
https://support.nagios.com/kb/article.php?id=528
Re: IIS plugin for pool names with spaces troubles
Posted: Mon Aug 15, 2016 12:02 pm
by dlukinski
Thank you (we've got IIS app pool checks working now / please close)