Search code examples
consulprometheus

Prometheus + Consul: Creating 2 targets for each Consul server (duplicating targets)


I'm using Prometheus + Consul for service discovery - an awesome combo. Among the services (targets, in prometheus's lingo) discovered by Consul there are the Consul servers themselves. This is useful - I want to monitor the servers too, not just Consul clients.

In fact, I wish to scrape these servers twice - essentially read metrics from 2 different ports on each server.

I'm not sure how this can be achieved: I have no control over what Consul Servers expose to Prometheus about themselves.

Ideally, this could be performed with some regexp manipulation in Prometheus's configuration: I know how to drop a target from the list and I know how to mutate a target - but can a target be duplicated? is there some regex magic for that?


Solution

  • There's no way to create more targets. Instead have two scrape configs.