Page 1 of 1

$HOSTNAME$ macro not working?

Posted: Tue Apr 07, 2015 4:06 pm
by stecino
Hello,

For some reason $HOSTNAME$ is passing IP as oppose to host_name parameter from host defintion
Here is is my config

define host{
use stage-app-hosts
host_name StageJQMQ1
alias Stage JQ RabbitMQ 1
address 10.xx.xx.xx
}

define service {
use stage-app-services
hostgroup_name Stage_JQMQ
service_description check_mq_server
check_command check_jqmq!check_rabbitmq_server!HOSTNAME$
}

define hostgroup {
hostgroup_name Stage_JQMQ
alias Stage_JQMQ
members StageJQMQ1
}

I am getting this error:

RABBITMQ_SERVER CRITICAL - Received 500 Can't connect to 10.xx.xx.xx.blah.com:15672 (Bad hostname) for path: nodes/rabbit@10

For some reason it's getting the IP address instead hostname

Re: $HOSTNAME$ macro not working?

Posted: Tue Apr 07, 2015 4:12 pm
by jdalrymple
stecino wrote:check_command check_jqmq!check_rabbitmq_server!HOSTNAME$
I can't explain where your command is getting 10.x.x.x, but I can say that

Code: Select all

HOSTNAME$ != $HOSTNAME$
:)

Re: $HOSTNAME$ macro not working?

Posted: Tue Apr 07, 2015 7:50 pm
by stecino
Still it's passing the IP address after I added the missing $
In my script I had to parse the fqdn from the reverse IP lookup

Re: $HOSTNAME$ macro not working?

Posted: Tue Apr 07, 2015 8:47 pm
by Box293
Please post your command definition for:

check_jqmq

Re: $HOSTNAME$ macro not working?

Posted: Fri Apr 10, 2015 12:41 pm
by stecino
Looks like it wasn't an issue with the Nagios, but an issue with DNS. The entries weren't in the zone file, now $HOSTNAME$ is returning proper value.

Re: $HOSTNAME$ macro not working?

Posted: Fri Apr 10, 2015 1:28 pm
by cmerchant
Great. We'll go ahead and close the thread. Thanks.