Created
March 4, 2022 23:10
-
-
Save haproxytechblog/a84768c47f3ca459bfb99947788be48e to your computer and use it in GitHub Desktop.
Use Your Load Balancer to Monitor Application Health
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ haproxy -vv | grep "Prometheus exporter" | |
Built with the Prometheus exporter as a service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frontend metrics | |
bind :8404 | |
stats enable | |
stats uri / | |
stats refresh 5s | |
http-request use-service prometheus-exporter if { path /metrics } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo systemctl restart haproxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global: | |
scrape_interval: 5s | |
evaluation_interval: 5s | |
scrape_configs: | |
- job_name: 'haproxy' | |
static_configs: | |
- targets: ['127.0.0.1:8404'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo systemctl restart prometheus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
haproxy_backend_agg_server_check_status{proxy="webservers", state="UP"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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