Wednesday, November 07, 2018

How To Fix "No Route to Host" in Prometheus node-exporter

Requirement:

   We installed and started Prometheus, however we can't get node-exporter metrics.  via /targets  , we find the error " ... no route to host "

Solution:

    The error means Prometheus can't reach http endpoint  http://<ip address>:9100/metrics
     First test localhost if it is working on the node
Login Node:
#wget -O- localhost:9100/metrics
If you get output, it means endpoint is working fine. Otherwise check prometheus pod and logs

     Then test from the other node
Login other Node:
#wget -O- <ip address>:9100/metrics
If you can't get output, means there are some network or firewall issues
* check the your cloud provider and network security settings, make sure port 9100 is open
* check Node linux firewall service settings. In EL7, default port 9100 is not open
#firewall-cmd --add-port=9100/tcp --permanent
# systemctl restart firewalld

"no route to host"  error should be gone. More details Refer github doc

5 comments:

  1. Thanks alot. It worked for me.

    ReplyDelete
  2. Thanks!
    This was the solution for us

    ReplyDelete
  3. Hello, I have written my own exporter, I am getting results with both above commands. But still on prometheus target section, getting same error connect: "no route to host".

    ReplyDelete
  4. Thank you, its solved for me in my case.

    ReplyDelete