From a8fcb61cecb9de1e1c18c41db8d0d5d9c530afbd Mon Sep 17 00:00:00 2001 From: kaiyan-sheng Date: Tue, 12 Mar 2019 14:08:48 -0600 Subject: [PATCH] Cherry-pick to 7.0: Enable checks for jolokia documented fields (#10979) (#11144) * Enable checks for jolokia documented fields (#10979) * Enable checks for jolokia documented fields * Remove test fields before assert_fields_are_documented (cherry picked from commit e0316884ad009d9341ef45632dd9787c2186f80d) * Fix changelog --- CHANGELOG.next.asciidoc | 3 +- metricbeat/docs/fields.asciidoc | 70 +++++++++++++++++++ metricbeat/module/jolokia/_meta/fields.yml | 28 ++++++++ metricbeat/module/jolokia/fields.go | 2 +- .../module/jolokia/jmx/_meta/fields.yml | 7 +- .../tests/system/test_autodiscover_jolokia.py | 8 +++ 6 files changed, 114 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 5d90696f5bb..a3d5b1ad3bb 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -80,8 +80,7 @@ https://github.com/elastic/beats/compare/v7.0.0-beta1...master[Check the HEAD di - Migrate docker autodiscover to ECS. {issue}10757[10757] {pull}10862[10862] - Fix issue in kubernetes module preventing usage percentages to be properly calculated. {pull}10946[10946] - Fix parsing error using GET in Jolokia module. {pull}11075[11075] {issue}11071[11071] -- Collect metrics when EC2 instances are not in running state. {issue}11008[11008] {pull}11023[11023] -- Change ECS field cloud.provider to aws. {pull}11023[11023] +- Add documentation about jolokia autodiscover fields. {issue}10925[10925] {pull}10979[10979] *Packetbeat* diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index 5c30b9c4f37..4892209455b 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -10796,6 +10796,76 @@ jolokia contains metrics exposed via jolokia agent +*`jolokia.agent.version`*:: ++ +-- +type: keyword + +Version number of jolokia agent. + + +-- + +*`jolokia.agent.id`*:: ++ +-- +type: keyword + +Each agent has a unique id which can be either provided during startup of the agent in form of a configuration parameter or being autodetected. If autodected, the id has several parts: The IP, the process id, hashcode of the agent and its type. + + +-- + +*`jolokia.server.product`*:: ++ +-- +type: keyword + +The container product if detected. + + +-- + +*`jolokia.server.version`*:: ++ +-- +type: keyword + +The container's version (if detected). + + +-- + +*`jolokia.server.vendor`*:: ++ +-- +type: keyword + +The vendor of the container the agent is running in. + + +-- + +*`jolokia.url`*:: ++ +-- +type: keyword + +The URL how this agent can be contacted. + + +-- + +*`jolokia.secured`*:: ++ +-- +type: boolean + +Whether the agent was configured for authentication or not. + + +-- + [[exported-fields-kafka]] == Kafka fields diff --git a/metricbeat/module/jolokia/_meta/fields.yml b/metricbeat/module/jolokia/_meta/fields.yml index c70f3a505c7..90e90b774ec 100644 --- a/metricbeat/module/jolokia/_meta/fields.yml +++ b/metricbeat/module/jolokia/_meta/fields.yml @@ -11,3 +11,31 @@ description: > jolokia contains metrics exposed via jolokia agent fields: + - name: agent.version + type: keyword + description: > + Version number of jolokia agent. + - name: agent.id + type: keyword + description: > + Each agent has a unique id which can be either provided during startup of the agent in form of a configuration parameter or being autodetected. If autodected, the id has several parts: The IP, the process id, hashcode of the agent and its type. + - name: server.product + type: keyword + description: > + The container product if detected. + - name: server.version + type: keyword + description: > + The container's version (if detected). + - name: server.vendor + type: keyword + description: > + The vendor of the container the agent is running in. + - name: url + type: keyword + description: > + The URL how this agent can be contacted. + - name: secured + type: boolean + description: > + Whether the agent was configured for authentication or not. diff --git a/metricbeat/module/jolokia/fields.go b/metricbeat/module/jolokia/fields.go index d87e16c1eb0..aef6948238f 100644 --- a/metricbeat/module/jolokia/fields.go +++ b/metricbeat/module/jolokia/fields.go @@ -32,5 +32,5 @@ func init() { // AssetJolokia returns asset data. // This is the base64 encoded gzipped contents of ../metricbeat/module/jolokia. func AssetJolokia() string { - return "eJxsj0FOBCEQRfec4oe1cwEWHsArGGMIVDPl0BShaoxze4NNTC/mLz/8l1cX3OgR8CVVbhwdYGyVAvzb0XgHZNI0uBtLC3h1ALBesUu+V3KAXmXYZ5K2cQnYYtXZDqoUlQLKRCuZcSsa8O5Vq3+Bv5p1/+GAjalmDX/wC1rc6Sw1Y48+QUPufTVPvI6sIZI0i9wUO9ngpKCfLkoZ3xz/P8VCzdb4bHGYnC/4DQAA//8Yw1wH" + return "eJyslM2O2zoMhfd5ioNs7i0wkwfworsupuiiKPqzKIpCkeiIM7bkklQy8/aFbGfGQZq2QKpdGPqcTxTJWzzQU4P73OUHdivA2DpqsH47RdYrIJB64cE4pwavVwAw/4s+h9LRCtCYxb77nFreNWhdpzUq1JFTarCr0kpmnHba4OtatVvfYB3NhvW3FdAydUGbUfwWyfW0hKrHnoYqJLkMc+QXXNOZP4TPyRwnRU8m7BX0OGSlgD275yS3o2Tzx0uKJcmYs9mTKOe0MJqYHujpkCUs4hfJgM+TCFLptyTI7SnI5oI3h+ts3zgfJylEp3AoiX8UAgccIvsI7xK2BGKLJBgk7zlQQCjCaQc1J1aGimuRZiFOaLP0NTjWuuVdEVfdMThxPVm9oGBLVcIVy4GMvFHY4K6dA/XnzSjKYURT2pO4rkqYNvgYCXfvp4xBsidVcLipqdHnQKdILgWw6Vih81IqyZ5kM0gOxdt1Ba1cc39N9aqS4BbPd7xk/0/a6MT+P8Usiv8XBK9+g5BClusJJp3jE7yUY9EjCikp1QbgdM5TpLue4tOHd4j5AIuss+3czSPRpcfwReh8qrY5d+TS37l/iTSOy8t9D06fR4FCnY/a55GSsZ9GIwtSPpnzaQP3j2csy2X3B5LjQr7vH4/bjpYdfrqJj+e4734GAAD//5W+yCU=" } diff --git a/metricbeat/module/jolokia/jmx/_meta/fields.yml b/metricbeat/module/jolokia/jmx/_meta/fields.yml index a927f3fc9f8..2821e3dcf71 100644 --- a/metricbeat/module/jolokia/jmx/_meta/fields.yml +++ b/metricbeat/module/jolokia/jmx/_meta/fields.yml @@ -1 +1,6 @@ -- release: ga +- key: jmx + type: group + description: > + Jolokia jmx metricset + release: ga + fields: diff --git a/metricbeat/tests/system/test_autodiscover_jolokia.py b/metricbeat/tests/system/test_autodiscover_jolokia.py index 4f1858c3d09..727e4e62807 100644 --- a/metricbeat/tests/system/test_autodiscover_jolokia.py +++ b/metricbeat/tests/system/test_autodiscover_jolokia.py @@ -52,3 +52,11 @@ def test_jolokia_jmx(self): print(evt) assert evt["jolokia"]["test"]["gc"]["collection_count"] >= 0 + + # Check Jolokia autodiscover metadata is added + assert evt['jolokia']['server']['product'] == 'tomcat' + assert evt['jolokia']['server']['vendor'] == 'Apache' + + # Remove "test" fields because namespace specific fields are not documented + del(evt["jolokia"]["test"]) + self.assert_fields_are_documented(output[0])