haproxystats
haproxystats copied to clipboard
Add support for writing to collectd
It would be nice to have a support for writing stats to collectd instead of graphite.
Collectd format is not so different from graphite, so it shouldn't be hard to do.
General idea about configuration:
[collectd]
inverval = 30
socket-path = /var/run/collectd.socket
This will requre adding custom types entries to collectd config unless we have it directly in collectd.
I am fine with the idea. What do you mean by 'adding custom types entries' ?
BTW: The interval is used for the retry logic, when we fail to send data to an entry point (collectd in this case), and not as a way to set how ofter we fetch data from haproxy.
As far as I understand, collectd is sending data packed, not like graphite which supports plain text protocol, so both sender and receiver must know all fields, so adding additional type would be probably desired.
Something like:
haproxy_server chkfail:GAUGE:0:U, cli_abrt:GAUGE:0:U, econ:GAUGE:0:U<...>
so to collectd we sent PUTVAL matching naming schema
PUTVAL "localhost/haproxy-1/haproxy_server interval=30 1179574444:0:0:0<...>
About the interval, in my example, I thought about collectd inverval setting, so interval=30.
Does it mean that for each metric we have to create type entry ? some are gauges and others counters. There are also some metrics, which have a string as a value.
No, each group of metric should have it's own type. So probably:
haproxy_daemonhaproxy_daemon_avghaproxy_serverhaproxy_server_avghaproxy_backendhaproxy_backend_avghaproxy_frontend
or whatever makes more sense.