Cannot translate 'localhost' to IP address -- Success

Issue #735 new
Former user created an issue


Linux 192-168-0-174 3.10.0-327.59.59.46.h38.x86_64 #1 SMP Mon Dec 11 19:34:45 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

monit configuration:

set daemon 40
set logfile /var/paas/monit/monit.log
set httpd unixsocket /var/paas/monit/monit.sock and
    allow localhost

include /var/paas/monit/job/*.monitrc


when do the test(deplete the open files in the host, then recover), monit can not work normally when the config file is as follows:

check process kubelet matching "/usr/local/bin/kubelet"
    group kubelet
    start program = "/var/paas/monit/jobs/bin/kubelet_ctl start"
    stop program = "/var/paas/monit/jobs/bin/kubelet_ctl stop"
    if does not exist then restart
    **if failed port 10248 protocol HTTP**
         request /healthz
        with timeout 30 seconds
        for 4 times within 5 cycles
        then restart


[CST Apr 10 14:36:45] error    : Cannot translate 'localhost' to IP address -- Success
[CST Apr 10 14:36:45] error    : 'kubelet' failed protocol test [HTTP] at    [localhost]:10248/healthz [TCP/IP] -- Cannot resolve [localhost]:10248

Comments (7)

  1. Tildeslash repo owner

    Please can you provide output of the following command?:

    host localhost

    When you don't specify the hostname in the connection test, monit adds a default value ("localhost"). It seems that in your case it doesn't resolve (which is strange, but possible). You can most probably fix the problem by setting the host explicitly using the "host <name | ipaddress>" option, example:

    if failed host port 10248 protocol HTTP ...
  2. wangbo

    tildeslash, thanks for your reply.

    host localhost output is: -bash: host: command not found

    and yes, i know if added the specific host it will work, but i just want to know the root case, any other suggestion? maybe this is a bug of monit.

  3. Tildeslash repo owner

    as mentioned, it seems that your system isn't able to resolve "localhost" ... it depends on your resolver configuration, not monit

  4. Tildeslash repo owner

    Please check your name resolver configuration and make sure it resolves "localhost". Monit uses just standard system API to resolve the hostname.

  5. Massimo Sala

    wangbo, I suggest youto run these two command and upload here their outputs:

    strace -f -e trace=network ping localhost
    strace -f -e trace=network curl localhost:10248

    They execute a ping and a curl on your localhost, logging al the operations. So we can see how localhost is resolved.

  6. Log in to comment