collectd_haproxy.connection¶collectd_haproxy.connection.HAProxySocket(collectd, socket_file_path)[source]¶Bases: object
Class used for interacting with an HAProxy control socket.
Provides two methods for generating metrics, one for the “info” metrics that give process-wide details and the “stats” metrics for individual proxies/servers.
The HAProxySocket constructor.
Since the collectd module is only available when the plugin is running in collectd’s python process we use some dependency injection here.
| Parameters: |
|
|---|
send_command(command)[source]¶Sends a given command to the HAProxy socket.
Collects the response (it can arrive in chunks) and then calls the
process_command_response method on the result.
| Parameters: | command (str) – The command to send, e.g. “show stat” |
|---|
process_command_response(command, response)[source]¶Takes an HAProxy socket command and its response and either raises an appropriate exception or returns the formatted response.
| Parameters: |
|
|---|
gen_info()[source]¶Generator that yields (name, value) tuples for HAProxy info.
These values represent stats for the whole HAProxy process.
gen_stats(include_frontends, include_backends, include_servers)[source]¶Generator that yields (name, values) for individual proxies.
Each tuple has two items, the proxy and a dictionary mapping stat field names to their respective values.
| Parameters: |
|
|---|