Skip to content

Instantly share code, notes, and snippets.

@haproxytechblog
Created March 4, 2022 23:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haproxytechblog/a84768c47f3ca459bfb99947788be48e to your computer and use it in GitHub Desktop.
Save haproxytechblog/a84768c47f3ca459bfb99947788be48e to your computer and use it in GitHub Desktop.
Use Your Load Balancer to Monitor Application Health
$ haproxy -vv | grep "Prometheus exporter"
Built with the Prometheus exporter as a service
frontend metrics
bind :8404
stats enable
stats uri /
stats refresh 5s
http-request use-service prometheus-exporter if { path /metrics }
$ sudo systemctl restart haproxy
global:
scrape_interval: 5s
evaluation_interval: 5s
scrape_configs:
- job_name: 'haproxy'
static_configs:
- targets: ['127.0.0.1:8404']
$ sudo systemctl restart prometheus
haproxy_backend_agg_server_check_status{proxy="webservers", state="UP"}
rate(haproxy_server_http_responses_total{proxy="webservers",code=~"2xx|4xx|5xx"}[30s])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment