Monitor IIS Application Pool with Nagios (problem)

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
User avatar
Ulfandu
Posts: 26
Joined: Thu Jun 14, 2018 4:53 am

Monitor IIS Application Pool with Nagios (problem)

Post by Ulfandu »

Hello.

I'm trying to monitor some IIS Application Pools that one of our server has. I used this guide but for some reason it is not working: https://outsideit.net/monitoring-iis-application-pools/:

Image

Here is the input for the command Get-IISAppPool on the Windows Server I need to monitor:
Image

Here is the nagios core's nsclient.ini:

Code: Select all

# If you want to fill this file with all available options run the following command:
#   nscp settings --generate --add-defaults --load-all
# If you want to activate a module and bring in all its options use:
#   nscp settings --activate-module <MODULE NAME> --add-defaults
# For details run: nscp settings --help

# IIS application poolin monitoring:
check_ms_iis_application_pool=cmd /c echo scripts/powershell/check_ms_iis_application_pool.ps1 $ARG1$; exit $LastExitCode | powershell.exe /noprofile -command -

; in flight - TODO
[/settings/default]

; Undocumented key
password = 1234

; Undocumented key
allowed hosts = 192.168.1.10


; in flight - TODO
[/settings/NRPE/server]

; Undocumented key
verify mode = none

; Undocumented key
insecure = true


; in flight - TODO
[/modules]

; Undocumented key
CheckExternalScripts = enabled

; Undocumented key
CheckHelpers = enabled

; Undocumented key
CheckNSCP = enabled

; Undocumented key
CheckDisk = enabled

; Undocumented key
WEBServer = enabled

; Undocumented key
CheckSystem = enabled

; Undocumented key
NSClientServer = enabled

; Undocumented key
CheckEventLog = enabled

; Undocumented key
NSCAClient = enabled

; Undocumented key
NRPEServer = enabled
Here is the command I defined in nagios' commands.cfg-file:

Code: Select all

# 'check_ms_iis_application_pool' command definition
define command{
        command_name    check_ms_iis_application_pool
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -t 60 -c check_ms_iis_application_pool "$ARG1$"
And here is the service for the host server in the file windows.cfg:

Code: Select all

define service{
       use                     generic-service
       host_name               IIS-Server
       service_description     XXXPool
       check_command check_nrpe!check_ms_iis_application_pool -a '-A <IIS-Server>'
       }
I would be very thankful if someone could help me with this problem. I tried Googling this problem, but couldn't find any information on how to specifically define the service.

I suspected that there might be something wrong with windows.cfg, so I tried editing the line:

Code: Select all

check_command           check_nrpe!check_ms_iis_application_pool! -a '-A <XXXPool>'
check_command           check_nrpe!check_ms_iis_application_pool! -a '-A XXXPool'
check_command           check_nrpe!check_ms_iis_application_pool! -a -A XXXPool
Attachments
Get-IISAppPool.png
Get-IISAppPool.png (7.05 KiB) Viewed 4235 times
check_ms_iis_application_pool not working.png
check_ms_iis_application_pool not working.png (4.78 KiB) Viewed 4235 times
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Monitor IIS Application Pool with Nagios (problem)

Post by mcapra »

First off, thanks for providing *all* of the dang information required to start troubleshooting this problem. That's top-notch :)

Check out this KB article:
https://support.nagios.com/kb/article.php?id=528

I believe you just need to move your check_ms_iis_application_pool command definition to the [/settings/external scripts/scripts] section of your nsclient.ini file. Like so:

Code: Select all

[/settings/external scripts/scripts]
check_ms_iis_application_pool=cmd /c echo scripts/powershell/check_ms_iis_application_pool.ps1 $ARG1$; exit $LastExitCode | powershell.exe /noprofile -command -
Give that a try, restart the NSClient++ service, and see if you get the desired effect. If it's still giving you bad output when executed from the Nagios Core machine, please share the output. It would also be useful to know your NSClient++ version, which can be found like so:

Code: Select all

/path/to/check_nrpe -H <your windows host>
Or by checking the nscp executable's properties on the remote Windows machine.
Former Nagios employee
https://www.mcapra.com/
kyang

Re: Monitor IIS Application Pool with Nagios (problem)

Post by kyang »

Thanks for the help @mcapra!

Ulfandu, let us know if you have any more questions. Otherwise, please proceed with mcapra's suggestions!
Locked