check works until it is scheduled and then it fails

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Bionic___
Posts: 54
Joined: Wed Oct 23, 2013 7:49 am

check works until it is scheduled and then it fails

Post by Bionic___ »

I am using the plugin nagios-check-website and it works EXCEPT when it is on the schedule checks.
It works from the CLI:

Code: Select all

/usr/local/nagios/libexec/check_website -w 1500 -c 4000 -t 6000 -s -u /_layouts/15/Sp.Login.Custom/Login.aspx\?ReturnUrl=%2f_layouts%2f15%2fAuthenticate.aspx%3fSource%3d%252F portal.dir.texas.gov
HTTPS OK: 98ms - https://portal.dir.texas.gov/_layouts/15/Sp.Login.Custom/Login.aspx?ReturnUrl=%2f_layouts%2f15%2fAuthenticate.aspx%3fSource%3d%252F|time=98ms;1500;4000;0;
See, it works.

I have created a command in XI called check_website:

Code: Select all

$USER1$/check_website -w $ARG1$ -c $ARG2$ -t $ARG3$ $ARG4$ -u $ARG5$ $ARG6$ 
When I create a service in XI that works every time using the test button in the service:

Code: Select all

COMMAND: /usr/local/nagios/libexec/check_website -w 1500 -c 4000 -t 6000  -p 443 -s -u /_layouts/15/Sp.Login.Custom/Login.aspx\?ReturnUrl=%2f_layouts%2f15%2fAuthenticate.aspx%3fSource%3d%252F portal.dir.texas.gov 
OUTPUT: HTTPS OK: 104ms - https://portal.dir.texas.gov:443/_layouts/15/Sp.Login.Custom/Login.aspx?ReturnUrl=%2f_layouts%2f15%2fAuthenticate.aspx%3fSource%3d%252F|time=104ms;1500;4000;0;
It still works.

When I assign it to a host and put on a scheduled check I always get this error:

Code: Select all

(Return code of 127 is out of bounds - plugin may be missing)
Since there is no call using $HOSTADDRESS$, it seems that associating it with a host address should not make a difference.

I have checked for solutions and followed all the suggestions.
I checked that the plugin exists in the plugin directory.
I checked that Nagios has permissions to the plugin.
I checked that Nagios could execute wget (used in the plugin).

I do not know what else to check.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check works until it is scheduled and then it fails

Post by lmiltchev »

Can you show us the actual host config? Does it help if you wrap the URL in double quotes?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Bionic___
Posts: 54
Joined: Wed Oct 23, 2013 7:49 am

Re: check works until it is scheduled and then it fails

Post by Bionic___ »

Here it is.
Quotes cause it to fail always.

Code: Select all

###############################################################################
#
# Host configuration file
#
# Created by: Nagios QL Version 3.0.3
# Date:       2016-02-11 10:02:58
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

define host {
        host_name                       portal.dir.texas.gov
        use                             xiwizard_website_host
        alias                           portal.dir.texas.gov
        address                         168.44.248.25
        max_check_attempts              5
        check_interval                  5
        retry_interval                  1
        check_period                    xi_timeperiod_24x7
        contacts                        nagiosadmin
        notification_interval           60
        notification_period             xi_timeperiod_24x7
        icon_image                      www_server.png
        statusmap_image                 www_server.png
        _xiwizard                       website
        register                        1
        }

###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check works until it is scheduled and then it fails

Post by lmiltchev »

I don't see a "check_command" directive defined explicitly in the host config, so it's inheriting it from the template.

Code: Select all

use                             xiwizard_website_host
Can you show us the template's config too? The "default" template on my test box looks like this:

Code: Select all

define host {
       name                          		xiwizard_website_host
       check_command                 		check_xi_host_http
       use                           		xiwizard_generic_host
       register                    		0

}
Did you modify yours to use the "check_website" command?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Bionic___
Posts: 54
Joined: Wed Oct 23, 2013 7:49 am

Re: check works until it is scheduled and then it fails

Post by Bionic___ »

The template looks the same as yours"

Code: Select all

define host {
       name                                     xiwizard_website_host
       check_command                            check_xi_host_http
       use                                      xiwizard_generic_host
       register                                 0

}
I tried it with the check_host-alive_http too and it made no difference.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check works until it is scheduled and then it fails

Post by lmiltchev »

I am sorry - I should have asked you about the service definition. My bad. Can you show us the service definition as well plus of the the templates the service is using?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Bionic___
Posts: 54
Joined: Wed Oct 23, 2013 7:49 am

Re: check works until it is scheduled and then it fails

Post by Bionic___ »

I think this is what you asked for

Code: Select all

###############################################################################
#
# Service configuration file
#
# Created by: Nagios QL Version 3.0.3
# Date:       2016-02-11 13:00:05
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

define service {
        host_name                       portal.dir.texas.gov
        service_description             DNS IP Match
        use                             xiwizard_website_dnsip_service
        check_command                   check_xi_service_dns!-a 168.44.248.25
        max_check_attempts              5
        check_interval                  5
        retry_interval                  1
        check_period                    xi_timeperiod_24x7
        notification_interval           60
        notification_period             xi_timeperiod_24x7
        contacts                        nagiosadmin
        _xiwizard                       website
        register                        1
        }

define service {
        host_name                       portal.dir.texas.gov
        service_description             DNS Resolution
        use                             xiwizard_website_dns_service
        max_check_attempts              5
        check_interval                  5
        retry_interval                  1
        check_period                    xi_timeperiod_24x7
        notification_interval           60
        notification_period             xi_timeperiod_24x7
        contacts                        nagiosadmin
        _xiwizard                       website
        register                        1
        }

define service {
        host_name                       portal.dir.texas.gov
        service_description             Ping
        use                             xiwizard_website_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
        contacts                        nagiosadmin
        _xiwizard                       website
        register                        1
        }

define service {
        host_name                       portal.dir.texas.gov
        service_description             SSL Certificate
        use                             xiwizard_website_http_cert_service
        check_command                   check_xi_service_http_cert!30
        max_check_attempts              5
        check_interval                  5
        retry_interval                  1
        check_period                    xi_timeperiod_24x7
        notification_interval           60
        notification_period             xi_timeperiod_24x7
        contacts                        nagiosadmin
        _xiwizard                       website
        register                        1
        }

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: check works until it is scheduled and then it fails

Post by hsmith »

Can you upload this template as well? xiwizard_website_dnsip_service
Former Nagios Employee.
me.
Bionic___
Posts: 54
Joined: Wed Oct 23, 2013 7:49 am

Re: check works until it is scheduled and then it fails

Post by Bionic___ »

Code: Select all

define service {
       name                          		xiwizard_website_dnsip_service
       use                           		xiwizard_generic_service
       check_command                 		check_xi_service_dns
       register                    		0

}	
Last edited by Bionic___ on Wed Feb 17, 2016 2:27 pm, edited 1 time in total.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check works until it is scheduled and then it fails

Post by rkennedy »

Can you PM one of us your profile? Admin -> System Profile -> Download Profile, we should be able to find the template in there.

Also, what are the permissions on the file?

Code: Select all

ls -l /usr/local/nagios/libexec/check_website
Former Nagios Employee
Locked