collectd_haproxy.plugin

class collectd_haproxy.plugin.HAProxyPlugin(collectd)[source]

Bases: object

The plugin class, workhorse that liasons between collectd and HAProxy.

Rather than being instantiated directly, the register() method should be used to make a plugin, since it both creates an instance and takes care of the proper callback registration.

HAProxy Plugin 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:collectd (module) – The collectd module.
name = 'haproxy'
classmethod register(collectd)[source]

Registers the plugin’s callbacks with the given collectd module.

Since the collectd module is only available when the plugin is running in collectd’s python process we use some dependency injection here.

Parameters:collectd (module) – The collectd module.
configure(config)[source]

The ‘configure’ collectd callback for the plugin.

Iterates over the config object’s children attribute and sets any applicable attributes on the plugin instance.

Parameters:config (collect.Config) – The collectd Config instance. Passed in automatically by collectd itself.
initialize()[source]

The ‘initialize’ collectd callback for the plugin.

This callback fires after the ‘config’ one but before the ‘read’ one gets added to the loop.

Instantiates a collectd.Values for each known metric (these are used to dispatch actual values to collectd) as well as sets up the HAProxySocket for fetching the values.

read()[source]

The ‘read’ collectd callback for the plugin.

Simple method that calls collect_info() and/or collect_stats() based on the configuration.

collect_info()[source]

Method for sending HAProxy “info” metrics to collectd.

Iterates over the metric names and values provided by the socket and dispatches each known one to collectd.

collect_stats()[source]

Method for sending HAProxy “info” metrics to collectd.

Iterates over the metric names and values provided by the socket, checking that the metric is a known one and taking care of numeric coercion before dispatching to collectd.