Trying to configure IIS plugin

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
gixxx11
Posts: 16
Joined: Mon Apr 17, 2017 8:54 am

Trying to configure IIS plugin

Post by gixxx11 »

I'm having an issue getting a IIS and application pool plugin to work.

This one in specific: https://exchange.nagios.org/directory/P ... ol/details

I'm getting the error in nagios: (Return code of 127 is out of bounds. Check if plugin exists) which means I've not configured it correctly on the source machine.

I could use some assistance.

I edited nsclient.ini and added these lines to the bottom:

;TEST PowerShell Script for IIS
[/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 -

I created a "Powershell" folder under \NSClient++\scripts\ and placed the "check_ms_iis_application_pool.ps1" script into it. I then restared the nsclient service.

Under Nagios XI I created a new command "check_ms_iis_application_pool => $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -t 60 -c check_ms_iis_application_pool $ARG1$"

I added the service to the machine I'm testing and set ARG1 to: -a '-A <testorderentry>'
"testorderentry" is the name of an application pool. I also tested -a '-A testorderentry', -A <testorderentry>, testorderentry and everything is giving the same error.

Error: " (Return code of 127 is out of bounds. Check if plugin exists) " I believe this means the plugin isn't even responding to requests so is configured incorrectly.

Thank you for any assistance!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Trying to configure IIS plugin

Post by scottwilkerson »

This error
gixxx11 wrote:(Return code of 127 is out of bounds. Check if plugin exists)
leads me to believe that the command that was added to XI isn't correct and it cannot find your check_nrpe plugin correctly

Can you verify that you have typed everything correctly in the $USER1$ macro and plugin name

It would also be good to test your command from the XI command line like so

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H xxx.xxx.xxx.xxx -p 5666 -t 60 -c check_ms_iis_application_pool
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
gixxx11
Posts: 16
Joined: Mon Apr 17, 2017 8:54 am

Re: Trying to configure IIS plugin

Post by gixxx11 »

"Can you verify that you have typed everything correctly in the $USER1$ macro and plugin name"

I followed the instructions. I made no changes to $USER1$ macro (should I need to?) and I copy/pasted from the instructions. I don't see anything incorrect.

"It would also be good to test your command from the XI command line like so"

When I run the command from the command line I get no output at all.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Trying to configure IIS plugin

Post by tgriep »

Can you get the nsclient.ini file and the nsclient.log file from the Windows server and post them here so we can view the settings and any errors?

On the nagios server, can you run the following as root and post the output here?

Code: Select all

/usr/local/nagios/libexec/check_nrpe -V
Then login to the XI GUi and go to the Core Config Manager > Services menu and search to the Service in question.
Click on the View Config icon (Right hand side of the menu) Copy the config for the service and post it here so we can view it.

Thanks
Be sure to check out our Knowledgebase for helpful articles and solutions!
gixxx11
Posts: 16
Joined: Mon Apr 17, 2017 8:54 am

Re: Trying to configure IIS plugin

Post by gixxx11 »

nsclient.ini file

Code: Select all

# If you want to fill this file with all avalible 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


; Undocumented section
[/settings/default]

; Undocumented key
password = ******

; Undocumented key
allowed hosts = 192.168.1.49, 192.168.1.54


; Undocumented section
[/settings/NRPE/server]

; Undocumented key
ssl options = no-sslv2,no-sslv3

; Undocumented key
verify mode = peer-cert

; Undocumented key
insecure = false


; Undocumented section
[/modules]

; Undocumented key
CheckExternalScripts = 1

; Undocumented key
CheckHelpers = 1

; Undocumented key
CheckEventLog = 1

; Undocumented key
CheckNSCP = 1

; Undocumented key
CheckDisk = 1

; Undocumented key
CheckSystem = 1

; Undocumented key
NSClientServer = 1

; Undocumented key
NRPEServer = 1

;TEST PowerShell Script for IIS
[/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 -
nsclient.log

Code: Select all

2018-12-12 11:00:53: error:c:\source\nscp\modules\NRPEServer\NRPEServer.cpp:132: Certificate not found: C:\Program Files\NSClient++/security/certificate.pem (generating a default certificate)
2018-12-12 11:00:53: error:c:\source\nscp\modules\NRPEServer\NRPEServer.cpp:132: CA not found: C:\Program Files\NSClient++/security/ca.pem (generating a default CA)
2018-12-12 11:37:40: error:c:\source\nscp\service\NSClient++.cpp:427: Failed to load C:\Program Files\NSClient++/modules\cmd /c echo scripts/powershell/check_ms_iis_application_pool.ps1 $ARG1$; exit $LastExitCode | powershell.exe /noprofile -command -.dll: Could not load library: 126: The specified module could not be found.

: noprofile -command -.dll
Output: /usr/local/nagios/libexec/check_nrpe -V has no output at all

Code: Select all

[root@nagios /]# /usr/local/nagios/libexec/check_nrpe -V
[root@nagios /]#
Service Config

Code: Select all

###############################################################################
#
# Services configuration file
#
# Created by: Nagios CCM 2.7.4
# Date:       2018-12-21 10:51:02
# Version:    Nagios Core 4.x
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios CCM will overwrite all manual settings during the next update if you 
# would like to edit files manually, place them in the 'static' directory or 
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################

define service {
    host_name                testoe2016-1.issdmz.local
    service_description      CPU Usage
    use                      xiwizard_windowsserver_nsclient_service
    check_command            check_xi_service_nsclient!*******!CPULOAD!-l 5,80,90
    max_check_attempts       5
    check_interval           5
    retry_interval           1
    check_period             xi_timeperiod_24x7
    notification_interval    60
    notification_period      xi_timeperiod_24x7
    notifications_enabled    0
    _xiwizard                windowsserver
    register                 1
}

define service {
    host_name                testoe2016-1.issdmz.local
    service_description      Drive C: Disk Usage
    use                      xiwizard_windowsserver_nsclient_service
    check_command            check_xi_service_nsclient!******!USEDDISKSPACE!-l C -w 80 -c 95
    max_check_attempts       5
    check_interval           5
    retry_interval           1
    check_period             xi_timeperiod_24x7
    notification_interval    60
    notification_period      xi_timeperiod_24x7
    notifications_enabled    0
    _xiwizard                windowsserver
    register                 1
}

define service {
    host_name                testoe2016-1.issdmz.local
    service_description      IIS App Pool testorderentry
    check_command            IIS and App Pool - Adam Cox!-A testorderentry!!!!!!!
    max_check_attempts       5
    check_interval           5
    retry_interval           1
    check_period             xi_timeperiod_24x7
    notification_interval    60
    notifications_enabled    0
    _xiwizard                windowsserver
    register                 1
}

define service {
    host_name                testoe2016-1.issdmz.local
    service_description      Memory Usage
    use                      xiwizard_windowsserver_nsclient_service
    check_command            check_xi_service_nsclient!*****!MEMUSE!-w 80 -c 90
    max_check_attempts       5
    check_interval           5
    retry_interval           1
    check_period             xi_timeperiod_24x7
    notification_interval    60
    notification_period      xi_timeperiod_24x7
    notifications_enabled    0
    _xiwizard                windowsserver
    register                 1
}

define service {
    host_name                testoe2016-1.issdmz.local
    service_description      Ping
    use                      xiwizard_windowsserver_ping_service
    max_check_attempts       5
    check_interval           5
    retry_interval           1
    check_period             xi_timeperiod_24x7
    notification_interval    60
    notification_period      xi_timeperiod_24x7
    notifications_enabled    0
    _xiwizard                windowsserver
    register                 1
}

define service {
    host_name                testoe2016-1.issdmz.local
    service_description      Uptime
    use                      xiwizard_windowsserver_nsclient_service
    check_command            check_xi_service_nsclient!*****0!UPTIME
    max_check_attempts       5
    check_interval           5
    retry_interval           1
    check_period             xi_timeperiod_24x7
    notification_interval    60
    notification_period      xi_timeperiod_24x7
    notifications_enabled    0
    _xiwizard                windowsserver
    register                 1
}

###############################################################################
#
# Services configuration file
#
# END OF FILE
#
###############################################################################
Thank you for your help.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Trying to configure IIS plugin

Post by tgriep »

When creating an external command, you need to specify a wrapping command so the agent knows which application it needs to use to run the command.

Add this wrapping to the nsclient.ini file and restart the NSClient++ agent and see if the check runs. You may have to adjust it to your path of where the posweshell script is saved.

Code: Select all

[/settings/external scripts/wrappings]
; WRAPPING - An external script wrapping
ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked