Prometheus example


#1

I’m running 4.2.1 on Kubernetes, and I want to use Prometheus to scrape Concourse metrics. I’m aware of the two web command arguments --prometheus-bind-ip and --prometheus-bind-port, but I’m not sure how to use them.

  1. The help for those args says “[IP/Port] to listen on to expose Prometheus metrics”, but Prometheus uses a scrape (pull) model, so why would Concourse be listening to anything?

  2. Is there a /metrics endpoint? Prometheus is expecting one, I believe.

  3. Since I’m running Concourse in Docker, doesn’t the web container need to expose the scrape port?

  4. Does anyone have a complete working example (ideally for Concourse on Docker/K8s)?


#2

hello,
first time it is a bit confusing to understand Prom directions and terminology.

  1. Exactly, Prom pulls from Concourse, so you have to tell Concourse on which IP/port to listen for Prom to scrape it :slight_smile:
  2. Yes, once you pass the two options at 1; the /metrics endpoint will be available
  3. Yes.
  4. I don’t run Concourse in Docker so I cannot give you more details, but I think you are very close :slight_smile:

#3

Thanks - glad I’m close. I’m still puzzled, though. If web is “listening” for Prometheus scrape requests, wouldn’t the bind IP address always be it’s own IP? I wonder how this is supposed to work in Docker since each container gets a different, dynamically-allocated address.


#4

Solved. Here’s how to set the environment variable in the Concourse web Deployment YAML to bind dynamically to the pod’s IP address:

    env:
    - name: CONCOURSE_PROMETHEUS_BIND_IP
      valueFrom:
        fieldRef:
          fieldPath: status.podIP