Get "http://IPaddress:9092/metrics": dial tcp IPaddress:9092: connect: connection refused

  apache-nifi, connection, docker, monitoring, prometheus

I am trying to monitoring nifi on prometheus , prometheus stands up with docker compose and nifi installed on different server;

docker compose file ;

version: '2.1'

volumes:
    prometheus_data: {}
    grafana_data: {}

services:

  prometheus:
    image: prom/prometheus:v2.21.0
    ports:
      - 9000:9090
    container_name: prometheus
    volumes:
        - ./prometheus/:/home/user/monitoring/prometheus/
        - /prometheus_data:/prometheus_data:rw
    command:
      - '--config.file=/home/user/monitoring/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus'
      - '--storage.tsdb.retention.time=200h'
      - '--web.enable-lifecycle'
    restart: unless-stopped
    user: root

and on prometheus.yml as bellow;

global:
  
  external_labels:
    monitor: 'codelab-monitor'

scrape_configs:
  - job_name: 'prometheus'
    scrape_interval: 5s
    static_configs:
      - targets: ['localhost:9090']
  - job_name: 'nifi'
    scrape_interval: 5s
    static_configs:
      - targets: ['<<ip address>>:9092']

But after I run reporting task on nifi and check prometheus I got an error Get "http://IPaddress:9092/metrics": dial tcp IPaddress:9092: connect: connection refused

Does anyone have any idea about this error?

Source: Docker Questions

LEAVE A COMMENT