This is a collectd plugin for HAProxy.
It uses the exposed HAProxy socket commands (on defined TCP/Unix sockets) to monitor statistics from the show info
, show stat
and show resolvers
(if on HAProxy 1.8+) commands.
This allows monitoring of the overall service status as well as frontends, backends, servers and resolvers configured.
It also supports multi-process statistics aggregation, allowing to configure multiple sockets to collect metrics from.
It's the result of the hmrc/collectd-haproxy repository fork, to which, mainly, the support for multi stats sockets aggregation has been added.
Download the latest release of haproxy.py
file into an arbirtrary path /usr/local/lib/collectd
, e.g. for version 0.1.0:
curl -Lo /usr/local/lib/collectd/haproxy.py --create-dirs \
https://github.com/immobiliare/collectd-haproxy-plugin/releases/download/0.1.0/haproxy.py
Enabling the plugin follows the widely known standard collectd's way.
cat <<EOF > /etc/collectd/plugins/haproxy.conf
<LoadPlugin python>
Globals true
</LoadPlugin>
<Plugin python>
ModulePath "/usr/local/lib/collectd"
Import "haproxy"
<Module haproxy>
Socket "/var/run/haproxy/proc1.sock"
Socket "unix:///var/run/haproxy/proc2.sock"
Socket "tcp://127.0.0.1:8080"
ProxyMonitor "backend"
# ProxyMonitor "server" or "frontend"
# ProxyIgnore to ignore metrics
# Verbose to increase verbosity
</Module>
</Plugin>
EOF
Version | Status | Python compatibility | HAproxy compatibility |
---|---|---|---|
1.x | maintained but untested | cpython >=2.7 | >=1.8 |
1.x | maintained and tested | cpython >=3.7 | >=1.8 |
1.x | maintained and tested | pypy >=3.7 | >=1.8 |
There's no particular requirement other than collectd/HAproxy and Python, as per the matrice above.
See changelog.
See contributing.
You found a bug or need a new feature? Please open an issue.