issue with prometheus scraping metrics from pushgateway (connection refused)

560 views
Skip to first unread message

JavierG

unread,
Jan 10, 2019, 10:12:59 AM1/10/19
to Prometheus Users
Hi,

Currently I'm able to push metrics from a .net console app to pushgateway. However I'm struggling to get prometheus to pull them.

On the targets page (http://localhost:9090/targets) under http://localhost:9091/metrics I'm getting 'Get http://localhost:9091/metrics: dial tcp 127.0.0.1:9091: connect: connection refused'.

I'm running both prometheus and pushgateway locally using docker

prometheus.yml
global:
    scrape_interval:     10s
    evaluation_interval: 10s

scrape_configs:   
  - job_name: 'prometheus'
    static_configs:
      - targets: ['127.0.0.1:9090']
  - job_name: 'pushgateway'
    honor_labels: true
    static_configs:
      - targets: ['127.0.0.1:9091']


docker-compose.yml
version: '3.4'

services:
    pushgateway:
        image: prom/pushgateway
        ports:
            - 9091:9091

    prometheus:
        image: prom/prometheus
        ports:
            - 9090:9090
        links:
            - pushgateway:pushgateway
        volumes:
            - ./prometheus.yml:/etc/prometheus/prometheus.yml

what am I missing?

thanks

Simon Pasquier

unread,
Jan 10, 2019, 10:24:54 AM1/10/19
to JavierG, Prometheus Users
I'm not that familiar with Docker compose but have you tried
"pushgateway:9091" instead of "localhost:9091" as the target address?
> --
> You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
> To post to this group, send email to promethe...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/10ede725-4a2c-4a48-9bc7-d2a72d7f317f%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

JavierG

unread,
Jan 10, 2019, 10:30:24 AM1/10/19
to Prometheus Users
that did the trick! thanks!

Video on Demand

unread,
Apr 24, 2019, 12:08:32 PM4/24/19
to Prometheus Users
I am getting below the issue. just staring the prometheus.exe file and did below the configuration. but getting blow the issue

Get http://localhost:9091/metrics: dial tcp [::1]:9091: connectex: No connection could be made because the target machine actively refused it.

scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['localhost:9090']
          
        
  - job_name: pushgateway
    honor_labels: true
    static_configs:
    - targets: ['127.0.0.1:9091']
Reply all
Reply to author
Forward
0 new messages