Martin AJ
Martin AJ

Reputation: 6697

Get Metrics path throws connection refused

I use Grafana and Prometheus. Both are installed on the same server and I don't use docker.

Recently I've imported the Node-Exporter dashboard, and modified the prometheus.yml file like this:

global:
  scrape_interval: 15s
  evaluation_interval: 15s

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

scrape_configs:
  - job_name: "prometheus"
    static_configs:
      - targets: ["localhost:9090"]

  - job_name: "node"
    static_configs:
      - targets: ['localhost:9100']

But the node job can't get up. It is down:

enter image description here

Any idea how can I make it work?

Upvotes: 3

Views: 4582

Answers (2)

fschn90
fschn90

Reputation: 61

This DID work:

curl 172.17.0.1:9100/metrics

while this DID NOT work:

curl http://localhost:9100/metrics
curl: (7) Failed to connect to localhost port 9100 after 0 ms: Connection refused

Upvotes: 1

Eugene
Eugene

Reputation: 31

I have configuration: prometheus in docker, node_exporter setup locally. from docker localhost is localhost inside container. I change

  • targets: ['localhost:9100'] to
  • targets: ['172.17.0.1:9100'] success. It`s for linux. check address by 'ip -4 addr show docker0'

Upvotes: 3

Related Questions