title: Traefik 2 with Prometheus and Grafana
body: <p>I'm currently using Traefik 2.2 with Prometheus and Grafana.
  Traefik dashboard, metrics are working, and Prometheus endpoint is enabled.
  However, there are too few metrics sending to the Grafana dashboard.
  Hope somebody can give some suggestions.
  I tried with  prometheus:
          manualRouting: true
  and entryPoint: metrics, but same result.</p>
  
  <p>Thanks in advance.</p>
  
  <p>Traefik labels:</p>
  
  <pre><code>  - "traefik.enable=true"
    - "traefik.http.routers.traefik.entrypoints=http"
    - "traefik.http.routers.traefik.entrypoints.rule=hostregexp('{host:.+}')"
    - "traefik.http.routers.traefik-secure.entrypoints=https"
    - "traefik.http.routers.traefik.rule=Host(`traefik.abcdxyz.com`) &amp;&amp; PathPrefix(`/api`, `/dashboard`)"
    - "traefik.http.middlewares.traefik-auth.basicauth.users=tx7:$redacted$$"
    - "traefik.http.routers.traefik.middlewares=https-redirect@file"
    - "traefik.http.routers.traefik-secure.rule=Host(`traefik.abcdxyz.com`)"
    - "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
    - "traefik.http.routers.traefik-secure.tls=true"
    - "traefik.http.routers.traefik-secure.tls.certresolver=le"
    - "traefik.http.routers.traefik-secure.service=api@internal"
    - "traefik.http.services.traefik.loadbalancer.server.port=8080"
    - "traefik.http.routers.traefik-secure.tls.options=myTLS@file"
  </code></pre>
  
  <p>Traefik.yml</p>
  
  <pre><code>log:
    level: INFO
  
  entryPoints:
    dashboard:
      address: :8080
    http:
      address: :80
    https:
      address: :443
    metrics:
      address: :8082
  
  api:
    dashboard: true
    insecure: false
    debug: true
  
  serversTransport:
    insecureSkipVerify: true
  
  certificatesResolvers:
    le:
      acme:
        httpChallenge:
          # used during the challenge
          entryPoint: http
        email: abcd@outlook.com
        storage: acme.json
        # Use Let's Encrypt Staging CA when testing!
        #caServer: https://acme-staging-v02.api.letsencrypt.org/directory
  
  providers:
    docker:
      endpoint: "unix:///var/run/docker.sock"
      exposedByDefault: false
    file:
      filename: config.yml
      watch: true
  
  accessLog: {}
  
  # metrics
  
  metrics:
    prometheus:
     manualRouting: true
      buckets:
        - 0.1
        - 0.3
        - 1.2
        - 5.0
      addEntryPointsLabels: true
      addServicesLabels: true
  
    influxdb:
      pushInterval:
       - "10s"
      addEntryPointsLabels: true
      addServicesLabels: true
      protocol: http
      database: server
      username: admin
      password: "passwd."
  </code></pre>
  
  <p>config.yml</p>
  
  <pre><code>http:
    routers:
      api:
        entryPoints:
          - metrics
        rule: PathPrefix(`/metrics`)
        service: prometheus@internal
  </code></pre>
  
  <p>Prometheus.yml</p>
  
  <pre><code>global:
    scrape_interval: 5s
    external_labels:
      monitor: 'server'
  scrape_configs:
    - job_name: 'prometheus'
      static_configs:
      - targets: ['192.168.1.97:9090']
    - job_name: 'node_exporter'
      static_configs:
      - targets: ['192.168.1.97:9100']
  
    - job_name: 'traefik'
      static_configs:
      - targets: ['192.168.1.97:8082']
  
    - job_name: 'grafana'
      static_configs:
      - targets: ['192.168.1.97:3000']
  </code></pre>