Simple question about ip address vs hostname and dns for pings

Hi all,

I did check the manuals and did run some tests. I am just looking for a simple explanation. If I have a host in Icinga that has host address (ie ip) and hostname that has a ping check for example. Will it use IP first and then use hostname after if no reply or will it use the host name?

If i make a host called erfhkejrfhkjerhfkerfer and it has an ip entry, it is found OK and replies to the ping.

The basic question is if ip and hostname are present, which are used first by Icinga for a ping check?

Hi,
A general answer is difficult here, because we don’t know how you configured your service and which check command (ping, icmp etc.) you are using. If you give us more information we can help you better. :wink:

Icinga is only triggering the information to an external check script/binary. So it depends which one you choose in your setup/config. As well if you use the ip or dns in your service config.

No, it will only use what is in the variable address or address6.

Thank you.

I am using ping4

‘/usr/lib64/nagios/plugins/check_ping’ ‘-4’ ‘-H’ ‘’ ‘-c’ ‘12000,15%’ ‘-w’ ‘11000,5%’

hostname field was filled out with a hostname that I invented (fitting label for it)
ip also filled out in Host Address.

if we take a look into the docs we don’t see any hint what the plugin is doing, if you use dns instead of ip. But I think the check use OS functions from the TCP/IP stack (nslookup, using arp cache etc.).

The point here is to think about what happens if the dnslookup doesn’t work because the dns service/server isn’t available? If there isn’t a entry in the local (arp) cache, the check will fail even though the device works normally. That means you get a lot of falls-positive messages.
That’s why we for example use the ip adress instead of dns. And to know if the dns server is working fine, we use other checks.

1 Like