From 16b3056b1f3f6a62327212003888c04899813c76 Mon Sep 17 00:00:00 2001 From: Chris Earle Date: Thu, 7 Jul 2016 17:59:39 -0400 Subject: [PATCH] [Monitoring] Change xpack.monitoring.agent to xpack.monitoring.collection This changes the xpack.monitoring.agent.* settings so that they fall under xpack.monitoring.collection.*. - This also changes Kibana's equivalent data_collection to collection. Original commit: elastic/x-pack-elasticsearch@a69bc18055cccf98e19571574a220dfe58dcad79 --- .../build.gradle | 2 +- .../qa/smoke-test-plugins-ssl/build.gradle | 14 ++--- .../SmokeTestMonitoringWithSecurityIT.java | 8 +-- .../20_settings_filter.yaml | 10 ++-- elasticsearch/x-pack/build.gradle | 2 +- .../xpack/monitoring/MonitoringSettings.java | 33 ++++++++---- .../agent/exporter/http/HttpExporter.java | 7 +-- .../xpack/monitoring/MonitoringF.java | 4 +- .../AbstractExporterTemplateTestCase.java | 2 +- .../agent/exporter/ExportersTests.java | 18 +++---- .../exporter/http/HttpExporterTests.java | 52 +++++++++---------- .../exporter/local/LocalExporterTests.java | 16 +++--- .../resolver/cluster/ClusterStateTests.java | 2 +- .../resolver/cluster/ClusterStatsTests.java | 2 +- .../resolver/indices/IndexRecoveryTests.java | 2 +- .../resolver/indices/IndexStatsTests.java | 2 +- .../resolver/indices/IndicesStatsTests.java | 2 +- .../resolver/node/MultiNodesStatsTests.java | 2 +- .../agent/resolver/node/NodeStatsTests.java | 2 +- .../agent/resolver/shards/ShardsTests.java | 2 +- .../local/LocalIndicesCleanerTests.java | 2 +- .../MonitoringSettingsFilterTests.java | 32 ++++++------ 22 files changed, 113 insertions(+), 105 deletions(-) diff --git a/elasticsearch/qa/smoke-test-monitoring-with-security/build.gradle b/elasticsearch/qa/smoke-test-monitoring-with-security/build.gradle index 5c9b4d832d6..da9d76bf26c 100644 --- a/elasticsearch/qa/smoke-test-monitoring-with-security/build.gradle +++ b/elasticsearch/qa/smoke-test-monitoring-with-security/build.gradle @@ -18,7 +18,7 @@ subprojects { cluster { systemProperty 'es.logger.level', 'TRACE' plugin 'x-pack', project(':x-plugins:elasticsearch:x-pack') - setting 'xpack.monitoring.agent.interval', '3s' + setting 'xpack.monitoring.collection.interval', '3s' extraConfigFile 'x-pack/roles.yml', '../roles.yml' setupCommand 'setupTestAdminUser', 'bin/x-pack/users', 'useradd', 'test_admin', '-p', 'changeme', '-r', 'superuser' diff --git a/elasticsearch/qa/smoke-test-plugins-ssl/build.gradle b/elasticsearch/qa/smoke-test-plugins-ssl/build.gradle index e2c6ace1b8b..fa3c5c588d3 100644 --- a/elasticsearch/qa/smoke-test-plugins-ssl/build.gradle +++ b/elasticsearch/qa/smoke-test-plugins-ssl/build.gradle @@ -153,13 +153,13 @@ project.rootProject.subprojects.findAll { it.path.startsWith(':plugins:') }.each integTest { cluster { - setting 'xpack.monitoring.agent.interval', '3s' - setting 'xpack.monitoring.agent.exporters._http.type', 'http' - setting 'xpack.monitoring.agent.exporters._http.enabled', 'false' - setting 'xpack.monitoring.agent.exporters._http.ssl.truststore.path', clientKeyStore.name - setting 'xpack.monitoring.agent.exporters._http.ssl.truststore.password', 'keypass' - setting 'xpack.monitoring.agent.exporters._http.auth.username', 'monitoring_agent' - setting 'xpack.monitoring.agent.exporters._http.auth.password', 'changeme' + setting 'xpack.monitoring.collection.interval', '3s' + setting 'xpack.monitoring.collection.exporters._http.type', 'http' + setting 'xpack.monitoring.collection.exporters._http.enabled', 'false' + setting 'xpack.monitoring.collection.exporters._http.ssl.truststore.path', clientKeyStore.name + setting 'xpack.monitoring.collection.exporters._http.ssl.truststore.password', 'keypass' + setting 'xpack.monitoring.collection.exporters._http.auth.username', 'monitoring_agent' + setting 'xpack.monitoring.collection.exporters._http.auth.password', 'changeme' setting 'xpack.security.transport.ssl.enabled', 'true' setting 'xpack.security.http.ssl.enabled', 'true' diff --git a/elasticsearch/qa/smoke-test-plugins-ssl/src/test/java/org/elasticsearch/smoketest/SmokeTestMonitoringWithSecurityIT.java b/elasticsearch/qa/smoke-test-plugins-ssl/src/test/java/org/elasticsearch/smoketest/SmokeTestMonitoringWithSecurityIT.java index 229d84bcae2..67be47776af 100644 --- a/elasticsearch/qa/smoke-test-plugins-ssl/src/test/java/org/elasticsearch/smoketest/SmokeTestMonitoringWithSecurityIT.java +++ b/elasticsearch/qa/smoke-test-plugins-ssl/src/test/java/org/elasticsearch/smoketest/SmokeTestMonitoringWithSecurityIT.java @@ -73,8 +73,8 @@ public class SmokeTestMonitoringWithSecurityIT extends ESIntegTestCase { URI uri = new URI("https", null, httpAddress.getHostString(), httpAddress.getPort(), "/", null, null); Settings exporterSettings = Settings.builder() - .put("xpack.monitoring.agent.exporters._http.enabled", true) - .put("xpack.monitoring.agent.exporters._http.host", uri.toString()) + .put("xpack.monitoring.collection.exporters._http.enabled", true) + .put("xpack.monitoring.collection.exporters._http.host", uri.toString()) .build(); assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(exporterSettings)); } @@ -82,8 +82,8 @@ public class SmokeTestMonitoringWithSecurityIT extends ESIntegTestCase { @After public void disableExporter() { Settings exporterSettings = Settings.builder() - .putNull("xpack.monitoring.agent.exporters._http.enabled") - .putNull("xpack.monitoring.agent.exporters._http.host") + .putNull("xpack.monitoring.collection.exporters._http.enabled") + .putNull("xpack.monitoring.collection.exporters._http.host") .build(); assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(exporterSettings)); } diff --git a/elasticsearch/qa/smoke-test-plugins-ssl/src/test/resources/rest-api-spec/test/smoke_test_plugins_ssl/20_settings_filter.yaml b/elasticsearch/qa/smoke-test-plugins-ssl/src/test/resources/rest-api-spec/test/smoke_test_plugins_ssl/20_settings_filter.yaml index b1b93edc116..a96b8b45786 100644 --- a/elasticsearch/qa/smoke-test-plugins-ssl/src/test/resources/rest-api-spec/test/smoke_test_plugins_ssl/20_settings_filter.yaml +++ b/elasticsearch/qa/smoke-test-plugins-ssl/src/test/resources/rest-api-spec/test/smoke_test_plugins_ssl/20_settings_filter.yaml @@ -11,9 +11,9 @@ metric: [ settings ] - is_true: nodes - - is_true: nodes.$master.settings.xpack.monitoring.agent.exporters._http.type + - is_true: nodes.$master.settings.xpack.monitoring.collection.exporters._http.type - - is_false: nodes.$master.settings.xpack.monitoring.agent.exporters._http.auth.username - - is_false: nodes.$master.settings.xpack.monitoring.agent.exporters._http.auth.password - - is_false: nodes.$master.settings.xpack.monitoring.agent.exporters._http.ssl.truststore.path - - is_false: nodes.$master.settings.xpack.monitoring.agent.exporters._http.ssl.truststore.password + - is_false: nodes.$master.settings.xpack.monitoring.collection.exporters._http.auth.username + - is_false: nodes.$master.settings.xpack.monitoring.collection.exporters._http.auth.password + - is_false: nodes.$master.settings.xpack.monitoring.collection.exporters._http.ssl.truststore.path + - is_false: nodes.$master.settings.xpack.monitoring.collection.exporters._http.ssl.truststore.password diff --git a/elasticsearch/x-pack/build.gradle b/elasticsearch/x-pack/build.gradle index 79e4af30e96..cdb38bf8425 100644 --- a/elasticsearch/x-pack/build.gradle +++ b/elasticsearch/x-pack/build.gradle @@ -133,7 +133,7 @@ integTest { // TODO: fix this rest test to not depend on a hardcoded port! systemProperty 'tests.rest.blacklist', 'getting_started/10_monitor_cluster_health/*,bulk/10_basic/*' cluster { - setting 'xpack.monitoring.agent.interval', '3s' + setting 'xpack.monitoring.collection.interval', '3s' waitCondition = { NodeInfo node, AntBuilder ant -> File tmpFile = new File(node.cwd, 'wait.success') for (int i = 0; i < 10; i++) { diff --git a/elasticsearch/x-pack/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/MonitoringSettings.java b/elasticsearch/x-pack/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/MonitoringSettings.java index 806070b2072..dc5f039b430 100644 --- a/elasticsearch/x-pack/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/MonitoringSettings.java +++ b/elasticsearch/x-pack/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/MonitoringSettings.java @@ -52,55 +52,55 @@ public class MonitoringSettings extends AbstractComponent { * Sampling interval between two collections (default to 10s) */ public static final Setting INTERVAL = - timeSetting(key("agent.interval"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope); + timeSetting(collectionKey("interval"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope); /** * Timeout value when collecting index statistics (default to 10m) */ public static final Setting INDEX_STATS_TIMEOUT = - timeSetting(key("agent.index.stats.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope); + timeSetting(collectionKey("index.stats.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope); /** * Timeout value when collecting total indices statistics (default to 10m) */ public static final Setting INDICES_STATS_TIMEOUT = - timeSetting(key("agent.indices.stats.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope); + timeSetting(collectionKey("indices.stats.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope); /** * List of indices names whose stats will be exported (default to all indices) */ public static final Setting> INDICES = - listSetting(key("agent.indices"), Collections.emptyList(), Function.identity(), Property.Dynamic, Property.NodeScope); + listSetting(collectionKey("indices"), Collections.emptyList(), Function.identity(), Property.Dynamic, Property.NodeScope); /** * Timeout value when collecting the cluster state (default to 10m) */ public static final Setting CLUSTER_STATE_TIMEOUT = - timeSetting(key("agent.cluster.state.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope); + timeSetting(collectionKey("cluster.state.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope); /** * Timeout value when collecting the recovery information (default to 10m) */ public static final Setting CLUSTER_STATS_TIMEOUT = - timeSetting(key("agent.cluster.stats.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope); + timeSetting(collectionKey("cluster.stats.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope); /** * Timeout value when collecting the recovery information (default to 10m) */ public static final Setting INDEX_RECOVERY_TIMEOUT = - timeSetting(key("agent.index.recovery.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope); + timeSetting(collectionKey("index.recovery.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope); /** * Flag to indicate if only active recoveries should be collected (default to false: all recoveries are collected) */ public static final Setting INDEX_RECOVERY_ACTIVE_ONLY = - boolSetting(key("agent.index.recovery.active_only"), false, Property.Dynamic, Property.NodeScope) ; + boolSetting(collectionKey("index.recovery.active_only"), false, Property.Dynamic, Property.NodeScope) ; /** * List of collectors allowed to collect data (default to all) */ public static final Setting> COLLECTORS = - listSetting(key("agent.collectors"), Collections.emptyList(), Function.identity(), Property.NodeScope); + listSetting(collectionKey("collectors"), Collections.emptyList(), Function.identity(), Property.NodeScope); /** * The default retention duration of the monitoring history data. @@ -123,7 +123,7 @@ public class MonitoringSettings extends AbstractComponent { * Settings/Options per configured exporter */ public static final Setting EXPORTERS_SETTINGS = - groupSetting(key("agent.exporters."), Property.Dynamic, Property.NodeScope); + groupSetting(collectionKey("exporters."), Property.Dynamic, Property.NodeScope); public static List> getSettings() { return Arrays.asList(INDICES, @@ -141,7 +141,7 @@ public class MonitoringSettings extends AbstractComponent { } public static List getSettingsFilter() { - return Arrays.asList("xpack.monitoring.agent.exporters.*.auth.*", "xpack.monitoring.agent.exporters.*.ssl.*"); + return Arrays.asList("xpack.monitoring.collection.exporters.*.auth.*", "xpack.monitoring.collection.exporters.*.ssl.*"); } @@ -227,6 +227,17 @@ public class MonitoringSettings extends AbstractComponent { this.indices = indices.toArray(new String[0]); } + /** + * Prefix the {@code key} with the Monitoring prefix and "collection." . + * + * @param key The key to prefix + * @return The key prefixed by the product prefixes + "collection." . + * @see #key(String) + */ + static String collectionKey(String key) { + return key("collection." + key); + } + /** * Prefix the {@code key} with the Monitoring prefix. * diff --git a/elasticsearch/x-pack/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/agent/exporter/http/HttpExporter.java b/elasticsearch/x-pack/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/agent/exporter/http/HttpExporter.java index e2bb090d295..14e340355c8 100644 --- a/elasticsearch/x-pack/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/agent/exporter/http/HttpExporter.java +++ b/elasticsearch/x-pack/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/agent/exporter/http/HttpExporter.java @@ -536,11 +536,8 @@ public class HttpExporter extends Exporter { for (String host : hosts) { try { HttpExporterUtils.parseHostWithPath(host, ""); - } catch (URISyntaxException e) { - throw new SettingsException("[xpack.monitoring.agent.exporter] invalid host: [" + host + "]." + - " error: [" + e.getMessage() + "]"); - } catch (MalformedURLException e) { - throw new SettingsException("[xpack.monitoring.agent.exporter] invalid host: [" + host + "]." + + } catch (URISyntaxException | MalformedURLException e) { + throw new SettingsException("[xpack.monitoring.collection.exporters] invalid host: [" + host + "]." + " error: [" + e.getMessage() + "]"); } } diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/MonitoringF.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/MonitoringF.java index 9c2a3aec6a4..e2b018975cb 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/MonitoringF.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/MonitoringF.java @@ -32,9 +32,9 @@ public class MonitoringF { settings.put("script.inline", "true"); settings.put("security.manager.enabled", "false"); settings.put("cluster.name", MonitoringF.class.getSimpleName()); - settings.put("xpack.monitoring.agent.interval", "5s"); + settings.put("xpack.monitoring.collection.interval", "1s"); if (!CollectionUtils.isEmpty(args)) { - settings.putArray("xpack.monitoring.agent.collectors", args); + settings.putArray("xpack.monitoring.collection.collectors", args); } final CountDownLatch latch = new CountDownLatch(1); diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/exporter/AbstractExporterTemplateTestCase.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/exporter/AbstractExporterTemplateTestCase.java index a0ce443e710..70c657b260f 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/exporter/AbstractExporterTemplateTestCase.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/exporter/AbstractExporterTemplateTestCase.java @@ -32,7 +32,7 @@ public abstract class AbstractExporterTemplateTestCase extends MonitoringIntegTe .put(MonitoringSettings.INTERVAL.getKey(), "-1"); for (Map.Entry setting : exporterSettings().getAsMap().entrySet()) { - settings.put("xpack.monitoring.agent.exporters._exporter." + setting.getKey(), setting.getValue()); + settings.put("xpack.monitoring.collection.exporters._exporter." + setting.getKey(), setting.getValue()); } return settings.build(); } diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/exporter/ExportersTests.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/exporter/ExportersTests.java index c9a9563feec..38a18b6a8e6 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/exporter/ExportersTests.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/exporter/ExportersTests.java @@ -176,8 +176,8 @@ public class ExportersTests extends ESTestCase { final AtomicReference settingsHolder = new AtomicReference<>(); Settings nodeSettings = Settings.builder() - .put("xpack.monitoring.agent.exporters._name0.type", "_type") - .put("xpack.monitoring.agent.exporters._name1.type", "_type") + .put("xpack.monitoring.collection.exporters._name0.type", "_type") + .put("xpack.monitoring.collection.exporters._name1.type", "_type") .build(); clusterSettings = new ClusterSettings(nodeSettings, new HashSet<>(Arrays.asList(MonitoringSettings.EXPORTERS_SETTINGS))); @@ -197,8 +197,8 @@ public class ExportersTests extends ESTestCase { assertThat(settings, hasEntry("_name1.type", "_type")); Settings update = Settings.builder() - .put("xpack.monitoring.agent.exporters._name0.foo", "bar") - .put("xpack.monitoring.agent.exporters._name1.foo", "bar") + .put("xpack.monitoring.collection.exporters._name0.foo", "bar") + .put("xpack.monitoring.collection.exporters._name1.foo", "bar") .build(); clusterSettings.applySettings(update); assertThat(settingsHolder.get(), notNullValue()); @@ -216,8 +216,8 @@ public class ExportersTests extends ESTestCase { factories.put("mock", factory); factories.put("mock_master_only", masterOnlyFactory); Exporters exporters = new Exporters(Settings.builder() - .put("xpack.monitoring.agent.exporters._name0.type", "mock") - .put("xpack.monitoring.agent.exporters._name1.type", "mock_master_only") + .put("xpack.monitoring.collection.exporters._name0.type", "mock") + .put("xpack.monitoring.collection.exporters._name1.type", "mock_master_only") .build(), factories, clusterService, clusterSettings); exporters.start(); @@ -241,8 +241,8 @@ public class ExportersTests extends ESTestCase { factories.put("mock", factory); factories.put("mock_master_only", masterOnlyFactory); Exporters exporters = new Exporters(Settings.builder() - .put("xpack.monitoring.agent.exporters._name0.type", "mock") - .put("xpack.monitoring.agent.exporters._name1.type", "mock_master_only") + .put("xpack.monitoring.collection.exporters._name0.type", "mock") + .put("xpack.monitoring.collection.exporters._name1.type", "mock_master_only") .build(), factories, clusterService, clusterSettings); exporters.start(); @@ -270,7 +270,7 @@ public class ExportersTests extends ESTestCase { logger.info("--> creating {} exporters", nbExporters); Settings.Builder settings = Settings.builder(); for (int i = 0; i < nbExporters; i++) { - settings.put("xpack.monitoring.agent.exporters._name" + String.valueOf(i) + ".type", "record"); + settings.put("xpack.monitoring.collection.exporters._name" + String.valueOf(i) + ".type", "record"); } Exporter.Factory factory = new CountingExportFactory("record", false); diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/exporter/http/HttpExporterTests.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/exporter/http/HttpExporterTests.java index 2e41597501f..9d5fd29023e 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/exporter/http/HttpExporterTests.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/exporter/http/HttpExporterTests.java @@ -95,10 +95,10 @@ public class HttpExporterTests extends MonitoringIntegTestCase { Settings.Builder builder = Settings.builder() .put(MonitoringSettings.INTERVAL.getKey(), "-1") - .put("xpack.monitoring.agent.exporters._http.type", "http") - .put("xpack.monitoring.agent.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort()) - .put("xpack.monitoring.agent.exporters._http.connection.keep_alive", false) - .put("xpack.monitoring.agent.exporters._http.update_mappings", false); + .put("xpack.monitoring.collection.exporters._http.type", "http") + .put("xpack.monitoring.collection.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort()) + .put("xpack.monitoring.collection.exporters._http.connection.keep_alive", false) + .put("xpack.monitoring.collection.exporters._http.update_mappings", false); internalCluster().startNode(builder); @@ -133,23 +133,23 @@ public class HttpExporterTests extends MonitoringIntegTestCase { // disable exporting to be able to use non valid hosts Settings.Builder builder = Settings.builder() .put(MonitoringSettings.INTERVAL.getKey(), "-1") - .put("xpack.monitoring.agent.exporters._http.type", "http") - .put("xpack.monitoring.agent.exporters._http.host", "test0"); + .put("xpack.monitoring.collection.exporters._http.type", "http") + .put("xpack.monitoring.collection.exporters._http.host", "test0"); String nodeName = internalCluster().startNode(builder); assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder() - .putArray("xpack.monitoring.agent.exporters._http.host", "test1"))); + .putArray("xpack.monitoring.collection.exporters._http.host", "test1"))); assertThat(getExporter(nodeName).hosts, Matchers.arrayContaining("test1")); // wipes the non array settings assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder() - .putArray("xpack.monitoring.agent.exporters._http.host", "test2") - .put("xpack.monitoring.agent.exporters._http.host", ""))); + .putArray("xpack.monitoring.collection.exporters._http.host", "test2") + .put("xpack.monitoring.collection.exporters._http.host", ""))); assertThat(getExporter(nodeName).hosts, Matchers.arrayContaining("test2")); assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder() - .putArray("xpack.monitoring.agent.exporters._http.host", "test3"))); + .putArray("xpack.monitoring.collection.exporters._http.host", "test3"))); assertThat(getExporter(nodeName).hosts, Matchers.arrayContaining("test3")); } @@ -157,10 +157,10 @@ public class HttpExporterTests extends MonitoringIntegTestCase { Settings.Builder builder = Settings.builder() .put(MonitoringSettings.INTERVAL.getKey(), "-1") - .put("xpack.monitoring.agent.exporters._http.type", "http") - .put("xpack.monitoring.agent.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort()) - .put("xpack.monitoring.agent.exporters._http.connection.keep_alive", false) - .put("xpack.monitoring.agent.exporters._http.update_mappings", false); + .put("xpack.monitoring.collection.exporters._http.type", "http") + .put("xpack.monitoring.collection.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort()) + .put("xpack.monitoring.collection.exporters._http.connection.keep_alive", false) + .put("xpack.monitoring.collection.exporters._http.update_mappings", false); logger.info("--> starting node"); @@ -221,7 +221,7 @@ public class HttpExporterTests extends MonitoringIntegTestCase { assertNotNull("Unable to start the second mock web server", secondWebServer); assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings( - Settings.builder().putArray("xpack.monitoring.agent.exporters._http.host", + Settings.builder().putArray("xpack.monitoring.collection.exporters._http.host", secondWebServer.getHostName() + ":" + secondWebServer.getPort())).get()); // a new exporter is created on update, so we need to re-fetch it @@ -274,9 +274,9 @@ public class HttpExporterTests extends MonitoringIntegTestCase { public void testUnsupportedClusterVersion() throws Exception { Settings.Builder builder = Settings.builder() .put(MonitoringSettings.INTERVAL.getKey(), "-1") - .put("xpack.monitoring.agent.exporters._http.type", "http") - .put("xpack.monitoring.agent.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort()) - .put("xpack.monitoring.agent.exporters._http.connection.keep_alive", false); + .put("xpack.monitoring.collection.exporters._http.type", "http") + .put("xpack.monitoring.collection.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort()) + .put("xpack.monitoring.collection.exporters._http.connection.keep_alive", false); logger.info("--> starting node"); @@ -302,10 +302,10 @@ public class HttpExporterTests extends MonitoringIntegTestCase { public void testDynamicIndexFormatChange() throws Exception { Settings.Builder builder = Settings.builder() .put(MonitoringSettings.INTERVAL.getKey(), "-1") - .put("xpack.monitoring.agent.exporters._http.type", "http") - .put("xpack.monitoring.agent.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort()) - .put("xpack.monitoring.agent.exporters._http.connection.keep_alive", false) - .put("xpack.monitoring.agent.exporters._http.update_mappings", false); + .put("xpack.monitoring.collection.exporters._http.type", "http") + .put("xpack.monitoring.collection.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort()) + .put("xpack.monitoring.collection.exporters._http.connection.keep_alive", false) + .put("xpack.monitoring.collection.exporters._http.update_mappings", false); String agentNode = internalCluster().startNode(builder); @@ -356,7 +356,7 @@ public class HttpExporterTests extends MonitoringIntegTestCase { String newTimeFormat = randomFrom("YY", "YYYY", "YYYY.MM", "YYYY-MM", "MM.YYYY", "MM"); logger.info("--> updating index time format setting to {}", newTimeFormat); assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder() - .put("xpack.monitoring.agent.exporters._http.index.name.time_format", newTimeFormat))); + .put("xpack.monitoring.collection.exporters._http.index.name.time_format", newTimeFormat))); logger.info("--> exporting a second event"); @@ -402,9 +402,9 @@ public class HttpExporterTests extends MonitoringIntegTestCase { Settings.Builder builder = Settings.builder() .put(MonitoringSettings.INTERVAL.getKey(), "-1") - .put("xpack.monitoring.agent.exporters._http.type", "http") - .put("xpack.monitoring.agent.exporters._http.host", host) - .put("xpack.monitoring.agent.exporters._http.connection.keep_alive", false); + .put("xpack.monitoring.collection.exporters._http.type", "http") + .put("xpack.monitoring.collection.exporters._http.host", host) + .put("xpack.monitoring.collection.exporters._http.connection.keep_alive", false); String agentNode = internalCluster().startNode(builder); HttpExporter exporter = getExporter(agentNode); diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/exporter/local/LocalExporterTests.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/exporter/local/LocalExporterTests.java index e75abdbec94..a3e67d97930 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/exporter/local/LocalExporterTests.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/exporter/local/LocalExporterTests.java @@ -65,8 +65,8 @@ public class LocalExporterTests extends MonitoringIntegTestCase { public void testSimpleExport() throws Exception { internalCluster().startNode(Settings.builder() - .put("xpack.monitoring.agent.exporters._local.type", LocalExporter.TYPE) - .put("xpack.monitoring.agent.exporters._local.enabled", true) + .put("xpack.monitoring.collection.exporters._local.type", LocalExporter.TYPE) + .put("xpack.monitoring.collection.exporters._local.enabled", true) .build()); securedEnsureGreen(); @@ -96,7 +96,7 @@ public class LocalExporterTests extends MonitoringIntegTestCase { public void testTemplateCreation() throws Exception { internalCluster().startNode(Settings.builder() - .put("xpack.monitoring.agent.exporters._local.type", LocalExporter.TYPE) + .put("xpack.monitoring.collection.exporters._local.type", LocalExporter.TYPE) .build()); securedEnsureGreen(); @@ -111,8 +111,8 @@ public class LocalExporterTests extends MonitoringIntegTestCase { String timeFormat = randomFrom("YY", "YYYY", "YYYY.MM", "YYYY-MM", "MM.YYYY", "MM"); internalCluster().startNode(Settings.builder() - .put("xpack.monitoring.agent.exporters._local.type", LocalExporter.TYPE) - .put("xpack.monitoring.agent.exporters._local." + LocalExporter.INDEX_NAME_TIME_FORMAT_SETTING, timeFormat) + .put("xpack.monitoring.collection.exporters._local.type", LocalExporter.TYPE) + .put("xpack.monitoring.collection.exporters._local." + LocalExporter.INDEX_NAME_TIME_FORMAT_SETTING, timeFormat) .build()); securedEnsureGreen(); @@ -130,7 +130,7 @@ public class LocalExporterTests extends MonitoringIntegTestCase { logger.debug("--> updates the timestamp"); timeFormat = randomFrom("dd", "dd.MM.YYYY", "dd.MM"); - updateClusterSettings(Settings.builder().put("xpack.monitoring.agent.exporters._local.index.name.time_format", timeFormat)); + updateClusterSettings(Settings.builder().put("xpack.monitoring.collection.exporters._local.index.name.time_format", timeFormat)); exporter = getLocalExporter("_local"); // we need to get it again.. as it was rebuilt indexName = ".monitoring-es-" + MonitoringTemplateUtils.TEMPLATE_VERSION + "-" + DateTimeFormat.forPattern(timeFormat).withZoneUTC().print(doc.getTimestamp()); @@ -144,8 +144,8 @@ public class LocalExporterTests extends MonitoringIntegTestCase { public void testLocalExporterFlush() throws Exception { internalCluster().startNode(Settings.builder() - .put("xpack.monitoring.agent.exporters._local.type", LocalExporter.TYPE) - .put("xpack.monitoring.agent.exporters._local.enabled", true) + .put("xpack.monitoring.collection.exporters._local.type", LocalExporter.TYPE) + .put("xpack.monitoring.collection.exporters._local.enabled", true) .build()); securedEnsureGreen(); diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/cluster/ClusterStateTests.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/cluster/ClusterStateTests.java index 68431bb3209..cb9d317eaa8 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/cluster/ClusterStateTests.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/cluster/ClusterStateTests.java @@ -44,7 +44,7 @@ public class ClusterStateTests extends MonitoringIntegTestCase { .put(super.nodeSettings(nodeOrdinal)) .put(MonitoringSettings.INTERVAL.getKey(), "-1") .put(MonitoringSettings.COLLECTORS.getKey(), ClusterStateCollector.NAME) - .put("xpack.monitoring.agent.exporters.default_local.type", "local") + .put("xpack.monitoring.collection.exporters.default_local.type", "local") .put("node.attr.custom", randomInt) .build(); } diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/cluster/ClusterStatsTests.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/cluster/ClusterStatsTests.java index a965e2bb71e..a2a591a7cf9 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/cluster/ClusterStatsTests.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/cluster/ClusterStatsTests.java @@ -32,7 +32,7 @@ public class ClusterStatsTests extends MonitoringIntegTestCase { .put(super.nodeSettings(nodeOrdinal)) .put(MonitoringSettings.INTERVAL.getKey(), "-1") .put(MonitoringSettings.COLLECTORS.getKey(), ClusterStatsCollector.NAME) - .put("xpack.monitoring.agent.exporters.default_local.type", "local") + .put("xpack.monitoring.collection.exporters.default_local.type", "local") .build(); } diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/indices/IndexRecoveryTests.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/indices/IndexRecoveryTests.java index 45f2d48168d..b4656ba24ef 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/indices/IndexRecoveryTests.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/indices/IndexRecoveryTests.java @@ -38,7 +38,7 @@ public class IndexRecoveryTests extends MonitoringIntegTestCase { .put(MonitoringSettings.INTERVAL.getKey(), "-1") .put(MonitoringSettings.INDICES.getKey(), INDEX_PREFIX + "*") .put(MonitoringSettings.COLLECTORS.getKey(), IndexRecoveryCollector.NAME) - .put("xpack.monitoring.agent.exporters.default_local.type", "local") + .put("xpack.monitoring.collection.exporters.default_local.type", "local") .build(); } diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/indices/IndexStatsTests.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/indices/IndexStatsTests.java index 76f439e0e0c..d8441c6dbe3 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/indices/IndexStatsTests.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/indices/IndexStatsTests.java @@ -30,7 +30,7 @@ public class IndexStatsTests extends MonitoringIntegTestCase { .put(super.nodeSettings(nodeOrdinal)) .put(MonitoringSettings.INTERVAL.getKey(), "-1") .put(MonitoringSettings.COLLECTORS.getKey(), IndexStatsCollector.NAME) - .put("xpack.monitoring.agent.exporters.default_local.type", "local") + .put("xpack.monitoring.collection.exporters.default_local.type", "local") .build(); } diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/indices/IndicesStatsTests.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/indices/IndicesStatsTests.java index bce40dc9f86..d2f7ce45ea2 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/indices/IndicesStatsTests.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/indices/IndicesStatsTests.java @@ -30,7 +30,7 @@ public class IndicesStatsTests extends MonitoringIntegTestCase { .put(super.nodeSettings(nodeOrdinal)) .put(MonitoringSettings.INTERVAL.getKey(), "-1") .put(MonitoringSettings.COLLECTORS.getKey(), IndicesStatsCollector.NAME) - .put("xpack.monitoring.agent.exporters.default_local.type", "local") + .put("xpack.monitoring.collection.exporters.default_local.type", "local") .build(); } diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/node/MultiNodesStatsTests.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/node/MultiNodesStatsTests.java index c08af158d9b..f452d6cb9f4 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/node/MultiNodesStatsTests.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/node/MultiNodesStatsTests.java @@ -35,7 +35,7 @@ public class MultiNodesStatsTests extends MonitoringIntegTestCase { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put(MonitoringSettings.INTERVAL.getKey(), "-1") - .put("xpack.monitoring.agent.exporters.default_local.type", "local") + .put("xpack.monitoring.collection.exporters.default_local.type", "local") .build(); } diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/node/NodeStatsTests.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/node/NodeStatsTests.java index 867423fa29e..d071f67dc51 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/node/NodeStatsTests.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/node/NodeStatsTests.java @@ -33,7 +33,7 @@ public class NodeStatsTests extends MonitoringIntegTestCase { .put(super.nodeSettings(nodeOrdinal)) .put(MonitoringSettings.INTERVAL.getKey(), "-1") .put(MonitoringSettings.COLLECTORS.getKey(), NodeStatsCollector.NAME) - .put("xpack.monitoring.agent.exporters.default_local.type", LocalExporter.TYPE) + .put("xpack.monitoring.collection.exporters.default_local.type", LocalExporter.TYPE) .build(); } diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/shards/ShardsTests.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/shards/ShardsTests.java index d1cb30ee4b7..27a456d0b0d 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/shards/ShardsTests.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/shards/ShardsTests.java @@ -46,7 +46,7 @@ public class ShardsTests extends MonitoringIntegTestCase { .put(MonitoringSettings.INTERVAL.getKey(), "-1") .put(MonitoringSettings.COLLECTORS.getKey(), ShardsCollector.NAME) .put(MonitoringSettings.INDICES.getKey(), INDEX_PREFIX + "*") - .put("xpack.monitoring.agent.exporters.default_local.type", "local") + .put("xpack.monitoring.collection.exporters.default_local.type", "local") .build(); } diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/cleaner/local/LocalIndicesCleanerTests.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/cleaner/local/LocalIndicesCleanerTests.java index ff56bb9fd11..7a5df1ab5db 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/cleaner/local/LocalIndicesCleanerTests.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/cleaner/local/LocalIndicesCleanerTests.java @@ -33,7 +33,7 @@ public class LocalIndicesCleanerTests extends AbstractIndicesCleanerTestCase { protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - .put("xpack.monitoring.agent.exporters._local.type", LocalExporter.TYPE) + .put("xpack.monitoring.collection.exporters._local.type", LocalExporter.TYPE) .build(); } diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/security/MonitoringSettingsFilterTests.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/security/MonitoringSettingsFilterTests.java index c6603f67969..08f98a20822 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/security/MonitoringSettingsFilterTests.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/security/MonitoringSettingsFilterTests.java @@ -14,7 +14,6 @@ import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.xpack.monitoring.MonitoringSettings; import org.elasticsearch.xpack.monitoring.test.MonitoringIntegTestCase; import org.elasticsearch.xpack.security.authc.support.SecuredString; -import org.hamcrest.Matchers; import java.util.Collections; import java.util.Map; @@ -22,7 +21,8 @@ import java.util.Map; import static org.elasticsearch.common.xcontent.support.XContentMapValues.extractValue; import static org.elasticsearch.xpack.security.authc.support.UsernamePasswordToken.BASIC_AUTH_HEADER; import static org.elasticsearch.xpack.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue; -import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.Matchers.nullValue; +import static org.hamcrest.Matchers.equalTo; public class MonitoringSettingsFilterTests extends MonitoringIntegTestCase { @@ -32,13 +32,13 @@ public class MonitoringSettingsFilterTests extends MonitoringIntegTestCase { .put(super.nodeSettings(nodeOrdinal)) .put(NetworkModule.HTTP_ENABLED.getKey(), true) .put(MonitoringSettings.INTERVAL.getKey(), "-1") - .put("xpack.monitoring.agent.exporters._http.type", "http") - .put("xpack.monitoring.agent.exporters._http.enabled", false) - .put("xpack.monitoring.agent.exporters._http.auth.username", "_user") - .put("xpack.monitoring.agent.exporters._http.auth.password", "_passwd") - .put("xpack.monitoring.agent.exporters._http.ssl.truststore.path", "/path/to/truststore") - .put("xpack.monitoring.agent.exporters._http.ssl.truststore.password", "_passwd") - .put("xpack.monitoring.agent.exporters._http.ssl.hostname_verification", true) + .put("xpack.monitoring.collection.exporters._http.type", "http") + .put("xpack.monitoring.collection.exporters._http.enabled", false) + .put("xpack.monitoring.collection.exporters._http.auth.username", "_user") + .put("xpack.monitoring.collection.exporters._http.auth.password", "_passwd") + .put("xpack.monitoring.collection.exporters._http.ssl.truststore.path", "/path/to/truststore") + .put("xpack.monitoring.collection.exporters._http.ssl.truststore.password", "_passwd") + .put("xpack.monitoring.collection.exporters._http.ssl.hostname_verification", true) .build(); } @@ -60,13 +60,13 @@ public class MonitoringSettingsFilterTests extends MonitoringIntegTestCase { for (Object node : nodes.values()) { @SuppressWarnings("unchecked") Map settings = (Map) ((Map) node).get("settings"); - assertThat(extractValue("xpack.monitoring.agent.exporters._http.type", settings), Matchers.equalTo("http")); - assertThat(extractValue("xpack.monitoring.agent.exporters._http.enabled", settings), Matchers.equalTo("false")); - assertNullSetting(settings, "xpack.monitoring.agent.exporters._http.auth.username"); - assertNullSetting(settings, "xpack.monitoring.agent.exporters._http.auth.password"); - assertNullSetting(settings, "xpack.monitoring.agent.exporters._http.ssl.truststore.path"); - assertNullSetting(settings, "xpack.monitoring.agent.exporters._http.ssl.truststore.password"); - assertNullSetting(settings, "xpack.monitoring.agent.exporters._http.ssl.hostname_verification"); + assertThat(extractValue("xpack.monitoring.collection.exporters._http.type", settings), equalTo("http")); + assertThat(extractValue("xpack.monitoring.collection.exporters._http.enabled", settings), equalTo("false")); + assertNullSetting(settings, "xpack.monitoring.collection.exporters._http.auth.username"); + assertNullSetting(settings, "xpack.monitoring.collection.exporters._http.auth.password"); + assertNullSetting(settings, "xpack.monitoring.collection.exporters._http.ssl.truststore.path"); + assertNullSetting(settings, "xpack.monitoring.collection.exporters._http.ssl.truststore.password"); + assertNullSetting(settings, "xpack.monitoring.collection.exporters._http.ssl.hostname_verification"); } } }