haproxystats icon indicating copy to clipboard operation
haproxystats copied to clipboard

Add support for writing to collectd

Open mateusz-gozdek-sociomantic opened this issue 8 years ago • 4 comments
trafficstars

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.

unixsurfer avatar Jun 06 '17 10:06 unixsurfer

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.

unixsurfer avatar Jun 06 '17 11:06 unixsurfer

No, each group of metric should have it's own type. So probably:

  • haproxy_daemon
  • haproxy_daemon_avg
  • haproxy_server
  • haproxy_server_avg
  • haproxy_backend
  • haproxy_backend_avg
  • haproxy_frontend

or whatever makes more sense.