Is this a bug in Nagios core or by design?

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
as300182
Posts: 36
Joined: Tue May 17, 2016 8:09 am

Is this a bug in Nagios core or by design?

Post by as300182 »

This is the scenario.

I have two web servers (serverA and serverB) behind a load balanced address serverLB. If you try to connect to the individual servers by hostname you get redirected. One page only (for monitoring) is accesible directly via IP address on each web server.

From the command line I can run the command:

Code: Select all

./check_http -I 10.10.8.64 -f follow -s "Results check:" or ./check_http -I 10.10.8.65 -f follow -s "Results check:"
and if I enable verbose I can see that I'm on the respective servers.

So I've assumed that if I set this in my services.cfg file, everything would be OK.

Code: Select all

define service{
        use                                  generic-service         ; Name of service template to use
        host_name                       serverA
        service_description           Homepage
	check_command		check_http! -I 10.10.8.64 -f follow -s "Results check:"
        }

define service{
        use                                  generic-service         ; Name of service template to use
        host_name                       serverB
        service_description           Homepage
	check_command		check_http! -I 10.10.8.65 -f follow -s "Results check:"
        }
Well it's not OK. Nagios ignores the 'I' option and still uses the hostname, which means I'm not getting the result I wanted or expected.

This looks like a bug to me, unless someone can tell me otherwise?
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Is this a bug in Nagios core or by design?

Post by mcapra »

Can you show us your command definition for check_http? Typically this can be found in the /usr/local/nagios/etc/commands.cfg file.

By default I think it is always trying to use the hostname:

Code: Select all

define command {
       command_name                             check_http
       command_line                             $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
}
In the above case, you would modify the command_line parameter and remove the -I $HOSTADDRESS$ section.
Former Nagios employee
https://www.mcapra.com/
as300182
Posts: 36
Joined: Tue May 17, 2016 8:09 am

Re: Is this a bug in Nagios core or by design?

Post by as300182 »

mcapra wrote:Can you show us your command definition for check_http? Typically this can be found in the /usr/local/nagios/etc/commands.cfg file.

By default I think it is always trying to use the hostname:

Code: Select all

define command {
       command_name                             check_http
       command_line                             $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
}
In the above case, you would modify the command_line parameter and remove the -I $HOSTADDRESS$ section.

Yes that's what was doing it. Many thanks for pointing this out, and sorry it took me so long to thank you. I thought I'd already replied and was horrified when I discovered I hadn't.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Is this a bug in Nagios core or by design?

Post by cdienger »

Has everything been sorted? Is it okay to lock this thread or did you have any further questions related to this?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
as300182
Posts: 36
Joined: Tue May 17, 2016 8:09 am

Re: Is this a bug in Nagios core or by design?

Post by as300182 »

I'm happy for this one to be closed now. Thanks.
Locked