From c94fd205f4b552f6899adb60496d0b55c235eb7d Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Wed, 1 Apr 2020 16:43:00 -0700 Subject: [PATCH 1/3] Pass monitoring.* config object --- libbeat/cmd/instance/beat.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libbeat/cmd/instance/beat.go b/libbeat/cmd/instance/beat.go index ed89ae91a9f..a9e59173633 100644 --- a/libbeat/cmd/instance/beat.go +++ b/libbeat/cmd/instance/beat.go @@ -874,7 +874,7 @@ func (b *Beat) setupMonitoring(settings Settings) (report.Reporter, error) { return nil, err } - monitoringClusterUUID, err := monitoring.GetClusterUUID(monitoringCfg) + monitoringClusterUUID, err := monitoring.GetClusterUUID(b.Config.MonitoringBeatConfig.Monitoring) if err != nil { return nil, err } From d0a623d359da28c6213ef40fca4038b2bf05a35d Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Wed, 1 Apr 2020 16:50:04 -0700 Subject: [PATCH 2/3] Adding CHANGELOG entry --- CHANGELOG.next.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 00c63c97e24..3028ad9018a 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -72,6 +72,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Fix k8s metadata issue regarding node labels not shown up on root level of metadata. {pull}16834[16834] - Fail to start if httpprof is used and it cannot be initialized. {pull}17028[17028] - Fix concurrency issues in convert processor when used in the global context. {pull}17032[17032] +- Fix bug with `monitoring.cluster_uuid` setting not always being exposed via GET /state Beats API. {issue}16732[16732] {pull}17420[17420] *Auditbeat* From 7a1231e3859a36841de9392935a41f769ada347b Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Wed, 1 Apr 2020 16:52:17 -0700 Subject: [PATCH 3/3] Adding system test --- libbeat/tests/system/test_monitoring.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/libbeat/tests/system/test_monitoring.py b/libbeat/tests/system/test_monitoring.py index 250747757db..b339ac2bd94 100644 --- a/libbeat/tests/system/test_monitoring.py +++ b/libbeat/tests/system/test_monitoring.py @@ -177,6 +177,30 @@ def test_cluster_uuid_setting(self): self.assertEqual(test_cluster_uuid, state["monitoring"]["cluster_uuid"]) + @unittest.skipUnless(INTEGRATION_TESTS, "integration test") + @attr('integration') + def test_cluster_uuid_setting_monitoring_disabled(self): + """ + Test that monitoring.cluster_uuid setting may be set with monitoring.enabled explicitly set to false + """ + test_cluster_uuid = self.random_string(10) + self.render_config_template( + "mockbeat", + monitoring={ + "enabled": False, + "cluster_uuid": test_cluster_uuid + }, + http_enabled="true" + ) + + proc = self.start_beat(config="mockbeat.yml") + self.wait_until(lambda: self.log_contains("mockbeat start running.")) + + state = self.get_beat_state() + proc.check_kill_and_wait() + + self.assertEqual(test_cluster_uuid, state["monitoring"]["cluster_uuid"]) + def search_monitoring_doc(self, monitoring_type): results = self.es_monitoring.search( index='.monitoring-beats-*',