Skip to content

Collectd plugin to pull metrics from HAProxy instances

License

Notifications You must be signed in to change notification settings

immobiliare/collectd-haproxy-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Collectd HAProxy plugin

pipeline status

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.

Table of Contents

Install

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

Usage

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

Compatibility

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

Requirements

There's no particular requirement other than collectd/HAproxy and Python, as per the matrice above.

Changelog

See changelog.

Contributing

See contributing.

Issues

You found a bug or need a new feature? Please open an issue.