IIS AppPool monitoring Check_IIS.ps1

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

IIS AppPool monitoring Check_IIS.ps1

Post 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!
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: IIS AppPool monitoring Check_IIS.ps1

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: IIS AppPool monitoring Check_IIS.ps1

Post by SavaSC »

Now it tells me: "No handler for that command."
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: IIS AppPool monitoring Check_IIS.ps1

Post by lmiltchev »

Can you post the entire nsclient.ini file? Remove sensitive info - IPs, passwords, etc.
Be sure to check out our Knowledgebase for helpful articles and solutions!
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: IIS AppPool monitoring Check_IIS.ps1

Post by SavaSC »

There is no nsclient.ini. There is NSC.ini. I have attached it.
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: IIS AppPool monitoring Check_IIS.ps1

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: IIS AppPool monitoring Check_IIS.ps1

Post by SavaSC »

OK, I installed v0.5 and now everything seems to be working correctly. Thank you very much.
bolson

Re: IIS AppPool monitoring Check_IIS.ps1

Post by bolson »

May we close this topic as resolved?
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: IIS AppPool monitoring Check_IIS.ps1

Post by SavaSC »

Yes, please do. Thank you, again.
bolson

Re: IIS AppPool monitoring Check_IIS.ps1

Post by bolson »

Closing topic as resolved.

Thank you for using the Nagios Support Forum.
Locked