Add server field to haproxy_backend_server metric
This patch adds a field server to the metric haproxy_backend_server to store the hostname of the back-end server. It also fixes the hostname field to be the hostname where HAProxy is running. Change-Id: Ibe8cf42f60efca1dc38801fdecb4bba913b88938
This commit is contained in:
parent
694079600e
commit
01a7afe310
|
@ -247,7 +247,7 @@ class HAProxyPlugin(base.Base):
|
|||
'meta': {
|
||||
'backend': pxname,
|
||||
'state': stat['status'].lower(),
|
||||
'host': stat['svname'],
|
||||
'server': stat['svname'],
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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_', '')
|
||||
|
|
|
@ -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``
|
||||
|
|
Loading…
Reference in New Issue