HAProxy Exporter

Native desteğin yerine harici olarak exporter da kullanılabilir.

haproxy_exporter release sayfasından uygun arşiv indirilerek aşağıdaki şekilde kurulabilir.

wget https://github.com/prometheus/haproxy_exporter/releases/download/v0.10.0/haproxy_exporter-0.10.0.linux-amd64.tar.gz

tar zxf haproxy_exporter-0.10.0.linux-amd64.tar.gz

chown haproxy:haproxy haproxy_exporter

mv haproxy_exporter /usr/local/bin

cat > /etc/systemd/system/haproxy_exporter.service <<EOL
[Unit]
Description=Prometheus HAProxy Exporter
After=network.target

[Service]
Type=simple
User=haproxy
Group=haproxy
ExecStart=/usr/local/bin/haproxy_exporter \
    --no-haproxy.ssl-verify \
    --web.listen-address=9101 \
    --haproxy.scrape-uri="unix:/run/haproxy/admin.sock" \
    --haproxy.timeout="5s" \
    --log.level="info"
SyslogIdentifier=haproxy_exporter
Restart=always

[Install]
WantedBy=multi-user.target
EOL

Kurulum yapıldıktan sonra test etmek için:

curl http://localhost:9101/metrics

Last updated