Search code examples
prometheusmetrics

How to enable Prometheus internal metrics?


I want to monitor Prometheus service using prometheus.

Localy I have following docker-compose:

version: '3.7'

services:
  grafana:
    build: './config/grafana'
    ports:
      - 3000:3000
    volumes:
      - ./grafana:/var/lib/grafana
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=admin
    networks:
      monitoring:
        aliases:
          - grafana
  prometheus:
    image: prom/prometheus
    ports:
      - 9090:9090
    volumes:
      - ./config/prometheus.yml:/etc/prometheus/prometheus.yml
      - ./prometheus:/prometheus
    networks:
      monitoring:
        aliases:
          - prometheus
networks:
  monitoring:

When I start prometheus I can visit http://localhost:9090/ to see UI and it works but there are no metrics. To see metrics I need to do 2 thisngs:

  1. force Prometheus to expose metrics
  2. Configure prometheus to listen metrics

Second step is clear for me but I don't understand how to force Prometheus to expose metrics.

Could you please explain that ?


Solution

  • Thanks @DazWilkin

    by default Prometheus own metrics are available on

    localhost:9090/metrics