IIS 6 Application Pool State Monitoring

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Sampath.Basireddy
Posts: 252
Joined: Wed Dec 14, 2016 12:30 pm

IIS 6 Application Pool State Monitoring

Post by Sampath.Basireddy »

How do I monitor IIS 6 Application Pool State Monitoring on a Windows Server with NCPA?

I did find few plugins on exchange.nagios.org, but most of them are for NSClient++. Is there a way I can use the same plugin to work with NCPA. If yes, please help.

Here is the plugin I am trying to configure, but the steps are for NSClient. Would be really great help if someone can guide me how to use it with NCPA.

https://exchange.nagios.org/directory/P ... 1501271895


Thanks.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: IIS 6 Application Pool State Monitoring

Post by mcapra »

The official NCPA documentation should get you started:
https://www.nagios.org/ncpa/help.php
https://www.nagios.org/ncpa/help/2.0/ap ... es-plugins
https://www.nagios.org/ncpa/help/2.0/ap ... ing-plugin

Essentially, you place the plugin in the NCPA plugins path (as defined in the [plugin directives] section of your NCPA configuration file) then call it via the NCPA API.
Former Nagios employee
https://www.mcapra.com/
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: IIS 6 Application Pool State Monitoring

Post by tmcdonald »

Thanks for the assist, @mcapra! OP, let us know if you need further assistance.
Former Nagios employee
Sampath.Basireddy
Posts: 252
Joined: Wed Dec 14, 2016 12:30 pm

Re: IIS 6 Application Pool State Monitoring

Post by Sampath.Basireddy »

Thank you @mcapra.

I followed the instructions and created a service check, but it is throwing some error. Here are the details.

Below is the output when I run the check command from Nagios XI:

Code: Select all

[nagios@<SRV Name> ~]$ /usr/local/nagios/libexec/check_ncpa.py -H <Host Name> -t '<Token>' -P 5693 -M 'plugins/check_ms_iis_application_pool.ps1' -a OEPool
CRITICAL: Argument: OEPool Value:  Error: Illegal arguments detected: OEPool
Below is the output when I run from Nagios Server CLI:

Code: Select all

UID@<SRV Name>:[~]: /usr/local/nagios/libexec/check_ncpa.py -H <Host Name> -t '<Token>' -P 5693 -M 'plugins/check_ms_iis_application_pool.ps1' -a OEPool
CRITICAL: Argument: OEPool Value: Error: Illegal arguments detected: OEPool

Please note that, when I run the script manually on the IIS Server itself, it works fine. Here is the output when I run it locally.
This output is when the IIS Application Pool was stopped:

Code: Select all

PS C:\Program Files (x86)\Nagios\NCPA\plugins> .\check_ms_iis_application_pool.ps1 -A OEPool
CRITICAL: Application Pool "OEPool" is Stopped.
PS C:\Program Files (x86)\Nagios\NCPA\plugins> 
This output is when the the IIS Application Pool is started:

Code: Select all

PS C:\Program Files (x86)\Nagios\NCPA\plugins> ./check_ms_iis_application_pool.ps1 -A OEPool
OK: Application Pool "OEPool" with 2 Applications. {CPU:  %}{Memory: 0 MB} | 'pool_cpu'=%, 'pool_memory'=0MB, 'app_count'=2
PS C:\Program Files (x86)\Nagios\NCPA\plugins>

Any help is greatly appreciated.

And I have attached the error output when I try to access the scripts from NCPA Console via APIs
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: IIS 6 Application Pool State Monitoring

Post by tgriep »

Can you post the ncpa.cfg file from the Windows Host?
You can find it in this folder.

Code: Select all

C:\Program Files (x86)\Nagios\NCPA\etc
From the Error, it looks like the -A option is not defined in the command.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Sampath.Basireddy
Posts: 252
Joined: Wed Dec 14, 2016 12:30 pm

Re: IIS 6 Application Pool State Monitoring

Post by Sampath.Basireddy »

Here is the ncpa.cfg.

Code: Select all

[listener]
uid = nagios
certificate = adhoc
loglevel = info
ip = 0.0.0.0
gid = nagcmd
logfile = var/ncpa_listener.log
port = 5693
pidfile = var/ncpa_listener.pid
# Available versions: PROTOCOL SSLv2, SSLv3, TLSv1
ssl_version = TLSv1

[passive]
uid = nagios
handlers = nrds,nrdp
loglevel = info
gid = nagcmd
sleep = 300
logfile = var/ncpa_passive.log
pidfile = var/ncpa_passive.pid

[nrdp]
token =
hostname =
parent =

[nrds]
URL =
CONFIG_VERSION =0
TOKEN =
CONFIG_NAME =
CONFIG_OS = None
PLUGIN_DIR=plugins/
UPDATE_CONFIG=1
UPDATE_PLUGINS=1

[api]
community_string =<Token>

[plugin directives]
plugin_path = plugins/
.sh = /bin/sh $plugin_name $plugin_args
.ps1 = powershell -ExecutionPolicy Bypass -File $plugin_name $plugin_args
.vbs = cscript $plugin_name $plugin_args //NoLogo

[passive checks]
%HOSTNAME%|cpu usage = /cpu/percent --warning 20 --critical 30
%HOSTNAME%|swap usage = /memory/swap/percent --warning 40 --critical 80
%HOSTNAME%|memory usage = /memory/virtual/percent --warning 60 --critical 80
And I did update the script to accept -a, but still no luck.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: IIS 6 Application Pool State Monitoring

Post by tgriep »

Try running the command like the example below adding the -A to the arguments option and see if this works.
/usr/local/nagios/libexec/check_ncpa.py -H <Host Name> -t '<Token>' -P 5693 -M 'plugins/check_ms_iis_application_pool.ps1' -a '-A OEPool'
Be sure to check out our Knowledgebase for helpful articles and solutions!
Sampath.Basireddy
Posts: 252
Joined: Wed Dec 14, 2016 12:30 pm

Re: IIS 6 Application Pool State Monitoring

Post by Sampath.Basireddy »

Tried that as well, but no luck.

Here is the output:

Code: Select all

UID@SRV:[~]: /usr/local/nagios/libexec/check_ncpa.py -H <SRV Name> -t '<Token>' -M 'plugins/check_ms_iis_application_pool.ps1' -a '-A OEPool' -v
Connecting to: https://<SRV Name>:5693/api/plugins/check_ms_iis_application_pool.ps1/-A/OEPool?token=<Token>&check=1
File returned contained:
{
    "returncode": 2,
    "stdout": "CRITICAL: Argument: -A Value: OEPool Error: Illegal arguments detected: -A"
}
CRITICAL: Argument: -A Value: OEPool Error: Illegal arguments detected: -A
UID@SRV:[~]:
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: IIS 6 Application Pool State Monitoring

Post by tgriep »

Can you post your check_ms_iis_application_pool.ps1 script so we can view it?
It looks like the plugin passed the arguments correctly to that script.
Be sure to check out our Knowledgebase for helpful articles and solutions!
bolson

Re: IIS 6 Application Pool State Monitoring

Post by bolson »

Try this:

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -H <Host Name> -t '<Token>' -P 5693 -M 'plugins/check_ms_iis_application_pool.ps1 OEPool'
It likely won't work but it should give us a different error message.

I think the issue is that the argument '-a OEPool' is being interpreted as an argument for check_ncpa.py rather than for check_ms_iis_application_pool.ps1.
Locked