Skip to content

Consul

Prometheus Metrics

Consul is a service networking platform by HashCorp that provides service discovery, configuration, and mesh capabilities.

Consul requires a telemetry configuration block to expose Prometheus metrics.

HCL format (consul.hcl):

telemetry {
prometheus_retention_time = "60s"
}

JSON format (consul.json):

{
"telemetry": {
"prometheus_retention_time": "60s"
}
}

Reload or restart Consul after applying the change. Metrics are then available at http://localhost:8500/v1/agent/metrics?format=prometheus.

Terminal window
sudo tee /etc/glouton/conf.d/99-consul.conf > /dev/null << 'EOF'
metric:
prometheus:
targets:
- url: "http://localhost:8500/v1/agent/metrics?format=prometheus"
name: "consul"
allow_metrics:
- "consul_raft_leader"
- "consul_serf_member_*"
- "consul_catalog_service_count"
- "consul_runtime_alloc_bytes"
- "consul_health_service_status"
EOF

Glouton automatically detects configuration changes.

Metric Description
consul_raft_leader Indicates whether the agent is the Raft leader
consul_serf_member_* Serf membership metrics for cluster member events
consul_catalog_service_count Number of services registered in the catalog
consul_runtime_alloc_bytes Number of bytes allocated by the Consul process
consul_health_service_status Health check status for registered services