0

I use monit v5.16 running on Debian Wheezy to check if a server is up or down using the ping instruction.

Here is my configuration:

check host my.server.domain with address my.server.domain
       mode passive
       every 5 cycles
       if failed ping4 count 5 then alert  # IPv4 only
       if failed ping6 count 5 then alert  # IPv6 only

I always get the following error:

[CET Mar  1 23:28:32] error    : Ping for my.server.domain -- getaddrinfo failed: Name or service not known
[CET Mar  1 23:28:32] error    : 'my.server.domain' ping test failed

If I ping from the command line, everything works fine:

PING my.server.domain (yy.yyy.yyy.yyy) 56(84) bytes of data.
64 bytes from myoffice.com (xx.xxx.xx.xxx): icmp_req=1 ttl=54 time=1147 ms

I do not want to put anything into my /etc/hosts or anything hardcoded on the server where monit is running.

What could I do to solve this ? Is it a bug ?

Should I use another version of monit ? Is there any workaround ?

lauhub
  • 109
  • 1
  • 6

1 Answers1

0

The problem here came from the fact that I added a ping6 instruction.

ping4 (or ping) alone will work. Adding ping6 makes this check fail (and leads to the getaddrinfo failed error).

lauhub
  • 109
  • 1
  • 6
  • You fix that by putting in your AAAA record into your DNS – Michael Hampton Mar 02 '16 at 22:33
  • Thanks for the tip. I tested and actually the error has changed (Network is unreachable). So I guess it works better but I lack some IPv6 support on my local network or something like that. – lauhub Mar 02 '16 at 22:42