Page 1 of 1

IIS AppPool monitoring Check_IIS.ps1

Posted: Mon Jul 31, 2017 2:57 pm
by SavaSC
Hello,

I need to monitor the app pools on our web servers. I went to the Nagios exchange site and grabbed the check_iis.ps1 file. I put it in the script in c:\Program Files\NSClient++\Scripts\. I then modified the NSC.ini file by adding the following lines:

Code: Select all

[Script Wrappings]
ps1 = cmd /c echo scripts\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -ExecutionPolicy Bypass -command -

[Wrapped Scripts]
check_iis=check_iis.ps1 $ARG1$
I then restarted the NSClient++ service.

Unfortunately,
It is having issues with the lastexit line. I have attached a picture of the error.

Any idea of what I did wrong?

Thanks!

Re: IIS AppPool monitoring Check_IIS.ps1

Posted: Mon Jul 31, 2017 4:44 pm
by lmiltchev
Comment out or delete:

Code: Select all

check_iis=check_iis.ps1 $ARG1$
from [Wrapped Scripts] section, then add:

Code: Select all

check_iis = cmd /c echo scripts\check_iis.ps1 $ARG1$; exit $LastExitCode | powershell.exe -command -
to the [/settings/external scripts/scripts] section.

Save, exit, and restart the NSClient++ service.

Did this help?

Re: IIS AppPool monitoring Check_IIS.ps1

Posted: Tue Aug 01, 2017 7:59 am
by SavaSC
Now it tells me: "No handler for that command."

Re: IIS AppPool monitoring Check_IIS.ps1

Posted: Tue Aug 01, 2017 12:44 pm
by lmiltchev
Can you post the entire nsclient.ini file? Remove sensitive info - IPs, passwords, etc.

Re: IIS AppPool monitoring Check_IIS.ps1

Posted: Tue Aug 01, 2017 2:00 pm
by SavaSC
There is no nsclient.ini. There is NSC.ini. I have attached it.

Re: IIS AppPool monitoring Check_IIS.ps1

Posted: Tue Aug 01, 2017 2:29 pm
by lmiltchev
I didn't realize you are using such on old version of NSClient++. The config files are completely different for 0.3.9 and 0.4.x (not only the names - NSC.ini vs nsclient.ini...). The 0.3.x versions are no longer supported, and the documentation is not available on the NSClient++ website.

https://docs.nsclient.org/

You can try:

1. Making some changes to the NSC.ini file to see if this is going to fix the issue.

Move:

Code: Select all

check_iis = cmd /c echo scripts\check_iis.ps1 $ARG1$; exit $LastExitCode | powershell.exe -command -
out of [/settings/external scripts/scripts] section (as this is in ver. 0.4.x), and place it under [External Scripts].

Make sure you have these entries under both sections - [NRPE] and [External Script] sections:

Code: Select all

allow_arguments=1
allow_nasty_meta_chars=1
2. Upgrade the NSClient++ agent to 0.4.4 version.

Re: IIS AppPool monitoring Check_IIS.ps1

Posted: Wed Aug 02, 2017 3:29 pm
by SavaSC
OK, I installed v0.5 and now everything seems to be working correctly. Thank you very much.

Re: IIS AppPool monitoring Check_IIS.ps1

Posted: Wed Aug 02, 2017 4:50 pm
by bolson
May we close this topic as resolved?

Re: IIS AppPool monitoring Check_IIS.ps1

Posted: Thu Aug 03, 2017 8:49 am
by SavaSC
Yes, please do. Thank you, again.

Re: IIS AppPool monitoring Check_IIS.ps1

Posted: Thu Aug 03, 2017 9:18 am
by bolson
Closing topic as resolved.

Thank you for using the Nagios Support Forum.