diff --git a/deployment_scripts/puppet/modules/lma_collector/files/collectd/haproxy.py b/deployment_scripts/puppet/modules/lma_collector/files/collectd/haproxy.py index 4be44d275..c414af490 100644 --- a/deployment_scripts/puppet/modules/lma_collector/files/collectd/haproxy.py +++ b/deployment_scripts/puppet/modules/lma_collector/files/collectd/haproxy.py @@ -247,7 +247,7 @@ class HAProxyPlugin(base.Base): 'meta': { 'backend': pxname, 'state': stat['status'].lower(), - 'host': stat['svname'], + 'server': stat['svname'], } } diff --git a/deployment_scripts/puppet/modules/lma_collector/files/plugins/decoders/collectd.lua b/deployment_scripts/puppet/modules/lma_collector/files/plugins/decoders/collectd.lua index cbc1f989d..6427110a8 100644 --- a/deployment_scripts/puppet/modules/lma_collector/files/plugins/decoders/collectd.lua +++ b/deployment_scripts/puppet/modules/lma_collector/files/plugins/decoders/collectd.lua @@ -283,16 +283,17 @@ function process_message () msg['Fields']['tag_fields'] = { 'backend' } msg['Fields']['backend'] = sample['meta']['backend'] if sample['meta']['state'] then - msg['Fields']['tag_fields'][2] = 'state' msg['Fields']['state'] = sample['meta']['state'] + table.insert(msg['Fields']['tag_fields'], 'state') + end + if sample['meta']['server'] then + msg['Fields']['server'] = sample['meta']['server'] + table.insert(msg['Fields']['tag_fields'], 'server') end elseif sample['meta']['frontend'] then msg['Fields']['tag_fields'] = { 'frontend' } msg['Fields']['frontend'] = sample['meta']['frontend'] end - if sample['meta']['host'] then - msg['Fields']['hostname'] = sample['meta']['host'] - end end elseif metric_source == 'apache' then metric_name = string.gsub(metric_name, 'apache_', '') diff --git a/doc/user/source/metrics/haproxy.rst b/doc/user/source/metrics/haproxy.rst index c3559bcb9..745c9281e 100644 --- a/doc/user/source/metrics/haproxy.rst +++ b/doc/user/source/metrics/haproxy.rst @@ -82,9 +82,10 @@ back-end server: metric has an additional ``state`` field that contains the state of the back ends (either 'down' or 'up'). * ``haproxy_backend_server``, the status of the backend server where values - ``0`` and ``1`` represent, respectively, ``DOWN`` and ``UP``. This metric - has an additional ``state`` field that contains the state of the backend - (either 'down' or 'up'). + ``0`` and ``1`` represent, respectively, ``DOWN`` and ``UP``. This metric + has two additional fields: a ``state`` field that contains the state of + the backend (either 'down' or 'up') and a ``server`` field that contains + the hostname of the backend server. * ``haproxy_backend_session_current``, the number of current sessions. * ``haproxy_backend_session_total``, the cumulative number of sessions. * ``haproxy_backend_status``, the global back-end status where values ``0``