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': {
|
'meta': {
|
||||||
'backend': pxname,
|
'backend': pxname,
|
||||||
'state': stat['status'].lower(),
|
'state': stat['status'].lower(),
|
||||||
'host': stat['svname'],
|
'server': stat['svname'],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -283,16 +283,17 @@ function process_message ()
|
||||||
msg['Fields']['tag_fields'] = { 'backend' }
|
msg['Fields']['tag_fields'] = { 'backend' }
|
||||||
msg['Fields']['backend'] = sample['meta']['backend']
|
msg['Fields']['backend'] = sample['meta']['backend']
|
||||||
if sample['meta']['state'] then
|
if sample['meta']['state'] then
|
||||||
msg['Fields']['tag_fields'][2] = 'state'
|
|
||||||
msg['Fields']['state'] = sample['meta']['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
|
end
|
||||||
elseif sample['meta']['frontend'] then
|
elseif sample['meta']['frontend'] then
|
||||||
msg['Fields']['tag_fields'] = { 'frontend' }
|
msg['Fields']['tag_fields'] = { 'frontend' }
|
||||||
msg['Fields']['frontend'] = sample['meta']['frontend']
|
msg['Fields']['frontend'] = sample['meta']['frontend']
|
||||||
end
|
end
|
||||||
if sample['meta']['host'] then
|
|
||||||
msg['Fields']['hostname'] = sample['meta']['host']
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
elseif metric_source == 'apache' then
|
elseif metric_source == 'apache' then
|
||||||
metric_name = string.gsub(metric_name, 'apache_', '')
|
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
|
metric has an additional ``state`` field that contains the state of the
|
||||||
back ends (either 'down' or 'up').
|
back ends (either 'down' or 'up').
|
||||||
* ``haproxy_backend_server``, the status of the backend server where values
|
* ``haproxy_backend_server``, the status of the backend server where values
|
||||||
``0`` and ``1`` represent, respectively, ``DOWN`` and ``UP``. This metric
|
``0`` and ``1`` represent, respectively, ``DOWN`` and ``UP``. This metric
|
||||||
has an additional ``state`` field that contains the state of the backend
|
has two additional fields: a ``state`` field that contains the state of
|
||||||
(either 'down' or 'up').
|
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_current``, the number of current sessions.
|
||||||
* ``haproxy_backend_session_total``, the cumulative number of sessions.
|
* ``haproxy_backend_session_total``, the cumulative number of sessions.
|
||||||
* ``haproxy_backend_status``, the global back-end status where values ``0``
|
* ``haproxy_backend_status``, the global back-end status where values ``0``
|
||||||
|
|
Loading…
Reference in New Issue