$HOSTNAME$ macro not working?

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
stecino
Posts: 248
Joined: Thu Mar 14, 2013 4:42 pm

$HOSTNAME$ macro not working?

Post 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
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: $HOSTNAME$ macro not working?

Post 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$
:)
stecino
Posts: 248
Joined: Thu Mar 14, 2013 4:42 pm

Re: $HOSTNAME$ macro not working?

Post 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
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: $HOSTNAME$ macro not working?

Post by Box293 »

Please post your command definition for:

check_jqmq
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
stecino
Posts: 248
Joined: Thu Mar 14, 2013 4:42 pm

Re: $HOSTNAME$ macro not working?

Post 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.
cmerchant
Posts: 546
Joined: Wed Sep 24, 2014 11:19 am

Re: $HOSTNAME$ macro not working?

Post by cmerchant »

Great. We'll go ahead and close the thread. Thanks.
Locked