diff --git a/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/GroovyScriptConditionIT.java b/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/GroovyScriptConditionIT.java index dd1d2e13c6b..076ca34737f 100644 --- a/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/GroovyScriptConditionIT.java +++ b/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/GroovyScriptConditionIT.java @@ -65,18 +65,18 @@ public class GroovyScriptConditionIT extends AbstractWatcherIntegrationTestCase } public void testGroovyClosureWithAggregations() throws Exception { - client().admin().indices().prepareCreate(".marvel") + client().admin().indices().prepareCreate(".monitoring") .addMapping("cluster_stats", "_timestamp", "enabled=true") .get(); for (int seconds = 0; seconds < 60; seconds += 5) { - client().prepareIndex(".marvel", "cluster_stats").setTimestamp("2005-01-01T00:00:" + + client().prepareIndex(".monitoring", "cluster_stats").setTimestamp("2005-01-01T00:00:" + String.format(Locale.ROOT, "%02d", seconds)).setSource("status", randomFrom("green", "yellow")).get(); } refresh(); - SearchRequestBuilder builder = client().prepareSearch(".marvel") + SearchRequestBuilder builder = client().prepareSearch(".monitoring") .addAggregation( AggregationBuilders .dateHistogram("minutes").field("_timestamp").interval(TimeUnit.MILLISECONDS.convert(5, TimeUnit.SECONDS)) @@ -100,7 +100,7 @@ public class GroovyScriptConditionIT extends AbstractWatcherIntegrationTestCase assertFalse(condition.execute(unmetContext).met()); for (int seconds = 0; seconds < 60; seconds += 5) { - client().prepareIndex(".marvel", "cluster_stats").setTimestamp("2005-01-01T00:01:" + + client().prepareIndex(".monitoring", "cluster_stats").setTimestamp("2005-01-01T00:01:" + String.format(Locale.ROOT, "%02d", seconds)).setSource("status", randomFrom("red")).get(); } diff --git a/elasticsearch/qa/shield-core-rest-tests/build.gradle b/elasticsearch/qa/shield-core-rest-tests/build.gradle index d8f665fa54d..3e8c4bf42f1 100644 --- a/elasticsearch/qa/shield-core-rest-tests/build.gradle +++ b/elasticsearch/qa/shield-core-rest-tests/build.gradle @@ -33,7 +33,7 @@ integTest { cluster { plugin 'x-pack', project(':x-plugins:elasticsearch:x-pack') systemProperty 'es.xpack.watcher.enabled', 'false' - systemProperty 'es.xpack.marvel.enabled', 'false' + systemProperty 'es.xpack.monitoring.enabled', 'false' setupCommand 'setupDummyUser', 'bin/xpack/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin' waitCondition = { node, ant -> diff --git a/elasticsearch/qa/smoke-test-found-license-with-shield-and-watcher/src/test/java/org/elasticsearch/smoketest/MarvelClusterInfoIT.java b/elasticsearch/qa/smoke-test-found-license-with-shield-and-watcher/src/test/java/org/elasticsearch/smoketest/MarvelClusterInfoIT.java index 0dd8bf5dde5..6c4fe7c80e1 100644 --- a/elasticsearch/qa/smoke-test-found-license-with-shield-and-watcher/src/test/java/org/elasticsearch/smoketest/MarvelClusterInfoIT.java +++ b/elasticsearch/qa/smoke-test-found-license-with-shield-and-watcher/src/test/java/org/elasticsearch/smoketest/MarvelClusterInfoIT.java @@ -43,11 +43,11 @@ public class MarvelClusterInfoIT extends ESIntegTestCase { public void testMarvelClusterInfoCollectorWorks() throws Exception { final String clusterUUID = client().admin().cluster().prepareState().setMetaData(true).get().getState().metaData().clusterUUID(); assertTrue(Strings.hasText(clusterUUID)); - awaitIndexExists(".marvel-es-data"); - ensureYellow(".marvel-es-data"); + awaitIndexExists(".monitoring-es-data"); + ensureYellow(".monitoring-es-data"); awaitMarvelDocsCount(equalTo(1L), "cluster_info"); - GetResponse response = client().prepareGet(".marvel-es-data", "cluster_info", clusterUUID).get(); - assertTrue(".marvel-es-data" + " document does not exist", response.isExists()); + GetResponse response = client().prepareGet(".monitoring-es-data", "cluster_info", clusterUUID).get(); + assertTrue(".monitoring-es-data" + " document does not exist", response.isExists()); Map source = response.getSource(); assertThat((String) source.get("cluster_name"), equalTo(cluster().getClusterName())); assertThat((String) source.get("version"), equalTo(Version.CURRENT.toString())); @@ -69,7 +69,7 @@ public class MarvelClusterInfoIT extends ESIntegTestCase { protected void assertMarvelDocsCount(Matcher matcher, String... types) { try { - long count = client().prepareSearch(".marvel-es-data").setSize(0) + long count = client().prepareSearch(".monitoring-es-data").setSize(0) .setTypes(types).get().getHits().totalHits(); logger.trace("--> searched for [{}] documents, found [{}]", Strings.arrayToCommaDelimitedString(types), count); assertThat(count, matcher); diff --git a/elasticsearch/qa/smoke-test-plugins-ssl/build.gradle b/elasticsearch/qa/smoke-test-plugins-ssl/build.gradle index 4d69d06a877..abbfeff887d 100644 --- a/elasticsearch/qa/smoke-test-plugins-ssl/build.gradle +++ b/elasticsearch/qa/smoke-test-plugins-ssl/build.gradle @@ -46,8 +46,10 @@ project.rootProject.subprojects.findAll { it.path.startsWith(':plugins:') }.each integTest { cluster { systemProperty 'es.network.host', host - systemProperty 'es.marvel.agent.exporter.es.ssl.truststore.path', keystore.name - systemProperty 'es.marvel.agent.exporter.es.ssl.truststore.password', 'keypass' + systemProperty 'es.xpack.monitoring.agent.exporters.es.type', 'http' + systemProperty 'es.xpack.monitoring.agent.exporters.es.enabled', 'false' + systemProperty 'es.xpack.monitoring.agent.exporters.es.ssl.truststore.path', keystore.name + systemProperty 'es.xpack.monitoring.agent.exporters.es.ssl.truststore.password', 'keypass' systemProperty 'es.shield.transport.ssl', 'true' systemProperty 'es.shield.http.ssl', 'true' systemProperty 'es.shield.ssl.keystore.path', keystore.name diff --git a/elasticsearch/qa/smoke-test-watcher-with-groovy/build.gradle b/elasticsearch/qa/smoke-test-watcher-with-groovy/build.gradle index 2ef0ad729f0..eb357005ccc 100644 --- a/elasticsearch/qa/smoke-test-watcher-with-groovy/build.gradle +++ b/elasticsearch/qa/smoke-test-watcher-with-groovy/build.gradle @@ -10,6 +10,6 @@ integTest { plugin 'x-pack', project(':x-plugins:elasticsearch:x-pack') systemProperty 'es.script.inline', 'true' systemProperty 'es.xpack.shield.enabled', 'false' - systemProperty 'es.xpack.marvel.enabled', 'false' + systemProperty 'es.xpack.monitoring.enabled', 'false' } } diff --git a/elasticsearch/qa/smoke-test-watcher-with-mustache/build.gradle b/elasticsearch/qa/smoke-test-watcher-with-mustache/build.gradle index e34b6981b8c..efef108a36d 100644 --- a/elasticsearch/qa/smoke-test-watcher-with-mustache/build.gradle +++ b/elasticsearch/qa/smoke-test-watcher-with-mustache/build.gradle @@ -9,7 +9,7 @@ integTest { cluster { plugin 'x-pack', project(':x-plugins:elasticsearch:x-pack') systemProperty 'es.xpack.shield.enabled', 'false' - systemProperty 'es.xpack.marvel.enabled', 'false' + systemProperty 'es.xpack.monitoring.enabled', 'false' systemProperty 'es.http.port', '9400' } } diff --git a/elasticsearch/x-pack/build.gradle b/elasticsearch/x-pack/build.gradle index 1b074b11b05..de7d22bf159 100644 --- a/elasticsearch/x-pack/build.gradle +++ b/elasticsearch/x-pack/build.gradle @@ -72,10 +72,8 @@ compileTestJava.options.compilerArgs << "-Xlint:-deprecation,-rawtypes,-serial,- ext.expansions = [ 'project.version': version, // Used in marvel index templates - 'marvel.plugin.version': version, - 'marvel.template.version': '1', - // Used in watcher index template - 'watcher.plugin.version': version, + 'monitoring.template.version': '1', + // Used in watcher index templates 'watcher.template.version': '1', ] diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/Marvel.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/Marvel.java index d3436e64086..4f8588c92c7 100644 --- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/Marvel.java +++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/Marvel.java @@ -18,8 +18,6 @@ import org.elasticsearch.marvel.agent.collector.CollectorModule; import org.elasticsearch.marvel.agent.exporter.ExporterModule; import org.elasticsearch.marvel.agent.exporter.Exporters; import org.elasticsearch.marvel.agent.renderer.RendererModule; -import org.elasticsearch.marvel.agent.settings.MarvelModule; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; import org.elasticsearch.marvel.cleaner.CleanerService; import org.elasticsearch.marvel.license.LicenseModule; import org.elasticsearch.marvel.license.MarvelLicensee; @@ -36,12 +34,7 @@ public class Marvel { private static final ESLogger logger = Loggers.getLogger(XPackPlugin.class); - public static final String NAME = "marvel"; - public static final Setting INDEX_MARVEL_VERSION_SETTING = - new Setting<>("index.marvel.plugin.version", "", Function.identity(), false, Setting.Scope.INDEX); - public static final Setting INDEX_MARVEL_TEMPLATE_VERSION_SETTING = - new Setting<>("index.marvel.template.version", "", Function.identity(), false, Setting.Scope.INDEX); - public static final String TRIBE_NAME_SETTING = "tribe.name"; + public static final String NAME = "monitoring"; private final Settings settings; private final boolean enabled; @@ -51,14 +44,6 @@ public class Marvel { this.enabled = enabled(settings); } - public String name() { - return NAME; - } - - public String description() { - return "Elasticsearch Marvel"; - } - boolean isEnabled() { return enabled; } @@ -87,49 +72,13 @@ public class Marvel { public static boolean enabled(Settings settings) { if ("node".equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey())) == false) { - logger.trace("marvel cannot be started on a transport client"); + logger.trace("monitoring cannot be started on a transport client"); return false; } - // By default, marvel is disabled on tribe nodes - return settings.getAsBoolean(XPackPlugin.featureEnabledSetting(Marvel.NAME), - !isTribeNode(settings) && !isTribeClientNode(settings)); - } - - static boolean isTribeNode(Settings settings) { - if (settings.getGroups("tribe", true).isEmpty() == false) { - logger.trace("detecting tribe node"); - return true; - } - return false; - } - - static boolean isTribeClientNode(Settings settings) { - String tribeName = settings.get(TRIBE_NAME_SETTING); - if (tribeName != null) { - logger.trace("detecting tribe client node [{}]", tribeName); - return true; - } - return false; + return MarvelSettings.ENABLED.get(settings); } public void onModule(SettingsModule module) { - module.registerSetting(Exporters.EXPORTERS_SETTING); - module.registerSetting(MarvelSettings.INDICES_SETTING); - module.registerSetting(MarvelSettings.INTERVAL_SETTING); - module.registerSetting(MarvelSettings.INDEX_RECOVERY_TIMEOUT_SETTING); - module.registerSetting(MarvelSettings.INDEX_STATS_TIMEOUT_SETTING); - module.registerSetting(MarvelSettings.INDICES_STATS_TIMEOUT_SETTING); - module.registerSetting(MarvelSettings.INDEX_RECOVERY_ACTIVE_ONLY_SETTING); - module.registerSetting(MarvelSettings.COLLECTORS_SETTING); - module.registerSetting(MarvelSettings.CLUSTER_STATE_TIMEOUT_SETTING); - module.registerSetting(MarvelSettings.CLUSTER_STATS_TIMEOUT_SETTING); - module.registerSetting(CleanerService.HISTORY_SETTING); - module.registerSetting(INDEX_MARVEL_VERSION_SETTING); - module.registerSetting(INDEX_MARVEL_TEMPLATE_VERSION_SETTING); - // TODO convert these settings to where they belong - module.registerSetting(Setting.simpleString("marvel.agent.exporter.es.ssl.truststore.password", false, Setting.Scope.CLUSTER)); - module.registerSetting(Setting.simpleString("marvel.agent.exporter.es.ssl.truststore.path", false, Setting.Scope.CLUSTER)); - module.registerSetting(Setting.boolSetting(XPackPlugin.featureEnabledSetting(Marvel.NAME), true, false, Setting.Scope.CLUSTER)); - module.registerSettingsFilter("marvel.agent.exporters.*.auth.password"); + MarvelSettings.register(module); } } diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/settings/MarvelModule.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/MarvelModule.java similarity index 93% rename from elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/settings/MarvelModule.java rename to elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/MarvelModule.java index 55d6078e8ba..c5125da6c2c 100644 --- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/settings/MarvelModule.java +++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/MarvelModule.java @@ -3,7 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.marvel.agent.settings; +package org.elasticsearch.marvel; import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.marvel.agent.AgentService; diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/MarvelSettings.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/MarvelSettings.java new file mode 100644 index 00000000000..8b5e59f2840 --- /dev/null +++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/MarvelSettings.java @@ -0,0 +1,220 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +package org.elasticsearch.marvel; + +import org.elasticsearch.common.Booleans; +import org.elasticsearch.common.component.AbstractComponent; +import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.settings.ClusterSettings; +import org.elasticsearch.common.settings.Setting; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.SettingsModule; +import org.elasticsearch.common.unit.TimeValue; +import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils; +import org.elasticsearch.xpack.XPackPlugin; + +import java.util.Collections; +import java.util.List; +import java.util.function.Function; + +public class MarvelSettings extends AbstractComponent { + + public static final String MONITORING_INDICES_PREFIX = ".monitoring-es-"; + public static final String MONITORING_DATA_INDEX_PREFIX = ".monitoring-es-data-"; + public static final String HISTORY_DURATION_SETTING_NAME = "history.duration"; + public static final TimeValue MAX_LICENSE_GRACE_PERIOD = TimeValue.timeValueHours(7 * 24); + + /** + * Determines whether monitoring is enabled/disabled + */ + public static final Setting ENABLED = + new Setting<>(XPackPlugin.featureEnabledSetting(Marvel.NAME), + + // By default, marvel is disabled on tribe nodes + (s) -> String.valueOf(!XPackPlugin.isTribeNode(s) && !XPackPlugin.isTribeClientNode(s)), + + Booleans::parseBooleanExact, + false, + Setting.Scope.CLUSTER); + + /** + * Sampling interval between two collections (default to 10s) + */ + public static final Setting INTERVAL = + Setting.timeSetting(key("agent.interval"), TimeValue.timeValueSeconds(10), true, Setting.Scope.CLUSTER); + + /** + * Timeout value when collecting index statistics (default to 10m) + */ + public static final Setting INDEX_STATS_TIMEOUT = + Setting.timeSetting(key("agent.index.stats.timeout"), TimeValue.timeValueSeconds(10), true, Setting.Scope.CLUSTER); + + /** + * Timeout value when collecting total indices statistics (default to 10m) + */ + public static final Setting INDICES_STATS_TIMEOUT = + Setting.timeSetting(key("agent.indices.stats.timeout"), TimeValue.timeValueSeconds(10), true, Setting.Scope.CLUSTER); + + /** + * List of indices names whose stats will be exported (default to all indices) + */ + public static final Setting> INDICES = + Setting.listSetting(key("agent.indices"), Collections.emptyList(), Function.identity(), true, Setting.Scope.CLUSTER); + + /** + * Timeout value when collecting the cluster state (default to 10m) + */ + public static final Setting CLUSTER_STATE_TIMEOUT = + Setting.timeSetting(key("agent.cluster.state.timeout"), TimeValue.timeValueSeconds(10), true, Setting.Scope.CLUSTER); + + /** + * Timeout value when collecting the recovery information (default to 10m) + */ + public static final Setting CLUSTER_STATS_TIMEOUT = + Setting.timeSetting(key("agent.cluster.stats.timeout"), TimeValue.timeValueSeconds(10), true, Setting.Scope.CLUSTER); + + /** + * Timeout value when collecting the recovery information (default to 10m) + */ + public static final Setting INDEX_RECOVERY_TIMEOUT = + Setting.timeSetting(key("agent.index.recovery.timeout"), TimeValue.timeValueSeconds(10), true, Setting.Scope.CLUSTER); + + /** + * 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 = + Setting.boolSetting(key("agent.index.recovery.active_only"), false, true, Setting.Scope.CLUSTER) ; + + /** + * List of collectors allowed to collect data (default to all) + */ + public static final Setting> COLLECTORS = + Setting.listSetting(key("agent.collectors"), Collections.emptyList(), Function.identity(), false, Setting.Scope.CLUSTER); + + /** + * The default retention duration of the monitoring history data + */ + public static final Setting HISTORY_DURATION = + Setting.timeSetting(key(HISTORY_DURATION_SETTING_NAME), TimeValue.timeValueHours(7 * 24), true, Setting.Scope.CLUSTER); + + /** + * The index setting that holds the template version + */ + public static final Setting INDEX_TEMPLATE_VERSION = + Setting.intSetting("index.xpack.monitoring.template.version", MarvelTemplateUtils.TEMPLATE_VERSION, true, Setting.Scope.INDEX); + + /** + * Settings/Options per configured exporter + */ + public static final Setting EXPORTERS_SETTINGS = + Setting.groupSetting(key("agent.exporters."), true, Setting.Scope.CLUSTER); + + static void register(SettingsModule module) { + module.registerSetting(INDICES); + module.registerSetting(INTERVAL); + module.registerSetting(INDEX_RECOVERY_TIMEOUT); + module.registerSetting(INDEX_STATS_TIMEOUT); + module.registerSetting(INDICES_STATS_TIMEOUT); + module.registerSetting(INDEX_RECOVERY_ACTIVE_ONLY); + module.registerSetting(COLLECTORS); + module.registerSetting(CLUSTER_STATE_TIMEOUT); + module.registerSetting(CLUSTER_STATS_TIMEOUT); + module.registerSetting(HISTORY_DURATION); + module.registerSetting(EXPORTERS_SETTINGS); + module.registerSetting(ENABLED); + module.registerSetting(INDEX_TEMPLATE_VERSION); + + module.registerSettingsFilter("xpack.monitoring.agent.exporters.*.auth.password"); + } + + + private volatile TimeValue indexStatsTimeout; + private volatile TimeValue indicesStatsTimeout; + private volatile TimeValue clusterStateTimeout; + private volatile TimeValue clusterStatsTimeout; + private volatile TimeValue recoveryTimeout; + private volatile boolean recoveryActiveOnly; + private volatile String[] indices; + + @Inject + public MarvelSettings(Settings settings, ClusterSettings clusterSettings) { + super(settings); + + setIndexStatsTimeout(INDEX_STATS_TIMEOUT.get(settings)); + clusterSettings.addSettingsUpdateConsumer(INDEX_STATS_TIMEOUT, this::setIndexStatsTimeout); + setIndicesStatsTimeout(INDICES_STATS_TIMEOUT.get(settings)); + clusterSettings.addSettingsUpdateConsumer(INDICES_STATS_TIMEOUT, this::setIndicesStatsTimeout); + setIndices(INDICES.get(settings)); + clusterSettings.addSettingsUpdateConsumer(INDICES, this::setIndices); + setClusterStateTimeout(CLUSTER_STATE_TIMEOUT.get(settings)); + clusterSettings.addSettingsUpdateConsumer(CLUSTER_STATE_TIMEOUT, this::setClusterStateTimeout); + setClusterStatsTimeout(CLUSTER_STATS_TIMEOUT.get(settings)); + clusterSettings.addSettingsUpdateConsumer(CLUSTER_STATS_TIMEOUT, this::setClusterStatsTimeout); + setRecoveryTimeout(INDEX_RECOVERY_TIMEOUT.get(settings)); + clusterSettings.addSettingsUpdateConsumer(INDEX_RECOVERY_TIMEOUT, this::setRecoveryTimeout); + setRecoveryActiveOnly(INDEX_RECOVERY_ACTIVE_ONLY.get(settings)); + clusterSettings.addSettingsUpdateConsumer(INDEX_RECOVERY_ACTIVE_ONLY, this::setRecoveryActiveOnly); + } + + public TimeValue indexStatsTimeout() { + return indexStatsTimeout; + } + + public TimeValue indicesStatsTimeout() { return indicesStatsTimeout; } + + public String[] indices() { + return indices; + } + + public TimeValue clusterStateTimeout() { + return clusterStateTimeout; + } + + public TimeValue clusterStatsTimeout() { + return clusterStatsTimeout; + } + + public TimeValue recoveryTimeout() { + return recoveryTimeout; + } + + public boolean recoveryActiveOnly() { + return recoveryActiveOnly; + } + + private void setIndexStatsTimeout(TimeValue indexStatsTimeout) { + this.indexStatsTimeout = indexStatsTimeout; + } + + private void setIndicesStatsTimeout(TimeValue indicesStatsTimeout) { + this.indicesStatsTimeout = indicesStatsTimeout; + } + + private void setClusterStateTimeout(TimeValue clusterStateTimeout) { + this.clusterStateTimeout = clusterStateTimeout; + } + + private void setClusterStatsTimeout(TimeValue clusterStatsTimeout) { + this.clusterStatsTimeout = clusterStatsTimeout; + } + + private void setRecoveryTimeout(TimeValue recoveryTimeout) { + this.recoveryTimeout = recoveryTimeout; + } + + private void setRecoveryActiveOnly(boolean recoveryActiveOnly) { + this.recoveryActiveOnly = recoveryActiveOnly; + } + + private void setIndices(List indices) { + this.indices = indices.toArray(new String[0]); + } + + private static String key(String key) { + return XPackPlugin.featureSettingPrefix(Marvel.NAME) + "." + key; + } + +} diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/AgentService.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/AgentService.java index e6976c7fdcb..c691b5f34a6 100644 --- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/AgentService.java +++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/AgentService.java @@ -20,7 +20,7 @@ import org.elasticsearch.marvel.agent.exporter.ExportBulk; import org.elasticsearch.marvel.agent.exporter.Exporter; import org.elasticsearch.marvel.agent.exporter.Exporters; import org.elasticsearch.marvel.agent.exporter.MarvelDoc; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import java.util.Collection; import java.util.Collections; @@ -42,9 +42,9 @@ public class AgentService extends AbstractLifecycleComponent { @Inject public AgentService(Settings settings, ClusterSettings clusterSettings, Set collectors, Exporters exporters) { super(settings); - samplingInterval = MarvelSettings.INTERVAL_SETTING.get(settings).millis(); - settingsCollectors = MarvelSettings.COLLECTORS_SETTING.get(settings).toArray(new String[0]); - clusterSettings.addSettingsUpdateConsumer(MarvelSettings.INTERVAL_SETTING, this::setInterval); + samplingInterval = MarvelSettings.INTERVAL.get(settings).millis(); + settingsCollectors = MarvelSettings.COLLECTORS.get(settings).toArray(new String[0]); + clusterSettings.addSettingsUpdateConsumer(MarvelSettings.INTERVAL, this::setInterval); this.collectors = Collections.unmodifiableSet(filterCollectors(collectors, settingsCollectors)); this.exporters = exporters; } @@ -84,7 +84,7 @@ public class AgentService extends AbstractLifecycleComponent { } else if (workerThread == null || !workerThread.isAlive()) { exportingWorker = new ExportingWorker(); - workerThread = new Thread(exportingWorker, EsExecutors.threadName(settings, "marvel.exporters")); + workerThread = new Thread(exportingWorker, EsExecutors.threadName(settings, "monitoring.exporters")); workerThread.setDaemon(true); workerThread.start(); } diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/collector/AbstractCollector.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/collector/AbstractCollector.java index eb1b58e07dd..a23ce6347ff 100644 --- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/collector/AbstractCollector.java +++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/collector/AbstractCollector.java @@ -16,7 +16,7 @@ import org.elasticsearch.discovery.DiscoveryService; import org.elasticsearch.marvel.agent.exporter.IndexNameResolver; import org.elasticsearch.marvel.agent.exporter.MarvelDoc; import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.license.MarvelLicensee; import java.util.Collection; @@ -125,7 +125,7 @@ public abstract class AbstractCollector extends AbstractLifecycleComponent } /** - * Resolves marvel's data index name + * Resolves monitoring's data index name */ public class DataIndexNameResolver implements IndexNameResolver { @@ -133,7 +133,7 @@ public abstract class AbstractCollector extends AbstractLifecycleComponent DataIndexNameResolver(Integer version) { Objects.requireNonNull(version, "index version cannot be null"); - this.index = MarvelSettings.MARVEL_DATA_INDEX_PREFIX + String.valueOf(version); + this.index = MarvelSettings.MONITORING_DATA_INDEX_PREFIX + String.valueOf(version); } @Override diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/collector/cluster/ClusterStateCollector.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/collector/cluster/ClusterStateCollector.java index a87aceda890..9fabf639b29 100644 --- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/collector/cluster/ClusterStateCollector.java +++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/collector/cluster/ClusterStateCollector.java @@ -16,7 +16,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.DiscoveryService; import org.elasticsearch.marvel.agent.collector.AbstractCollector; import org.elasticsearch.marvel.agent.exporter.MarvelDoc; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.license.MarvelLicensee; import org.elasticsearch.shield.InternalClient; @@ -76,7 +76,7 @@ public class ClusterStateCollector extends AbstractCollector { shardDoc.setClusterUUID(clusterUUID); shardDoc.setTimestamp(timestamp); if (shard.assignedToNode()) { - // If the shard is assigned to a node, the shard marvel document + // If the shard is assigned to a node, the shard monitoring document // refers to this node shardDoc.setSourceNode(clusterState.getNodes().get(shard.currentNodeId())); } diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/Exporter.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/Exporter.java index 5486f5f3be1..f683c63e127 100644 --- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/Exporter.java +++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/Exporter.java @@ -11,7 +11,7 @@ import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; @@ -70,7 +70,7 @@ public abstract class Exporter { public abstract void close(); protected String settingFQN(String setting) { - return Exporters.EXPORTERS_SETTING + "." + config.name + "." + setting; + return MarvelSettings.EXPORTERS_SETTINGS.getKey() + config.name + "." + setting; } public static class Config { @@ -137,7 +137,7 @@ public abstract class Exporter { try { indexTimeFormatter = DateTimeFormat.forPattern(indexTimeFormat).withZoneUTC(); } catch (IllegalArgumentException e) { - throw new SettingsException("invalid marvel index name time format [" + indexTimeFormat + "] set for [" + + throw new SettingsException("invalid monitoring index name time format [" + indexTimeFormat + "] set for [" + settingFQN(INDEX_NAME_TIME_FORMAT_SETTING) + "]", e); } } @@ -152,7 +152,7 @@ public abstract class Exporter { @Override public String resolve(long timestamp) { - return MarvelSettings.MARVEL_INDICES_PREFIX + String.valueOf(MarvelTemplateUtils.TEMPLATE_VERSION) + "-" + + return MarvelSettings.MONITORING_INDICES_PREFIX + String.valueOf(MarvelTemplateUtils.TEMPLATE_VERSION) + "-" + indexTimeFormatter.print(timestamp); } diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/Exporters.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/Exporters.java index 00b20a269c3..1c4cd8462ed 100644 --- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/Exporters.java +++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/Exporters.java @@ -12,9 +12,9 @@ import org.elasticsearch.common.component.Lifecycle; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsException; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.agent.exporter.local.LocalExporter; import java.util.ArrayList; @@ -31,8 +31,6 @@ import java.util.Set; */ public class Exporters extends AbstractLifecycleComponent implements Iterable { - public static final Setting EXPORTERS_SETTING = Setting.groupSetting("marvel.agent.exporters.", true, Setting.Scope.CLUSTER); - private final Map factories; private final ClusterService clusterService; @@ -47,9 +45,8 @@ public class Exporters extends AbstractLifecycleComponent implements super(settings); this.factories = factories; this.clusterService = clusterService; - exporterSettings = EXPORTERS_SETTING.get(settings); - clusterSettings.addSettingsUpdateConsumer(EXPORTERS_SETTING, this::setExportersSetting); - + exporterSettings = MarvelSettings.EXPORTERS_SETTINGS.get(settings); + clusterSettings.addSettingsUpdateConsumer(MarvelSettings.EXPORTERS_SETTINGS, this::setExportersSetting); } private synchronized void setExportersSetting(Settings exportersSetting) { @@ -124,7 +121,7 @@ public class Exporters extends AbstractLifecycleComponent implements bulks.add(bulk); } } catch (Exception e) { - logger.error("exporter [{}] failed to export marvel data", e, exporter.name()); + logger.error("exporter [{}] failed to export monitoring data", e, exporter.name()); } } return bulks.isEmpty() ? null : new ExportBulk.Compound(bulks); diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/MarvelTemplateUtils.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/MarvelTemplateUtils.java index ef74a73423c..47b550b3cbb 100644 --- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/MarvelTemplateUtils.java +++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/MarvelTemplateUtils.java @@ -15,14 +15,14 @@ import java.util.Properties; public final class MarvelTemplateUtils { - static final String INDEX_TEMPLATE_FILE = "/marvel-es.json"; - static final String INDEX_TEMPLATE_NAME_PREFIX = ".marvel-es-"; + static final String INDEX_TEMPLATE_FILE = "/monitoring-es.json"; + static final String INDEX_TEMPLATE_NAME_PREFIX = ".monitoring-es-"; - static final String DATA_TEMPLATE_FILE = "/marvel-es-data.json"; - static final String DATA_TEMPLATE_NAME_PREFIX = ".marvel-es-data-"; + static final String DATA_TEMPLATE_FILE = "/monitoring-es-data.json"; + static final String DATA_TEMPLATE_NAME_PREFIX = ".monitoring-es-data-"; - static final String PROPERTIES_FILE = "/marvel.properties"; - static final String VERSION_FIELD = "marvel.template.version"; + static final String PROPERTIES_FILE = "/monitoring.properties"; + static final String TEMPLATE_VERSION_PROPERTY = "template.version"; public static final Integer TEMPLATE_VERSION = loadTemplateVersion(); @@ -36,7 +36,7 @@ public final class MarvelTemplateUtils { try { return load(INDEX_TEMPLATE_FILE); } catch (IOException e) { - throw new IllegalStateException("unable to load marvel template", e); + throw new IllegalStateException("unable to load monitoring template", e); } } @@ -47,7 +47,7 @@ public final class MarvelTemplateUtils { try { return load(DATA_TEMPLATE_FILE); } catch (IOException e) { - throw new IllegalStateException("unable to load marvel data template", e); + throw new IllegalStateException("unable to load monitoring data template", e); } } @@ -72,15 +72,15 @@ public final class MarvelTemplateUtils { try (InputStream is = MarvelTemplateUtils.class.getResourceAsStream(PROPERTIES_FILE)) { Properties properties = new Properties(); properties.load(is); - String version = properties.getProperty(VERSION_FIELD); + String version = properties.getProperty(TEMPLATE_VERSION_PROPERTY); if (Strings.hasLength(version)) { return Integer.parseInt(version); } - throw new IllegalArgumentException("no marvel template version found"); + throw new IllegalArgumentException("no monitoring template version found"); } catch (NumberFormatException e) { - throw new IllegalArgumentException("failed to parse marvel template version"); + throw new IllegalArgumentException("failed to parse monitoring template version"); } catch (IOException e) { - throw new IllegalArgumentException("failed to load marvel template version"); + throw new IllegalArgumentException("failed to load monitoring template version"); } } diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/http/HttpExporter.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/http/HttpExporter.java index 388be3762ef..3e3bf6d23d1 100644 --- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/http/HttpExporter.java +++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/http/HttpExporter.java @@ -22,13 +22,13 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.env.Environment; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.agent.exporter.ExportBulk; import org.elasticsearch.marvel.agent.exporter.Exporter; import org.elasticsearch.marvel.agent.exporter.MarvelDoc; import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils; import org.elasticsearch.marvel.agent.renderer.Renderer; import org.elasticsearch.marvel.agent.renderer.RendererRegistry; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; import org.elasticsearch.marvel.support.VersionUtils; import javax.net.ssl.HostnameVerifier; @@ -80,7 +80,7 @@ public class HttpExporter extends Exporter { public static final String SSL_TRUSTSTORE_ALGORITHM_SETTING = "truststore.algorithm"; public static final String SSL_HOSTNAME_VERIFICATION_SETTING = SSL_SETTING + ".hostname_verification"; - /** Minimum supported version of the remote marvel cluster **/ + /** Minimum supported version of the remote monitoring cluster **/ public static final Version MIN_SUPPORTED_CLUSTER_VERSION = Version.V_2_0_0_beta2; volatile String[] hosts; @@ -145,7 +145,7 @@ public class HttpExporter extends Exporter { logger.debug("initialized with hosts [{}], index prefix [{}], index resolver [{}], template version [{}]", Strings.arrayToCommaDelimitedString(hosts), - MarvelSettings.MARVEL_INDICES_PREFIX, indexNameResolver, templateVersion); + MarvelSettings.MONITORING_INDICES_PREFIX, indexNameResolver, templateVersion); } @Override @@ -186,10 +186,11 @@ public class HttpExporter extends Exporter { // Get the appropriate renderer in order to render the MarvelDoc Renderer renderer = renderers.getRenderer(marvelDoc); - assert renderer != null : "unable to render marvel document of type [" + marvelDoc.getType() + "]. no renderer found in registry"; + assert renderer != null : + "unable to render monitoring document of type [" + marvelDoc.getType() + "]. no renderer found in registry"; if (renderer == null) { - logger.warn("http exporter [{}] - unable to render marvel document of type [{}]: no renderer found in registry", + logger.warn("http exporter [{}] - unable to render monitoring document of type [{}]: no renderer found in registry", name(), marvelDoc.getType()); return; } @@ -372,7 +373,7 @@ public class HttpExporter extends Exporter { } /** - * Get the version of the remote Marvel cluster + * Get the version of the remote monitoring cluster */ Version loadRemoteClusterVersion(final String host) { HttpURLConnection connection = null; @@ -413,7 +414,7 @@ public class HttpExporter extends Exporter { // Works like LocalExporter on master: // Install the index template for timestamped indices first, so that other nodes can ship data if (!templateInstalled) { - logger.debug("http exporter [{}] - could not find existing marvel template, installing a new one", name()); + logger.debug("http exporter [{}] - could not find existing monitoring template, installing a new one", name()); if (!putTemplate(host, templateName, MarvelTemplateUtils.loadTimestampedIndexTemplate())) { return false; } @@ -422,7 +423,7 @@ public class HttpExporter extends Exporter { // Install the index template for data index templateName = MarvelTemplateUtils.dataTemplateName(templateVersion); if (!hasTemplate(templateName, host)) { - logger.debug("http exporter [{}] - could not find existing marvel template for data index, installing a new one", name()); + logger.debug("http exporter [{}] - could not find existing monitoring template for data index, installing a new one", name()); if (!putTemplate(host, templateName, MarvelTemplateUtils.loadDataIndexTemplate())) { return false; } @@ -438,19 +439,20 @@ public class HttpExporter extends Exporter { HttpURLConnection connection = null; try { - logger.debug("http exporter [{}] - checking if marvel template [{}] exists on the marvel cluster", name(), templateName); + logger.debug("http exporter [{}] - checking if monitoring template [{}] exists on the monitoring cluster", + name(), templateName); connection = openConnection(host, "GET", url, null); if (connection == null) { - throw new IOException("no available connection to check for marvel template [" + templateName + "] existence"); + throw new IOException("no available connection to check for monitoring template [" + templateName + "] existence"); } // 200 means that the template has been found, 404 otherwise if (connection.getResponseCode() == 200) { - logger.debug("marvel template [{}] found",templateName); + logger.debug("monitoring template [{}] found",templateName); return true; } } catch (Exception e) { - logger.error("http exporter [{}] - failed to verify the marvel template [{}] on [{}]:\n{}", name(), templateName, host, + logger.error("http exporter [{}] - failed to verify the monitoring template [{}] on [{}]:\n{}", name(), templateName, host, e.getMessage()); return false; } finally { @@ -471,21 +473,21 @@ public class HttpExporter extends Exporter { try { connection = openConnection(host, "PUT", "_template/" + template, XContentType.JSON.mediaType()); if (connection == null) { - logger.debug("http exporter [{}] - no available connection to update marvel template [{}]", name(), template); + logger.debug("http exporter [{}] - no available connection to update monitoring template [{}]", name(), template); return false; } // Uploads the template and closes the outputstream Streams.copy(source, connection.getOutputStream()); if (connection.getResponseCode() != 200 && connection.getResponseCode() != 201) { - logConnectionError("error adding the marvel template [" + template + "] to [" + host + "]", connection); + logConnectionError("error adding the monitoring template [" + template + "] to [" + host + "]", connection); return false; } - logger.info("http exporter [{}] - marvel template [{}] updated to version [{}]", name(), template, templateVersion); + logger.info("http exporter [{}] - monitoring template [{}] updated to version [{}]", name(), template, templateVersion); return true; } catch (IOException e) { - logger.error("http exporter [{}] - failed to update marvel template [{}] on host [{}]:\n{}", name(), template, host, + logger.error("http exporter [{}] - failed to update monitoring template [{}] on host [{}]:\n{}", name(), template, host, e.getMessage()); return false; } finally { @@ -519,7 +521,7 @@ public class HttpExporter extends Exporter { protected void initKeepAliveThread() { if (keepAlive) { - keepAliveThread = new Thread(keepAliveWorker, "marvel-exporter[" + config.name() + "][keep_alive]"); + keepAliveThread = new Thread(keepAliveWorker, "monitoring-exporter[" + config.name() + "][keep_alive]"); keepAliveThread.setDaemon(true); keepAliveThread.start(); } @@ -531,10 +533,10 @@ public class HttpExporter extends Exporter { try { HttpExporterUtils.parseHostWithPath(host, ""); } catch (URISyntaxException e) { - throw new SettingsException("[marvel.agent.exporter] invalid host: [" + host + "]." + + throw new SettingsException("[xpack.monitoring.agent.exporter] invalid host: [" + host + "]." + " error: [" + e.getMessage() + "]"); } catch (MalformedURLException e) { - throw new SettingsException("[marvel.agent.exporter] invalid host: [" + host + "]." + + throw new SettingsException("[xpack.monitoring.agent.exporter] invalid host: [" + host + "]." + " error: [" + e.getMessage() + "]"); } } @@ -699,7 +701,7 @@ public class HttpExporter extends Exporter { out = connection.getOutputStream(); } - // We need to use a buffer to render each Marvel document + // We need to use a buffer to render each monitoring document // because the renderer might close the outputstream (ex: XContentBuilder) try (BytesStreamOutput buffer = new BytesStreamOutput()) { for (MarvelDoc marvelDoc : docs) { diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/local/LocalBulk.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/local/LocalBulk.java index 38400d078ed..ff1c7cb1243 100644 --- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/local/LocalBulk.java +++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/local/LocalBulk.java @@ -60,10 +60,10 @@ public class LocalBulk extends ExportBulk { // Get the appropriate renderer in order to render the MarvelDoc Renderer renderer = renderers.getRenderer(marvelDoc); - assert renderer != null : "unable to render marvel document of type [" + marvelDoc.getType() + "]. no renderer registered"; + assert renderer != null : "unable to render monitoring document of type [" + marvelDoc.getType() + "]. no renderer registered"; if (renderer == null) { - logger.warn("local exporter [{}] - unable to render marvel document of type [{}]: no renderer found in registry", + logger.warn("local exporter [{}] - unable to render monitoring document of type [{}]: no renderer found in registry", name, marvelDoc.getType()); continue; } diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/local/LocalExporter.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/local/LocalExporter.java index 870d9bdb26d..a320f7fc9a7 100644 --- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/local/LocalExporter.java +++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/local/LocalExporter.java @@ -28,7 +28,7 @@ import org.elasticsearch.marvel.agent.exporter.ExportBulk; import org.elasticsearch.marvel.agent.exporter.Exporter; import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils; import org.elasticsearch.marvel.agent.renderer.RendererRegistry; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.cleaner.CleanerService; import org.elasticsearch.shield.InternalClient; import org.joda.time.DateTime; @@ -130,7 +130,7 @@ public class LocalExporter extends Exporter implements ClusterStateListener, Cle } if (clusterState.blocks().hasGlobalBlock(GatewayService.STATE_NOT_RECOVERED_BLOCK)) { - // wait until the gateway has recovered from disk, otherwise we think may not have .marvel-es- + // wait until the gateway has recovered from disk, otherwise we think may not have .monitoring-es- // indices but they may not have been restored from the cluster state on disk logger.debug("local exporter [{}] - waiting until gateway has recovered from disk", name()); return null; @@ -139,14 +139,14 @@ public class LocalExporter extends Exporter implements ClusterStateListener, Cle String templateName = MarvelTemplateUtils.indexTemplateName(templateVersion); boolean templateInstalled = hasTemplate(templateName, clusterState); - // if this is not the master, we'll just look to see if the marvel timestamped template is already + // if this is not the master, we'll just look to see if the monitoring timestamped template is already // installed and if so, if it has a compatible version. If it is (installed and compatible) // we'll be able to start this exporter. Otherwise, we'll just wait for a new cluster state. if (!clusterService.localNode().masterNode()) { // We only need to check the index template for timestamped indices if (!templateInstalled) { // the template for timestamped indices is not yet installed in the given cluster state, we'll wait. - logger.debug("local exporter [{}] - marvel index template does not exist, so service cannot start", name()); + logger.debug("local exporter [{}] - monitoring index template does not exist, so service cannot start", name()); return null; } @@ -165,7 +165,7 @@ public class LocalExporter extends Exporter implements ClusterStateListener, Cle // Install the index template for timestamped indices first, so that other nodes can ship data if (!templateInstalled) { - logger.debug("local exporter [{}] - could not find existing marvel template for timestamped indices, installing a new one", + logger.debug("local exporter [{}] - could not find existing monitoring template for timestamped indices, installing a new one", name()); putTemplate(templateName, MarvelTemplateUtils.loadTimestampedIndexTemplate()); // we'll get that template on the next cluster state update @@ -175,7 +175,7 @@ public class LocalExporter extends Exporter implements ClusterStateListener, Cle // Install the index template for data index templateName = MarvelTemplateUtils.dataTemplateName(templateVersion); if (!hasTemplate(templateName, clusterState)) { - logger.debug("local exporter [{}] - could not find existing marvel template for data index, installing a new one", name()); + logger.debug("local exporter [{}] - could not find existing monitoring template for data index, installing a new one", name()); putTemplate(templateName, MarvelTemplateUtils.loadDataIndexTemplate()); // we'll get that template on the next cluster state update return null; @@ -224,15 +224,15 @@ public class LocalExporter extends Exporter implements ClusterStateListener, Cle @Override public void onResponse(PutIndexTemplateResponse response) { if (response.isAcknowledged()) { - logger.trace("local exporter [{}] - successfully installed marvel template [{}]", name(), template); + logger.trace("local exporter [{}] - successfully installed monitoring template [{}]", name(), template); } else { - logger.error("local exporter [{}] - failed to update marvel index template [{}]", name(), template); + logger.error("local exporter [{}] - failed to update monitoring index template [{}]", name(), template); } } @Override public void onFailure(Throwable throwable) { - logger.error("local exporter [{}] - failed to update marvel index template [{}]", throwable, name(), template); + logger.error("local exporter [{}] - failed to update monitoring index template [{}]", throwable, name(), template); } }); } @@ -247,7 +247,7 @@ public class LocalExporter extends Exporter implements ClusterStateListener, Cle if (clusterService.localNode().masterNode()) { // Retention duration can be overridden at exporter level - TimeValue exporterRetention = config.settings().getAsTime(CleanerService.HISTORY_DURATION, null); + TimeValue exporterRetention = config.settings().getAsTime(MarvelSettings.HISTORY_DURATION_SETTING_NAME, null); if (exporterRetention != null) { try { cleanerService.validateRetention(exporterRetention); @@ -270,9 +270,9 @@ public class LocalExporter extends Exporter implements ClusterStateListener, Cle for (ObjectObjectCursor index : clusterState.getMetaData().indices()) { String indexName = index.key; - if (Regex.simpleMatch(MarvelSettings.MARVEL_INDICES_PREFIX + "*", indexName)) { + if (Regex.simpleMatch(MarvelSettings.MONITORING_INDICES_PREFIX + "*", indexName)) { // Never delete the data indices - if (indexName.startsWith(MarvelSettings.MARVEL_DATA_INDEX_PREFIX)) { + if (indexName.startsWith(MarvelSettings.MONITORING_DATA_INDEX_PREFIX)) { continue; } diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/renderer/AbstractRenderer.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/renderer/AbstractRenderer.java index 375f3b78bdd..3dec1b44ab6 100644 --- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/renderer/AbstractRenderer.java +++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/renderer/AbstractRenderer.java @@ -21,7 +21,7 @@ import java.util.HashSet; import java.util.Set; /** - * Renders Marvel documents using a XContentBuilder (potentially filtered) + * Renders Monitoring documents using a XContentBuilder (potentially filtered) */ public abstract class AbstractRenderer implements Renderer { @@ -54,7 +54,7 @@ public abstract class AbstractRenderer implements Renderer< try (XContentBuilder builder = new XContentBuilder(xContentType.xContent(), os, filters())) { builder.startObject(); - // Add fields common to all Marvel documents + // Add fields common to all Monitoring documents builder.field(Fields.CLUSTER_UUID, marvelDoc.getClusterUUID()); DateTime timestampDateTime = new DateTime(marvelDoc.getTimestamp(), DateTimeZone.UTC); builder.field(Fields.TIMESTAMP, timestampDateTime.toString()); @@ -64,7 +64,7 @@ public abstract class AbstractRenderer implements Renderer< builder.field(Fields.SOURCE_NODE, sourceNode); } - // Render fields specific to the Marvel document + // Render fields specific to the Monitoring document doRender(marvelDoc, builder, ToXContent.EMPTY_PARAMS); builder.endObject(); diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/settings/MarvelSettings.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/settings/MarvelSettings.java deleted file mode 100644 index 42fff3ae11c..00000000000 --- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/settings/MarvelSettings.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -package org.elasticsearch.marvel.agent.settings; - -import org.elasticsearch.common.component.AbstractComponent; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Setting; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.marvel.Marvel; - -import java.util.Collections; -import java.util.List; -import java.util.function.Function; - -public class MarvelSettings extends AbstractComponent { - - private static final String PREFIX = Marvel.NAME + ".agent."; - - public static final String MARVEL_INDICES_PREFIX = ".marvel-es-"; - public static final String MARVEL_DATA_INDEX_PREFIX = MARVEL_INDICES_PREFIX + "data-"; - public static final TimeValue MAX_LICENSE_GRACE_PERIOD = TimeValue.timeValueHours(7 * 24); - - /** Sampling interval between two collections (default to 10s) */ - public static final Setting INTERVAL_SETTING = - Setting.timeSetting(PREFIX + "interval", TimeValue.timeValueSeconds(10), true, Setting.Scope.CLUSTER); - /** Timeout value when collecting index statistics (default to 10m) */ - public static final Setting INDEX_STATS_TIMEOUT_SETTING = - Setting.timeSetting(PREFIX + "index.stats.timeout", TimeValue.timeValueSeconds(10), true, Setting.Scope.CLUSTER); - /** Timeout value when collecting total indices statistics (default to 10m) */ - public static final Setting INDICES_STATS_TIMEOUT_SETTING = - Setting.timeSetting(PREFIX + "indices.stats.timeout", TimeValue.timeValueSeconds(10), true, Setting.Scope.CLUSTER); - /** List of indices names whose stats will be exported (default to all indices) */ - public static final Setting> INDICES_SETTING = - Setting.listSetting(PREFIX + "indices", Collections.emptyList(), Function.identity(), true, Setting.Scope.CLUSTER); - /** Timeout value when collecting the cluster state (default to 10m) */ - public static final Setting CLUSTER_STATE_TIMEOUT_SETTING = - Setting.timeSetting(PREFIX + "cluster.state.timeout", TimeValue.timeValueSeconds(10), true, Setting.Scope.CLUSTER); - /** Timeout value when collecting the recovery information (default to 10m) */ - public static final Setting CLUSTER_STATS_TIMEOUT_SETTING = - Setting.timeSetting(PREFIX + "cluster.stats.timeout", TimeValue.timeValueSeconds(10), true, Setting.Scope.CLUSTER); - /** Timeout value when collecting the recovery information (default to 10m) */ - public static final Setting INDEX_RECOVERY_TIMEOUT_SETTING = - Setting.timeSetting(PREFIX + "index.recovery.timeout", TimeValue.timeValueSeconds(10), true, Setting.Scope.CLUSTER); - /** 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_SETTING = - Setting.boolSetting(PREFIX + "index.recovery.active_only", false, true, Setting.Scope.CLUSTER) ; - /** List of collectors allowed to collect data (default to all)*/ - public static final Setting> COLLECTORS_SETTING = - Setting.listSetting(PREFIX + "collectors", Collections.emptyList(), Function.identity(), false, Setting.Scope.CLUSTER); - - private TimeValue indexStatsTimeout; - private TimeValue indicesStatsTimeout; - private TimeValue clusterStateTimeout; - private TimeValue clusterStatsTimeout; - private TimeValue recoveryTimeout; - private boolean recoveryActiveOnly; - private String[] indices; - - @Inject - public MarvelSettings(Settings settings, ClusterSettings clusterSettings) { - super(settings); - - logger.trace("initializing marvel settings"); - setIndexStatsTimeout(INDEX_STATS_TIMEOUT_SETTING.get(settings)); - clusterSettings.addSettingsUpdateConsumer(INDEX_STATS_TIMEOUT_SETTING, this::setIndexStatsTimeout); - setIndicesStatsTimeout(INDICES_STATS_TIMEOUT_SETTING.get(settings)); - clusterSettings.addSettingsUpdateConsumer(INDICES_STATS_TIMEOUT_SETTING, this::setIndicesStatsTimeout); - setIndices(INDICES_SETTING.get(settings)); - clusterSettings.addSettingsUpdateConsumer(INDICES_SETTING, this::setIndices); - setClusterStateTimeout(CLUSTER_STATE_TIMEOUT_SETTING.get(settings)); - clusterSettings.addSettingsUpdateConsumer(CLUSTER_STATE_TIMEOUT_SETTING, this::setClusterStateTimeout); - setClusterStatsTimeout(CLUSTER_STATS_TIMEOUT_SETTING.get(settings)); - clusterSettings.addSettingsUpdateConsumer(CLUSTER_STATS_TIMEOUT_SETTING, this::setClusterStatsTimeout); - setRecoveryTimeout(INDEX_RECOVERY_TIMEOUT_SETTING.get(settings)); - clusterSettings.addSettingsUpdateConsumer(INDEX_RECOVERY_TIMEOUT_SETTING, this::setRecoveryTimeout); - setRecoveryActiveOnly(INDEX_RECOVERY_ACTIVE_ONLY_SETTING.get(settings)); - clusterSettings.addSettingsUpdateConsumer(INDEX_RECOVERY_ACTIVE_ONLY_SETTING, this::setRecoveryActiveOnly); - } - - public TimeValue indexStatsTimeout() { - return indexStatsTimeout; - } - - public TimeValue indicesStatsTimeout() { return indicesStatsTimeout; } - - public String[] indices() { - return indices; - } - - public TimeValue clusterStateTimeout() { - return clusterStateTimeout; - } - - public TimeValue clusterStatsTimeout() { - return clusterStatsTimeout; - } - - public TimeValue recoveryTimeout() { - return recoveryTimeout; - } - - public boolean recoveryActiveOnly() { return recoveryActiveOnly; } - - private void setIndexStatsTimeout(TimeValue indexStatsTimeout) { - this.indexStatsTimeout = indexStatsTimeout; - } - - private void setIndicesStatsTimeout(TimeValue indicesStatsTimeout) { - this.indicesStatsTimeout = indicesStatsTimeout; - } - - private void setClusterStateTimeout(TimeValue clusterStateTimeout) { - this.clusterStateTimeout = clusterStateTimeout; - } - - private void setClusterStatsTimeout(TimeValue clusterStatsTimeout) { - this.clusterStatsTimeout = clusterStatsTimeout; - } - - private void setRecoveryTimeout(TimeValue recoveryTimeout) { - this.recoveryTimeout = recoveryTimeout; - } - - private void setRecoveryActiveOnly(boolean recoveryActiveOnly) { - this.recoveryActiveOnly = recoveryActiveOnly; - } - - private void setIndices(List indices) { - this.indices = indices.toArray(new String[0]); - } - -} diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/cleaner/CleanerService.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/cleaner/CleanerService.java index 2f20fda56e2..a1fe0c3cc5a 100644 --- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/cleaner/CleanerService.java +++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/cleaner/CleanerService.java @@ -13,6 +13,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.AbstractRunnable; import org.elasticsearch.common.util.concurrent.FutureUtils; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.license.MarvelLicensee; import org.elasticsearch.threadpool.ThreadPool; import org.joda.time.DateTime; @@ -23,13 +24,10 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ScheduledFuture; /** - * CleanerService takes care of deleting old marvel indices. + * CleanerService takes care of deleting old monitoring indices. */ public class CleanerService extends AbstractLifecycleComponent { - public static final String HISTORY_DURATION = "history.duration"; - public static final Setting HISTORY_SETTING = Setting.timeSetting("marvel." + HISTORY_DURATION, - TimeValue.timeValueHours(7 * 24), true, Setting.Scope.CLUSTER); private final MarvelLicensee licensee; private final ThreadPool threadPool; @@ -45,7 +43,7 @@ public class CleanerService extends AbstractLifecycleComponent { this.licensee = licensee; this.threadPool = threadPool; this.executionScheduler = executionScheduler; - clusterSettings.addSettingsUpdateConsumer(HISTORY_SETTING, this::setRetention, this::validateRetention); + clusterSettings.addSettingsUpdateConsumer(MarvelSettings.HISTORY_DURATION, this::setRetention, this::validateRetention); } @Inject @@ -140,10 +138,10 @@ public class CleanerService extends AbstractLifecycleComponent { TimeValue globalRetention = retention; if (globalRetention == null) { try { - globalRetention = HISTORY_SETTING.get(settings); + globalRetention = MarvelSettings.HISTORY_DURATION.get(settings); validateRetention(globalRetention); } catch (IllegalArgumentException e) { - globalRetention = HISTORY_SETTING.get(Settings.EMPTY); + globalRetention = MarvelSettings.HISTORY_DURATION.get(Settings.EMPTY); } } diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/license/MarvelLicensee.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/license/MarvelLicensee.java index 77a2779737f..fdd94dfd1bf 100644 --- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/license/MarvelLicensee.java +++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/license/MarvelLicensee.java @@ -28,7 +28,7 @@ public class MarvelLicensee extends AbstractLicenseeComponent im public String[] expirationMessages() { return new String[] { "The agent will stop collecting cluster and indices metrics", - "The agent will stop to automatically clean up indices older than [marvel.history.duration]", + "The agent will stop to automatically clean up indices older than [xpack.monitoring.history.duration]", }; } @@ -45,8 +45,8 @@ public class MarvelLicensee extends AbstractLicenseeComponent im LoggerMessageFormat.format( "Multi-cluster support is disabled for clusters with [{}] license. If you are\n" + "running multiple clusters, users won't be able to access the clusters with\n" + - "[{}] licenses from within a single Marvel instance. You will have to deploy a\n" + - "separate and dedicated Marvel instance for each [{}] cluster you wish to monitor.", + "[{}] licenses from within a single x-pack kibana instance. You will have to deploy a\n" + + "separate and dedicated x-pack kibana instance for each [{}] cluster you wish to monitor.", newLicense.type(), newLicense.type(), newLicense.type()), LoggerMessageFormat.format( "Automatic index cleanup is disabled for clusters with [{}] license.", newLicense.type()) diff --git a/elasticsearch/x-pack/marvel/src/main/resources/marvel.properties b/elasticsearch/x-pack/marvel/src/main/resources/marvel.properties deleted file mode 100644 index c37445e2a8b..00000000000 --- a/elasticsearch/x-pack/marvel/src/main/resources/marvel.properties +++ /dev/null @@ -1 +0,0 @@ -marvel.template.version=${marvel.template.version} diff --git a/elasticsearch/x-pack/marvel/src/main/resources/marvel-es-data.json b/elasticsearch/x-pack/marvel/src/main/resources/monitoring-es-data.json similarity index 89% rename from elasticsearch/x-pack/marvel/src/main/resources/marvel-es-data.json rename to elasticsearch/x-pack/marvel/src/main/resources/monitoring-es-data.json index 066e495e3b0..b76ceadadc9 100644 --- a/elasticsearch/x-pack/marvel/src/main/resources/marvel-es-data.json +++ b/elasticsearch/x-pack/marvel/src/main/resources/monitoring-es-data.json @@ -1,8 +1,7 @@ { - "template": ".marvel-es-data-${marvel.template.version}", + "template": ".monitoring-es-data-${monitoring.template.version}", "settings": { - "marvel.plugin.version": "${marvel.plugin.version}", - "marvel.template.version": "${marvel.template.version}", + "index.xpack.version": "${project.version}", "index.number_of_shards": 1, "index.number_of_replicas": 1, "index.codec": "best_compression", diff --git a/elasticsearch/x-pack/marvel/src/main/resources/marvel-es.json b/elasticsearch/x-pack/marvel/src/main/resources/monitoring-es.json similarity index 97% rename from elasticsearch/x-pack/marvel/src/main/resources/marvel-es.json rename to elasticsearch/x-pack/marvel/src/main/resources/monitoring-es.json index 820f94e150c..51994ef36cf 100644 --- a/elasticsearch/x-pack/marvel/src/main/resources/marvel-es.json +++ b/elasticsearch/x-pack/marvel/src/main/resources/monitoring-es.json @@ -1,8 +1,7 @@ { - "template": ".marvel-es-${marvel.template.version}-*", + "template": ".monitoring-es-${monitoring.template.version}-*", "settings": { - "marvel.plugin.version": "${marvel.plugin.version}", - "marvel.template.version": "${marvel.template.version}", + "index.xpack.version": "${project.version}", "index.number_of_shards": 1, "index.number_of_replicas": 1, "index.codec": "best_compression", diff --git a/elasticsearch/x-pack/marvel/src/main/resources/monitoring.properties b/elasticsearch/x-pack/marvel/src/main/resources/monitoring.properties new file mode 100644 index 00000000000..df309e703e5 --- /dev/null +++ b/elasticsearch/x-pack/marvel/src/main/resources/monitoring.properties @@ -0,0 +1 @@ +template.version=${monitoring.template.version} diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/MarvelPluginTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/MarvelPluginTests.java index d6ad59f0cd1..99ab9879cdf 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/MarvelPluginTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/MarvelPluginTests.java @@ -9,7 +9,6 @@ import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.marvel.agent.AgentService; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.plugins.PluginInfo; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; @@ -24,7 +23,7 @@ public class MarvelPluginTests extends MarvelIntegTestCase { protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") + .put(MarvelSettings.INTERVAL.getKey(), "-1") .build(); } @@ -47,14 +46,14 @@ public class MarvelPluginTests extends MarvelIntegTestCase { public void testMarvelEnabledOnTribeNode() { internalCluster().startNode(Settings.builder() .put(XPackPlugin.featureEnabledSetting(Marvel.NAME), true) - .put(Marvel.TRIBE_NAME_SETTING, "t1") + .put("tribe.name", "t1") .build()); assertPluginIsLoaded(); assertServiceIsBound(AgentService.class); } public void testMarvelDisabledOnTribeNode() { - internalCluster().startNode(Settings.builder().put(Marvel.TRIBE_NAME_SETTING, "t1").build()); + internalCluster().startNode(Settings.builder().put("tribe.name", "t1").build()); assertPluginIsLoaded(); assertServiceIsNotBound(AgentService.class); } diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/MarvelF.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/MonitoringF.java similarity index 87% rename from elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/MarvelF.java rename to elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/MonitoringF.java index 6c658922974..c6a651869ae 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/MarvelF.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/MonitoringF.java @@ -19,24 +19,24 @@ import java.util.Arrays; import java.util.concurrent.CountDownLatch; /** - * Main class to easily run Marvel from a IDE. + * Main class to easily run Monitoring from a IDE. *

* In order to run this class set configure the following: * 1) Set `-Des.path.home=` to a directory containing an ES config directory * * It accepts collectors names as program arguments. */ -public class MarvelF { +public class MonitoringF { public static void main(String[] args) throws Throwable { Settings.Builder settings = Settings.builder(); settings.put("script.inline", "true"); settings.put("security.manager.enabled", "false"); settings.put("plugins.load_classpath_plugins", "false"); - settings.put("cluster.name", MarvelF.class.getSimpleName()); - settings.put("marvel.agent.interval", "5s"); + settings.put("cluster.name", MonitoringF.class.getSimpleName()); + settings.put("xpack.monitoring.agent.interval", "5s"); if (!CollectionUtils.isEmpty(args)) { - settings.putArray("marvel.agent.collectors", args); + settings.putArray("xpack.monitoring.agent.collectors", args); } final CountDownLatch latch = new CountDownLatch(1); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/AbstractCollectorTestCase.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/AbstractCollectorTestCase.java index 45b2270b030..e64e488cddf 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/AbstractCollectorTestCase.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/AbstractCollectorTestCase.java @@ -23,7 +23,7 @@ import org.elasticsearch.license.plugin.core.LicenseState; import org.elasticsearch.license.plugin.core.Licensee; import org.elasticsearch.license.plugin.core.LicenseeRegistry; import org.elasticsearch.license.plugin.core.LicensesManagerService; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.shield.InternalClient; @@ -54,7 +54,7 @@ public class AbstractCollectorTestCase extends MarvelIntegTestCase { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put(NetworkModule.HTTP_ENABLED.getKey(), false) - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") + .put(MarvelSettings.INTERVAL.getKey(), "-1") .build(); } diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/cluster/ClusterStateCollectorTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/cluster/ClusterStateCollectorTests.java index 2442941864d..40fd3730ce4 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/cluster/ClusterStateCollectorTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/cluster/ClusterStateCollectorTests.java @@ -13,7 +13,7 @@ import org.elasticsearch.discovery.DiscoveryService; import org.elasticsearch.marvel.agent.collector.AbstractCollectorTestCase; import org.elasticsearch.marvel.agent.exporter.MarvelDoc; import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.license.MarvelLicensee; import java.util.ArrayList; @@ -188,13 +188,13 @@ public class ClusterStateCollectorTests extends AbstractCollectorTestCase { } else if (marvelDoc instanceof DiscoveryNodeMarvelDoc) { DiscoveryNodeMarvelDoc discoveryNodeMarvelDoc = (DiscoveryNodeMarvelDoc) marvelDoc; assertThat(discoveryNodeMarvelDoc.getIndex(), - equalTo(MarvelSettings.MARVEL_DATA_INDEX_PREFIX + MarvelTemplateUtils.TEMPLATE_VERSION)); + equalTo(MarvelSettings.MONITORING_DATA_INDEX_PREFIX + MarvelTemplateUtils.TEMPLATE_VERSION)); assertThat(discoveryNodeMarvelDoc.getId(), not(isEmptyOrNullString())); assertNotNull(discoveryNodeMarvelDoc.getNode()); discoveryNodes.add(discoveryNodeMarvelDoc); } else { - fail("unknown marvel document type " + marvelDoc.getType()); + fail("unknown monitoring document type " + marvelDoc.getType()); } } diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/cluster/ClusterStatsCollectorTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/cluster/ClusterStatsCollectorTests.java index 7b4df789847..7095a9e19d2 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/cluster/ClusterStatsCollectorTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/cluster/ClusterStatsCollectorTests.java @@ -14,7 +14,7 @@ import org.elasticsearch.license.plugin.core.LicensesManagerService; import org.elasticsearch.marvel.agent.collector.AbstractCollector; import org.elasticsearch.marvel.agent.collector.AbstractCollectorTestCase; import org.elasticsearch.marvel.agent.exporter.MarvelDoc; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.license.MarvelLicensee; import java.util.Collection; diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexRecoveryCollectorTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexRecoveryCollectorTests.java index f53defd2eb9..e27622045f7 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexRecoveryCollectorTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexRecoveryCollectorTests.java @@ -15,7 +15,7 @@ import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.indices.recovery.RecoveryState; import org.elasticsearch.marvel.agent.collector.AbstractCollectorTestCase; import org.elasticsearch.marvel.agent.exporter.MarvelDoc; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.license.MarvelLicensee; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; @@ -47,8 +47,8 @@ public class IndexRecoveryCollectorTests extends AbstractCollectorTestCase { protected Settings nodeSettings(int nodeOrdinal) { return settingsBuilder() .put(super.nodeSettings(nodeOrdinal)) - .put(MarvelSettings.INDEX_RECOVERY_ACTIVE_ONLY_SETTING.getKey(), activeOnly) - .put(MarvelSettings.INDICES_SETTING.getKey(), indexName) + .put(MarvelSettings.INDEX_RECOVERY_ACTIVE_ONLY.getKey(), activeOnly) + .put(MarvelSettings.INDICES.getKey(), indexName) .build(); } @@ -60,7 +60,7 @@ public class IndexRecoveryCollectorTests extends AbstractCollectorTestCase { logger.info("--> collect index recovery data"); Collection results = newIndexRecoveryCollector(node1).doCollect(); - logger.info("--> no indices created, expecting 0 marvel documents"); + logger.info("--> no indices created, expecting 0 monitoring documents"); assertNotNull(results); assertThat(results, is(empty())); @@ -167,7 +167,7 @@ public class IndexRecoveryCollectorTests extends AbstractCollectorTestCase { } public void testEmptyCluster() throws Exception { - final String node = internalCluster().startNode(settingsBuilder().put(MarvelSettings.INDICES_SETTING.getKey(), + final String node = internalCluster().startNode(settingsBuilder().put(MarvelSettings.INDICES.getKey(), Strings.EMPTY_ARRAY)); waitForNoBlocksOnNode(node); @@ -179,7 +179,7 @@ public class IndexRecoveryCollectorTests extends AbstractCollectorTestCase { } public void testEmptyClusterAllIndices() throws Exception { - final String node = internalCluster().startNode(settingsBuilder().put(MarvelSettings.INDICES_SETTING.getKey(), MetaData.ALL)); + final String node = internalCluster().startNode(settingsBuilder().put(MarvelSettings.INDICES.getKey(), MetaData.ALL)); waitForNoBlocksOnNode(node); try { @@ -190,7 +190,7 @@ public class IndexRecoveryCollectorTests extends AbstractCollectorTestCase { } public void testEmptyClusterMissingIndex() throws Exception { - final String node = internalCluster().startNode(settingsBuilder().put(MarvelSettings.INDICES_SETTING.getKey(), "unknown")); + final String node = internalCluster().startNode(settingsBuilder().put(MarvelSettings.INDICES.getKey(), "unknown")); waitForNoBlocksOnNode(node); try { diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexStatsCollectorTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexStatsCollectorTests.java index 10cdc2948e1..a428432d9d4 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexStatsCollectorTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexStatsCollectorTests.java @@ -13,7 +13,7 @@ import org.elasticsearch.discovery.DiscoveryService; import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.marvel.agent.collector.AbstractCollectorTestCase; import org.elasticsearch.marvel.agent.exporter.MarvelDoc; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.license.MarvelLicensee; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; @@ -51,7 +51,7 @@ public class IndexStatsCollectorTests extends AbstractCollectorTestCase { } public void testEmptyClusterAllIndices() throws Exception { - final String node = internalCluster().startNode(settingsBuilder().put(MarvelSettings.INDICES_SETTING.getKey(), MetaData.ALL)); + final String node = internalCluster().startNode(settingsBuilder().put(MarvelSettings.INDICES.getKey(), MetaData.ALL)); waitForNoBlocksOnNode(node); try { @@ -62,7 +62,7 @@ public class IndexStatsCollectorTests extends AbstractCollectorTestCase { } public void testEmptyClusterMissingIndex() throws Exception { - final String node = internalCluster().startNode(settingsBuilder().put(MarvelSettings.INDICES_SETTING.getKey(), "unknown")); + final String node = internalCluster().startNode(settingsBuilder().put(MarvelSettings.INDICES.getKey(), "unknown")); waitForNoBlocksOnNode(node); try { diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndicesStatsCollectorTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndicesStatsCollectorTests.java index a9eb00e9b80..82afc7f2ed2 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndicesStatsCollectorTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndicesStatsCollectorTests.java @@ -15,7 +15,7 @@ import org.elasticsearch.discovery.DiscoveryService; import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.marvel.agent.collector.AbstractCollectorTestCase; import org.elasticsearch.marvel.agent.exporter.MarvelDoc; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.license.MarvelLicensee; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; @@ -51,7 +51,7 @@ public class IndicesStatsCollectorTests extends AbstractCollectorTestCase { } public void testEmptyClusterAllIndices() throws Exception { - final String node = internalCluster().startNode(settingsBuilder().put(MarvelSettings.INDICES_SETTING.getKey(), MetaData.ALL)); + final String node = internalCluster().startNode(settingsBuilder().put(MarvelSettings.INDICES.getKey(), MetaData.ALL)); waitForNoBlocksOnNode(node); try { @@ -62,7 +62,7 @@ public class IndicesStatsCollectorTests extends AbstractCollectorTestCase { } public void testEmptyClusterMissingIndex() throws Exception { - final String node = internalCluster().startNode(settingsBuilder().put(MarvelSettings.INDICES_SETTING.getKey(), "unknown")); + final String node = internalCluster().startNode(settingsBuilder().put(MarvelSettings.INDICES.getKey(), "unknown")); waitForNoBlocksOnNode(node); try { diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/node/NodeStatsCollectorTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/node/NodeStatsCollectorTests.java index 7354bb28074..8bb3a763387 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/node/NodeStatsCollectorTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/node/NodeStatsCollectorTests.java @@ -13,7 +13,7 @@ import org.elasticsearch.discovery.DiscoveryService; import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.marvel.agent.collector.AbstractCollectorTestCase; import org.elasticsearch.marvel.agent.exporter.MarvelDoc; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.license.MarvelLicensee; import org.elasticsearch.shield.InternalClient; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/shards/ShardsCollectorTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/shards/ShardsCollectorTests.java index c5f53a99af3..03034d198a2 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/shards/ShardsCollectorTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/shards/ShardsCollectorTests.java @@ -12,7 +12,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.DiscoveryService; import org.elasticsearch.marvel.agent.collector.AbstractCollectorTestCase; import org.elasticsearch.marvel.agent.exporter.MarvelDoc; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.license.MarvelLicensee; import java.util.Collection; @@ -37,7 +37,7 @@ public class ShardsCollectorTests extends AbstractCollectorTestCase { protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - .put(MarvelSettings.INDICES_SETTING.getKey(), "test-shards*") + .put(MarvelSettings.INDICES.getKey(), "test-shards*") .build(); } @@ -150,7 +150,7 @@ public class ShardsCollectorTests extends AbstractCollectorTestCase { for (int i = 0; i < nbIndices; i++) { String index = indexPrefix + String.valueOf(i); int total = getNumShards(index).totalNumShards; - assertThat("expecting " + total + " shards marvel documents for index [" + index + "]", shards[i], equalTo(total)); + assertThat("expecting " + total + " shards monitoring documents for index [" + index + "]", shards[i], equalTo(total)); } } diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/AbstractExporterTemplateTestCase.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/AbstractExporterTemplateTestCase.java index d756044f1b9..d262dbb2df2 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/AbstractExporterTemplateTestCase.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/AbstractExporterTemplateTestCase.java @@ -9,7 +9,7 @@ import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.marvel.agent.collector.Collector; import org.elasticsearch.marvel.agent.collector.cluster.ClusterStatsCollector; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; @@ -30,10 +30,10 @@ public abstract class AbstractExporterTemplateTestCase extends MarvelIntegTestCa protected Settings nodeSettings(int nodeOrdinal) { Settings.Builder settings = Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1"); + .put(MarvelSettings.INTERVAL.getKey(), "-1"); for (Map.Entry setting : exporterSettings().getAsMap().entrySet()) { - settings.put("marvel.agent.exporters._exporter." + setting.getKey(), setting.getValue()); + settings.put("xpack.monitoring.agent.exporters._exporter." + setting.getKey(), setting.getValue()); } return settings.build(); } @@ -163,7 +163,7 @@ public abstract class AbstractExporterTemplateTestCase extends MarvelIntegTestCa } private String currentDataIndexName() { - return ".marvel-es-data-" + String.valueOf(currentVersion); + return ".monitoring-es-data-" + String.valueOf(currentVersion); } private String currentTimestampedIndexName() { @@ -177,7 +177,7 @@ public abstract class AbstractExporterTemplateTestCase extends MarvelIntegTestCa .startObject("settings") .field("index.number_of_shards", 1) .field("index.number_of_replicas", 1) - .field(MarvelTemplateUtils.VERSION_FIELD, String.valueOf(version)) + .field(MarvelSettings.INDEX_TEMPLATE_VERSION.getKey(), String.valueOf(version)) .endObject() .startObject("mappings") .startObject("_default_") diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/ExportersTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/ExportersTests.java index f117e960cc6..13884409bd1 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/ExportersTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/ExportersTests.java @@ -13,7 +13,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.marvel.agent.exporter.local.LocalExporter; import org.elasticsearch.marvel.agent.renderer.RendererRegistry; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.cleaner.CleanerService; import org.elasticsearch.shield.InternalClient; import org.elasticsearch.test.ESTestCase; @@ -59,8 +59,8 @@ public class ExportersTests extends ESTestCase { // we always need to have the local exporter as it serves as the default one factories.put(LocalExporter.TYPE, new LocalExporter.Factory(new InternalClient.Insecure(client), clusterService, mock(RendererRegistry.class), mock(CleanerService.class))); - clusterSettings = new ClusterSettings(Settings.EMPTY, new HashSet<>(Arrays.asList(MarvelSettings.COLLECTORS_SETTING, - MarvelSettings.INTERVAL_SETTING, Exporters.EXPORTERS_SETTING))); + clusterSettings = new ClusterSettings(Settings.EMPTY, new HashSet<>(Arrays.asList(MarvelSettings.COLLECTORS, + MarvelSettings.INTERVAL, MarvelSettings.EXPORTERS_SETTINGS))); exporters = new Exporters(Settings.EMPTY, factories, clusterService, clusterSettings); } @@ -175,8 +175,8 @@ public class ExportersTests extends ESTestCase { final AtomicReference settingsHolder = new AtomicReference<>(); exporters = new Exporters(Settings.builder() - .put("marvel.agent.exporters._name0.type", "_type") - .put("marvel.agent.exporters._name1.type", "_type") + .put("xpack.monitoring.agent.exporters._name0.type", "_type") + .put("xpack.monitoring.agent.exporters._name1.type", "_type") .build(), factories, clusterService, clusterSettings) { @Override CurrentExporters initExporters(Settings settings) { @@ -193,8 +193,8 @@ public class ExportersTests extends ESTestCase { assertThat(settings, hasEntry("_name1.type", "_type")); Settings update = Settings.builder() - .put("marvel.agent.exporters._name0.foo", "bar") - .put("marvel.agent.exporters._name1.foo", "bar") + .put("xpack.monitoring.agent.exporters._name0.foo", "bar") + .put("xpack.monitoring.agent.exporters._name1.foo", "bar") .build(); clusterSettings.applySettings(update); assertThat(settingsHolder.get(), notNullValue()); @@ -212,8 +212,8 @@ public class ExportersTests extends ESTestCase { factories.put("mock", factory); factories.put("mock_master_only", masterOnlyFactory); Exporters exporters = new Exporters(Settings.builder() - .put("marvel.agent.exporters._name0.type", "mock") - .put("marvel.agent.exporters._name1.type", "mock_master_only") + .put("xpack.monitoring.agent.exporters._name0.type", "mock") + .put("xpack.monitoring.agent.exporters._name1.type", "mock_master_only") .build(), factories, clusterService, clusterSettings); exporters.start(); @@ -236,8 +236,8 @@ public class ExportersTests extends ESTestCase { factories.put("mock", factory); factories.put("mock_master_only", masterOnlyFactory); Exporters exporters = new Exporters(Settings.builder() - .put("marvel.agent.exporters._name0.type", "mock") - .put("marvel.agent.exporters._name1.type", "mock_master_only") + .put("xpack.monitoring.agent.exporters._name0.type", "mock") + .put("xpack.monitoring.agent.exporters._name1.type", "mock_master_only") .build(), factories, clusterService, clusterSettings); exporters.start(); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/MarvelTemplateUtilsTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/MarvelTemplateUtilsTests.java index 0b331686622..9c4e65be388 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/MarvelTemplateUtilsTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/MarvelTemplateUtilsTests.java @@ -12,8 +12,6 @@ import java.io.IOException; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; -//import static org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils.MARVEL_VERSION_FIELD; - public class MarvelTemplateUtilsTests extends ESTestCase { public void testLoadTimestampedIndexTemplate() { @@ -46,13 +44,13 @@ public class MarvelTemplateUtilsTests extends ESTestCase { assertThat(MarvelTemplateUtils.indexTemplateName(), equalTo(MarvelTemplateUtils.INDEX_TEMPLATE_NAME_PREFIX + MarvelTemplateUtils.TEMPLATE_VERSION)); int version = randomIntBetween(1, 100); - assertThat(MarvelTemplateUtils.indexTemplateName(version), equalTo(".marvel-es-" + version)); + assertThat(MarvelTemplateUtils.indexTemplateName(version), equalTo(".monitoring-es-" + version)); } public void testDataTemplateName() { assertThat(MarvelTemplateUtils.dataTemplateName(), equalTo(MarvelTemplateUtils.DATA_TEMPLATE_NAME_PREFIX + MarvelTemplateUtils.TEMPLATE_VERSION)); int version = randomIntBetween(1, 100); - assertThat(MarvelTemplateUtils.dataTemplateName(version), equalTo(".marvel-es-data-" + version)); + assertThat(MarvelTemplateUtils.dataTemplateName(version), equalTo(".monitoring-es-data-" + version)); } } diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/http/HttpExporterTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/http/HttpExporterTests.java index ecf39de69d8..493f9fac281 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/http/HttpExporterTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/http/HttpExporterTests.java @@ -29,7 +29,7 @@ import org.elasticsearch.marvel.agent.collector.indices.IndexRecoveryMarvelDoc; import org.elasticsearch.marvel.agent.exporter.Exporters; import org.elasticsearch.marvel.agent.exporter.MarvelDoc; import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.Scope; @@ -94,11 +94,11 @@ public class HttpExporterTests extends MarvelIntegTestCase { enqueueResponse(200, "successful bulk request "); Settings.Builder builder = Settings.builder() - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") - .put("marvel.agent.exporters._http.type", "http") - .put("marvel.agent.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort()) - .put("marvel.agent.exporters._http.connection.keep_alive", false) - .put("marvel.agent.exporters._http.update_mappings", false); + .put(MarvelSettings.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); String agentNode = internalCluster().startNode(builder); HttpExporter exporter = getExporter(agentNode); @@ -140,35 +140,35 @@ public class HttpExporterTests extends MarvelIntegTestCase { public void testDynamicHostChange() { // disable exporting to be able to use non valid hosts Settings.Builder builder = Settings.builder() - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") - .put("marvel.agent.exporters._http.type", "http") - .put("marvel.agent.exporters._http.host", "test0"); + .put(MarvelSettings.INTERVAL.getKey(), "-1") + .put("xpack.monitoring.agent.exporters._http.type", "http") + .put("xpack.monitoring.agent.exporters._http.host", "test0"); String nodeName = internalCluster().startNode(builder); assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder() - .putArray("marvel.agent.exporters._http.host", "test1"))); + .putArray("xpack.monitoring.agent.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("marvel.agent.exporters._http.host", "test2") - .put("marvel.agent.exporters._http.host", ""))); + .putArray("xpack.monitoring.agent.exporters._http.host", "test2") + .put("xpack.monitoring.agent.exporters._http.host", ""))); assertThat(getExporter(nodeName).hosts, Matchers.arrayContaining("test2")); assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder() - .putArray("marvel.agent.exporters._http.host", "test3"))); + .putArray("xpack.monitoring.agent.exporters._http.host", "test3"))); assertThat(getExporter(nodeName).hosts, Matchers.arrayContaining("test3")); } public void testHostChangeReChecksTemplate() throws Exception { Settings.Builder builder = Settings.builder() - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") - .put("marvel.agent.exporters._http.type", "http") - .put("marvel.agent.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort()) - .put("marvel.agent.exporters._http.connection.keep_alive", false) - .put("marvel.agent.exporters._http.update_mappings", false); + .put(MarvelSettings.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); logger.info("--> starting node"); @@ -236,7 +236,7 @@ public class HttpExporterTests extends MarvelIntegTestCase { assertNotNull("Unable to start the second mock web server", secondWebServer); assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings( - Settings.builder().putArray("marvel.agent.exporters._http.host", + Settings.builder().putArray("xpack.monitoring.agent.exporters._http.host", secondWebServer.getHostName() + ":" + secondWebServer.getPort())).get()); // a new exporter is created on update, so we need to re-fetch it @@ -283,10 +283,10 @@ public class HttpExporterTests extends MarvelIntegTestCase { public void testUnsupportedClusterVersion() throws Exception { Settings.Builder builder = Settings.builder() - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") - .put("marvel.agent.exporters._http.type", "http") - .put("marvel.agent.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort()) - .put("marvel.agent.exporters._http.connection.keep_alive", false); + .put(MarvelSettings.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); logger.info("--> starting node"); @@ -310,11 +310,11 @@ public class HttpExporterTests extends MarvelIntegTestCase { public void testDynamicIndexFormatChange() throws Exception { Settings.Builder builder = Settings.builder() - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") - .put("marvel.agent.exporters._http.type", "http") - .put("marvel.agent.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort()) - .put("marvel.agent.exporters._http.connection.keep_alive", false) - .put("marvel.agent.exporters._http.update_mappings", false); + .put(MarvelSettings.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); String agentNode = internalCluster().startNode(builder); @@ -371,7 +371,7 @@ public class HttpExporterTests extends MarvelIntegTestCase { 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("marvel.agent.exporters._http.index.name.time_format", newTimeFormat))); + .put("xpack.monitoring.agent.exporters._http.index.name.time_format", newTimeFormat))); logger.info("--> exporting a second event"); @@ -385,7 +385,7 @@ public class HttpExporterTests extends MarvelIntegTestCase { exporter = getExporter(agentNode); exporter.export(Collections.singletonList(doc)); - String expectedMarvelIndex = MarvelSettings.MARVEL_INDICES_PREFIX + MarvelTemplateUtils.TEMPLATE_VERSION + "-" + String expectedMarvelIndex = MarvelSettings.MONITORING_INDICES_PREFIX + MarvelTemplateUtils.TEMPLATE_VERSION + "-" + DateTimeFormat.forPattern(newTimeFormat).withZoneUTC().print(doc.getTimestamp()); assertThat(webServer.getRequestCount(), equalTo(6 + 4)); @@ -418,10 +418,10 @@ public class HttpExporterTests extends MarvelIntegTestCase { final String host = webServer.getHostName() + ":" + webServer.getPort(); Settings.Builder builder = Settings.builder() - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") - .put("marvel.agent.exporters._http.type", "http") - .put("marvel.agent.exporters._http.host", host) - .put("marvel.agent.exporters._http.connection.keep_alive", false); + .put(MarvelSettings.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); String agentNode = internalCluster().startNode(builder); HttpExporter exporter = getExporter(agentNode); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/local/LocalExporterTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/local/LocalExporterTests.java index eee3e6531a6..2099a4c8f9c 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/local/LocalExporterTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/exporter/local/LocalExporterTests.java @@ -19,7 +19,7 @@ import org.elasticsearch.marvel.agent.exporter.Exporter; import org.elasticsearch.marvel.agent.exporter.Exporters; import org.elasticsearch.marvel.agent.exporter.MarvelDoc; import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.search.SearchHit; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; @@ -52,7 +52,7 @@ public class LocalExporterTests extends MarvelIntegTestCase { protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") + .put(MarvelSettings.INTERVAL.getKey(), "-1") .build(); } @@ -64,14 +64,14 @@ public class LocalExporterTests extends MarvelIntegTestCase { public void testSimpleExport() throws Exception { internalCluster().startNode(Settings.builder() - .put("marvel.agent.exporters._local.type", LocalExporter.TYPE) - .put("marvel.agent.exporters._local.enabled", true) + .put("xpack.monitoring.agent.exporters._local.type", LocalExporter.TYPE) + .put("xpack.monitoring.agent.exporters._local.enabled", true) .build()); securedEnsureGreen(); Exporter exporter = getLocalExporter("_local"); - logger.debug("--> exporting a single marvel doc"); + logger.debug("--> exporting a single monitoring doc"); exporter.export(Collections.singletonList(newRandomMarvelDoc())); awaitMarvelDocsCount(is(1L)); @@ -82,11 +82,11 @@ public class LocalExporterTests extends MarvelIntegTestCase { marvelDocs.add(newRandomMarvelDoc()); } - logger.debug("--> exporting {} marvel docs", marvelDocs.size()); + logger.debug("--> exporting {} monitoring docs", marvelDocs.size()); exporter.export(marvelDocs); awaitMarvelDocsCount(is((long) marvelDocs.size())); - SearchResponse response = client().prepareSearch(MarvelSettings.MARVEL_INDICES_PREFIX + "*").get(); + SearchResponse response = client().prepareSearch(MarvelSettings.MONITORING_INDICES_PREFIX + "*").get(); for (SearchHit hit : response.getHits().hits()) { Map source = hit.sourceAsMap(); assertNotNull(source.get("cluster_uuid")); @@ -96,14 +96,14 @@ public class LocalExporterTests extends MarvelIntegTestCase { public void testTemplateCreation() throws Exception { internalCluster().startNode(Settings.builder() - .put("marvel.agent.exporters._local.type", LocalExporter.TYPE) + .put("xpack.monitoring.agent.exporters._local.type", LocalExporter.TYPE) .build()); securedEnsureGreen(); // start collecting updateMarvelInterval(3L, TimeUnit.SECONDS); - // lets wait until the marvel template will be installed + // lets wait until the monitoring template will be installed waitForMarvelTemplate(indexTemplateName()); waitForMarvelTemplate(dataTemplateName()); } @@ -113,33 +113,33 @@ public class LocalExporterTests extends MarvelIntegTestCase { String timeFormat = randomFrom("YY", "YYYY", "YYYY.MM", "YYYY-MM", "MM.YYYY", "MM"); internalCluster().startNode(Settings.builder() - .put("marvel.agent.exporters._local.type", LocalExporter.TYPE) - .put("marvel.agent.exporters._local." + LocalExporter.INDEX_NAME_TIME_FORMAT_SETTING, timeFormat) + .put("xpack.monitoring.agent.exporters._local.type", LocalExporter.TYPE) + .put("xpack.monitoring.agent.exporters._local." + LocalExporter.INDEX_NAME_TIME_FORMAT_SETTING, timeFormat) .build()); securedEnsureGreen(); LocalExporter exporter = getLocalExporter("_local"); // first lets test that the index resolver works with time - String indexName = MarvelSettings.MARVEL_INDICES_PREFIX + MarvelTemplateUtils.TEMPLATE_VERSION + "-" + + String indexName = MarvelSettings.MONITORING_INDICES_PREFIX + MarvelTemplateUtils.TEMPLATE_VERSION + "-" + DateTimeFormat.forPattern(timeFormat).withZoneUTC().print(time); assertThat(exporter.indexNameResolver().resolve(time), equalTo(indexName)); // now lets test that the index name resolver works with a doc MarvelDoc doc = newRandomMarvelDoc(); - indexName = MarvelSettings.MARVEL_INDICES_PREFIX + MarvelTemplateUtils.TEMPLATE_VERSION + "-" + + indexName = MarvelSettings.MONITORING_INDICES_PREFIX + MarvelTemplateUtils.TEMPLATE_VERSION + "-" + DateTimeFormat.forPattern(timeFormat).withZoneUTC().print(doc.getTimestamp()); assertThat(exporter.indexNameResolver().resolve(doc), equalTo(indexName)); - logger.debug("--> exporting a random marvel document"); + logger.debug("--> exporting a random monitoring document"); exporter.export(Collections.singletonList(doc)); awaitIndexExists(indexName); logger.debug("--> updates the timestamp"); timeFormat = randomFrom("dd", "dd.MM.YYYY", "dd.MM"); - updateClusterSettings(Settings.builder().put("marvel.agent.exporters._local.index.name.time_format", timeFormat)); + updateClusterSettings(Settings.builder().put("xpack.monitoring.agent.exporters._local.index.name.time_format", timeFormat)); exporter = getLocalExporter("_local"); // we need to get it again.. as it was rebuilt - indexName = MarvelSettings.MARVEL_INDICES_PREFIX + MarvelTemplateUtils.TEMPLATE_VERSION + "-" + + indexName = MarvelSettings.MONITORING_INDICES_PREFIX + MarvelTemplateUtils.TEMPLATE_VERSION + "-" + DateTimeFormat.forPattern(timeFormat).withZoneUTC().print(doc.getTimestamp()); assertThat(exporter.indexNameResolver().resolve(doc), equalTo(indexName)); @@ -151,23 +151,23 @@ public class LocalExporterTests extends MarvelIntegTestCase { public void testLocalExporterFlush() throws Exception { internalCluster().startNode(Settings.builder() - .put("marvel.agent.exporters._local.type", LocalExporter.TYPE) - .put("marvel.agent.exporters._local.enabled", true) + .put("xpack.monitoring.agent.exporters._local.type", LocalExporter.TYPE) + .put("xpack.monitoring.agent.exporters._local.enabled", true) .build()); securedEnsureGreen(); LocalExporter exporter = getLocalExporter("_local"); - logger.debug("--> exporting a single marvel doc"); + logger.debug("--> exporting a single monitoring doc"); exporter.export(Collections.singletonList(newRandomMarvelDoc())); awaitMarvelDocsCount(is(1L)); assertNull(exporter.getBulk().requestBuilder); - logger.debug("--> closing marvel indices"); - assertAcked(client().admin().indices().prepareClose(MarvelSettings.MARVEL_INDICES_PREFIX + "*").get()); + logger.debug("--> closing monitoring indices"); + assertAcked(client().admin().indices().prepareClose(MarvelSettings.MONITORING_INDICES_PREFIX + "*").get()); try { - logger.debug("--> exporting a second marvel doc"); + logger.debug("--> exporting a second monitoring doc"); exporter.export(Collections.singletonList(newRandomMarvelDoc())); } catch (ElasticsearchException e) { assertThat(e.getMessage(), allOf(containsString("failure in bulk execution"), containsString("IndexClosedException[closed]"))); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterInfoTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterInfoTests.java index 04b4159ce1e..3d03fee22f9 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterInfoTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterInfoTests.java @@ -13,7 +13,7 @@ import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.license.core.License; import org.elasticsearch.marvel.agent.collector.cluster.ClusterStatsCollector; import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.junit.After; @@ -39,8 +39,8 @@ public class ClusterInfoTests extends MarvelIntegTestCase { protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") - .put(MarvelSettings.COLLECTORS_SETTING.getKey(), ClusterStatsCollector.NAME) + .put(MarvelSettings.INTERVAL.getKey(), "-1") + .put(MarvelSettings.COLLECTORS.getKey(), ClusterStatsCollector.NAME) .build(); } @@ -61,8 +61,8 @@ public class ClusterInfoTests extends MarvelIntegTestCase { final String clusterUUID = client().admin().cluster().prepareState().setMetaData(true).get().getState().metaData().clusterUUID(); assertTrue(Strings.hasText(clusterUUID)); - logger.debug("--> waiting for the marvel data index to be created (it should have been created by the ClusterInfoCollector)"); - String dataIndex = ".marvel-es-data-" + MarvelTemplateUtils.TEMPLATE_VERSION; + logger.debug("--> waiting for the monitoring data index to be created (it should have been created by the ClusterInfoCollector)"); + String dataIndex = ".monitoring-es-data-" + MarvelTemplateUtils.TEMPLATE_VERSION; awaitIndexExists(dataIndex); logger.debug("--> waiting for cluster info collector to collect data"); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStateRendererTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStateRendererTests.java index fa3ed4bd42f..d96983bf7d8 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStateRendererTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStateRendererTests.java @@ -32,7 +32,7 @@ public class ClusterStateRendererTests extends ESSingleNodeTestCase { logger.debug("--> retrieving cluster health"); ClusterHealthResponse clusterHealth = client().admin().cluster().prepareHealth().get(); - logger.debug("--> creating the cluster state marvel document"); + logger.debug("--> creating the cluster state monitoring document"); ClusterStateMarvelDoc marvelDoc = new ClusterStateMarvelDoc(); marvelDoc.setClusterUUID("test"); marvelDoc.setType("cluster_state"); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStateTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStateTests.java index 2442b56718c..dfb44d72f8a 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStateTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStateTests.java @@ -10,10 +10,9 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.QueryBuilders; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.agent.collector.cluster.ClusterStateCollector; -import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils; import org.elasticsearch.marvel.agent.renderer.AbstractRenderer; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.search.SearchHit; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; @@ -25,6 +24,8 @@ import java.util.Map; import java.util.concurrent.TimeUnit; import static org.elasticsearch.index.query.QueryBuilders.matchQuery; +import static org.elasticsearch.marvel.MarvelSettings.MONITORING_INDICES_PREFIX; +import static org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils.TEMPLATE_VERSION; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.greaterThanOrEqualTo; @@ -38,9 +39,9 @@ public class ClusterStateTests extends MarvelIntegTestCase { protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") - .put(MarvelSettings.COLLECTORS_SETTING.getKey(), ClusterStateCollector.NAME) - .put("marvel.agent.exporters.default_local.type", "local") + .put(MarvelSettings.INTERVAL.getKey(), "-1") + .put(MarvelSettings.COLLECTORS.getKey(), ClusterStateCollector.NAME) + .put("xpack.monitoring.agent.exporters.default_local.type", "local") .build(); } @@ -60,7 +61,7 @@ public class ClusterStateTests extends MarvelIntegTestCase { logger.debug("--> waiting for documents to be collected"); awaitMarvelDocsCount(greaterThan(0L), ClusterStateCollector.TYPE); - logger.debug("--> searching for marvel documents of type [{}]", ClusterStateCollector.TYPE); + logger.debug("--> searching for monitoring documents of type [{}]", ClusterStateCollector.TYPE); SearchResponse response = client().prepareSearch().setTypes(ClusterStateCollector.TYPE).get(); assertThat(response.getHits().getTotalHits(), greaterThan(0L)); @@ -85,7 +86,7 @@ public class ClusterStateTests extends MarvelIntegTestCase { logger.debug("--> waiting for documents to be collected"); awaitMarvelDocsCount(greaterThan(0L), ClusterStateCollector.TYPE); - logger.debug("--> searching for marvel documents of type [{}]", ClusterStateCollector.TYPE); + logger.debug("--> searching for monitoring documents of type [{}]", ClusterStateCollector.TYPE); SearchResponse response = client().prepareSearch().setTypes(ClusterStateCollector.TYPE).get(); assertThat(response.getHits().getTotalHits(), greaterThan(0L)); @@ -103,8 +104,8 @@ public class ClusterStateTests extends MarvelIntegTestCase { logger.debug("--> waiting for documents to be collected"); awaitMarvelDocsCount(greaterThanOrEqualTo(nbNodes), ClusterStateCollector.NODE_TYPE); - logger.debug("--> searching for marvel documents of type [{}]", ClusterStateCollector.NODE_TYPE); - SearchResponse response = client().prepareSearch(MarvelSettings.MARVEL_INDICES_PREFIX + MarvelTemplateUtils.TEMPLATE_VERSION + "-*") + logger.debug("--> searching for monitoring documents of type [{}]", ClusterStateCollector.NODE_TYPE); + SearchResponse response = client().prepareSearch(MONITORING_INDICES_PREFIX + TEMPLATE_VERSION + "-*") .setTypes(ClusterStateCollector.NODE_TYPE).get(); assertThat(response.getHits().getTotalHits(), greaterThanOrEqualTo(nbNodes)); @@ -135,8 +136,8 @@ public class ClusterStateTests extends MarvelIntegTestCase { logger.debug("--> waiting for documents to be collected"); awaitMarvelDocsCount(greaterThanOrEqualTo(nbNodes), ClusterStateCollector.NODE_TYPE); - logger.debug("--> searching for marvel documents of type [{}]", ClusterStateCollector.NODE_TYPE); - SearchResponse response = client().prepareSearch(MarvelSettings.MARVEL_DATA_INDEX_PREFIX + "*") + logger.debug("--> searching for monitoring documents of type [{}]", ClusterStateCollector.NODE_TYPE); + SearchResponse response = client().prepareSearch(MarvelSettings.MONITORING_DATA_INDEX_PREFIX + "*") .setTypes(ClusterStateCollector.NODE_TYPE).get(); assertThat(response.getHits().getTotalHits(), greaterThanOrEqualTo(nbNodes)); @@ -163,9 +164,9 @@ public class ClusterStateTests extends MarvelIntegTestCase { for (final String nodeName : internalCluster().getNodeNames()) { final String nodeId = internalCluster().clusterService(nodeName).localNode().getId(); - final String dataIndex = ".marvel-es-data-" + MarvelTemplateUtils.TEMPLATE_VERSION; + final String dataIndex = ".monitoring-es-data-" + TEMPLATE_VERSION; - logger.debug("--> getting marvel document for node id [{}]", nodeId); + logger.debug("--> getting monitoring document for node id [{}]", nodeId); assertThat(client().prepareGet(dataIndex, ClusterStateCollector.NODE_TYPE, nodeId).get().isExists(), is(true)); // checks that document is not indexed diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStatsRendererTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStatsRendererTests.java index 423165e3eb6..6f466c021b0 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStatsRendererTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStatsRendererTests.java @@ -21,7 +21,7 @@ public class ClusterStatsRendererTests extends ESSingleNodeTestCase { logger.debug("--> retrieving cluster stats response"); ClusterStatsResponse clusterStats = client().admin().cluster().prepareClusterStats().get(); - logger.debug("--> creating the cluster stats marvel document"); + logger.debug("--> creating the cluster stats monitoring document"); ClusterStatsMarvelDoc marvelDoc = new ClusterStatsMarvelDoc(); marvelDoc.setClusterUUID("test"); marvelDoc.setType("cluster_stats"); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStatsTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStatsTests.java index b399143666d..8e0966b05f4 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStatsTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStatsTests.java @@ -9,7 +9,7 @@ import org.elasticsearch.action.admin.cluster.stats.ClusterStatsNodes; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.marvel.agent.collector.cluster.ClusterStatsCollector; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.search.SearchHit; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; @@ -29,9 +29,9 @@ public class ClusterStatsTests extends MarvelIntegTestCase { protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") - .put(MarvelSettings.COLLECTORS_SETTING.getKey(), ClusterStatsCollector.NAME) - .put("marvel.agent.exporters.default_local.type", "local") + .put(MarvelSettings.INTERVAL.getKey(), "-1") + .put(MarvelSettings.COLLECTORS.getKey(), ClusterStatsCollector.NAME) + .put("xpack.monitoring.agent.exporters.default_local.type", "local") .build(); } diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexRecoveryRendererTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexRecoveryRendererTests.java index e8591527ba2..886f4b3e115 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexRecoveryRendererTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexRecoveryRendererTests.java @@ -26,7 +26,7 @@ public class IndexRecoveryRendererTests extends ESTestCase { private static final String SAMPLE_FILE = "/samples/index_recovery.json"; public void testIndexRecoveryRenderer() throws Exception { - logger.debug("--> creating the index recovery marvel document"); + logger.debug("--> creating the index recovery monitoring document"); String indexName = "index-0"; DiscoveryNode source = new DiscoveryNode("node-src", DummyTransportAddress.INSTANCE, Version.CURRENT); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexRecoveryTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexRecoveryTests.java index b2a0e123e41..29f8cda2c6f 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexRecoveryTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexRecoveryTests.java @@ -11,7 +11,7 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.marvel.agent.collector.indices.IndexRecoveryCollector; import org.elasticsearch.marvel.agent.renderer.AbstractRenderer; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.search.SearchHit; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; @@ -34,10 +34,10 @@ public class IndexRecoveryTests extends MarvelIntegTestCase { protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") - .put(MarvelSettings.INDICES_SETTING.getKey(), INDEX_PREFIX + "*") - .put(MarvelSettings.COLLECTORS_SETTING.getKey(), IndexRecoveryCollector.NAME) - .put("marvel.agent.exporters.default_local.type", "local") + .put(MarvelSettings.INTERVAL.getKey(), "-1") + .put(MarvelSettings.INDICES.getKey(), INDEX_PREFIX + "*") + .put(MarvelSettings.COLLECTORS.getKey(), IndexRecoveryCollector.NAME) + .put("xpack.monitoring.agent.exporters.default_local.type", "local") .build(); } @@ -73,8 +73,8 @@ public class IndexRecoveryTests extends MarvelIntegTestCase { String clusterUUID = client().admin().cluster().prepareState().setMetaData(true).get().getState().metaData().clusterUUID(); assertTrue(Strings.hasText(clusterUUID)); - logger.debug("--> searching for marvel documents of type [{}]", IndexRecoveryCollector.TYPE); - SearchResponse response = client().prepareSearch(MarvelSettings.MARVEL_INDICES_PREFIX + "*") + logger.debug("--> searching for monitoring documents of type [{}]", IndexRecoveryCollector.TYPE); + SearchResponse response = client().prepareSearch(MarvelSettings.MONITORING_INDICES_PREFIX + "*") .setTypes(IndexRecoveryCollector.TYPE) .get(); assertThat(response.getHits().getTotalHits(), greaterThan(0L)); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexStatsRendererTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexStatsRendererTests.java index 316f8f1efff..f563d37b8d3 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexStatsRendererTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexStatsRendererTests.java @@ -26,7 +26,7 @@ public class IndexStatsRendererTests extends ESTestCase { private static final String SAMPLE_FILE = "/samples/index_stats.json"; public void testIndexStatsRenderer() throws Exception { - logger.debug("--> creating the index stats marvel document"); + logger.debug("--> creating the index stats monitoring document"); IndexStatsMarvelDoc marvelDoc = new IndexStatsMarvelDoc(); marvelDoc.setClusterUUID("test"); marvelDoc.setType("index_stats"); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexStatsTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexStatsTests.java index 8942436c731..df798dfdf13 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexStatsTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexStatsTests.java @@ -9,7 +9,7 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.marvel.agent.collector.indices.IndexStatsCollector; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.search.SearchHit; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; @@ -27,9 +27,9 @@ public class IndexStatsTests extends MarvelIntegTestCase { protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") - .put(MarvelSettings.COLLECTORS_SETTING.getKey(), IndexStatsCollector.NAME) - .put("marvel.agent.exporters.default_local.type", "local") + .put(MarvelSettings.INTERVAL.getKey(), "-1") + .put(MarvelSettings.COLLECTORS.getKey(), IndexStatsCollector.NAME) + .put("xpack.monitoring.agent.exporters.default_local.type", "local") .build(); } @@ -82,7 +82,7 @@ public class IndexStatsTests extends MarvelIntegTestCase { } }); - logger.debug("--> searching for marvel documents of type [{}]", IndexStatsCollector.TYPE); + logger.debug("--> searching for monitoring documents of type [{}]", IndexStatsCollector.TYPE); SearchResponse response = client().prepareSearch().setTypes(IndexStatsCollector.TYPE).get(); assertThat(response.getHits().getTotalHits(), greaterThan(0L)); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndicesStatsRendererTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndicesStatsRendererTests.java index ab72fd04be9..d2feee0a5c9 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndicesStatsRendererTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndicesStatsRendererTests.java @@ -21,7 +21,7 @@ public class IndicesStatsRendererTests extends ESSingleNodeTestCase { logger.debug("--> retrieving indices stats response"); IndicesStatsResponse indicesStats = client().admin().indices().prepareStats().get(); - logger.debug("--> creating the indices stats marvel document"); + logger.debug("--> creating the indices stats monitoring document"); IndicesStatsMarvelDoc marvelDoc = new IndicesStatsMarvelDoc(); marvelDoc.setClusterUUID("test"); marvelDoc.setType("indices_stats"); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndicesStatsTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndicesStatsTests.java index 94fa102eb08..f669b40b8cc 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndicesStatsTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndicesStatsTests.java @@ -9,7 +9,7 @@ import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.marvel.agent.collector.indices.IndicesStatsCollector; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.search.SearchHit; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; @@ -27,9 +27,9 @@ public class IndicesStatsTests extends MarvelIntegTestCase { protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") - .put(MarvelSettings.COLLECTORS_SETTING.getKey(), IndicesStatsCollector.NAME) - .put("marvel.agent.exporters.default_local.type", "local") + .put(MarvelSettings.INTERVAL.getKey(), "-1") + .put(MarvelSettings.COLLECTORS.getKey(), IndicesStatsCollector.NAME) + .put("xpack.monitoring.agent.exporters.default_local.type", "local") .build(); } @@ -74,7 +74,7 @@ public class IndicesStatsTests extends MarvelIntegTestCase { logger.debug("--> wait for indices stats collector to collect global stat"); awaitMarvelDocsCount(greaterThan(0L), IndicesStatsCollector.TYPE); - logger.debug("--> searching for marvel documents of type [{}]", IndicesStatsCollector.TYPE); + logger.debug("--> searching for monitoring documents of type [{}]", IndicesStatsCollector.TYPE); SearchResponse response = client().prepareSearch().setTypes(IndicesStatsCollector.TYPE).get(); assertThat(response.getHits().getTotalHits(), greaterThan(0L)); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/node/MultiNodesStatsTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/node/MultiNodesStatsTests.java index fe1c0ea6e95..2d090d81c33 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/node/MultiNodesStatsTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/node/MultiNodesStatsTests.java @@ -9,7 +9,7 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.marvel.agent.collector.node.NodeStatsCollector; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.search.aggregations.Aggregation; import org.elasticsearch.search.aggregations.AggregationBuilders; @@ -35,8 +35,8 @@ public class MultiNodesStatsTests extends MarvelIntegTestCase { protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") - .put("marvel.agent.exporters.default_local.type", "local") + .put(MarvelSettings.INTERVAL.getKey(), "-1") + .put("xpack.monitoring.agent.exporters.default_local.type", "local") .build(); } @@ -86,7 +86,7 @@ public class MultiNodesStatsTests extends MarvelIntegTestCase { logger.debug("--> checking that every node correctly reported its own node stats"); assertBusy(() -> { - String indices = MarvelSettings.MARVEL_INDICES_PREFIX + "*"; + String indices = MarvelSettings.MONITORING_INDICES_PREFIX + "*"; securedFlush(indices); securedRefresh(); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/node/NodeStatsRendererTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/node/NodeStatsRendererTests.java index 4e43d90be97..ac643072561 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/node/NodeStatsRendererTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/node/NodeStatsRendererTests.java @@ -25,7 +25,7 @@ public class NodeStatsRendererTests extends ESSingleNodeTestCase { logger.debug("--> retrieving node stats"); NodeStats nodeStats = getInstanceFromNode(NodeService.class).stats(); - logger.debug("--> creating the node stats marvel document"); + logger.debug("--> creating the node stats monitoring document"); NodeStatsMarvelDoc marvelDoc = new NodeStatsMarvelDoc(); marvelDoc.setClusterUUID("test"); marvelDoc.setType("node_stats"); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/node/NodeStatsTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/node/NodeStatsTests.java index 6dc513406e4..bdb103fc398 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/node/NodeStatsTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/node/NodeStatsTests.java @@ -10,7 +10,7 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.marvel.agent.collector.node.NodeStatsCollector; import org.elasticsearch.marvel.agent.exporter.local.LocalExporter; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.search.SearchHit; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; @@ -29,9 +29,9 @@ public class NodeStatsTests extends MarvelIntegTestCase { protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") - .put(MarvelSettings.COLLECTORS_SETTING.getKey(), NodeStatsCollector.NAME) - .put("marvel.agent.exporters.default_local.type", LocalExporter.TYPE) + .put(MarvelSettings.INTERVAL.getKey(), "-1") + .put(MarvelSettings.COLLECTORS.getKey(), NodeStatsCollector.NAME) + .put("xpack.monitoring.agent.exporters.default_local.type", LocalExporter.TYPE) .build(); } @@ -56,7 +56,7 @@ public class NodeStatsTests extends MarvelIntegTestCase { awaitMarvelDocsCount(greaterThan(0L), NodeStatsCollector.TYPE); - logger.debug("--> searching for marvel documents of type [{}]", NodeStatsCollector.TYPE); + logger.debug("--> searching for monitoring documents of type [{}]", NodeStatsCollector.TYPE); SearchResponse response = client().prepareSearch().setTypes(NodeStatsCollector.TYPE).get(); assertThat(response.getHits().getTotalHits(), greaterThan(0L)); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/shards/ShardsRendererTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/shards/ShardsRendererTests.java index 11cc544e29d..de00d71f189 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/shards/ShardsRendererTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/shards/ShardsRendererTests.java @@ -29,7 +29,7 @@ public class ShardsRendererTests extends ESSingleNodeTestCase { logger.debug("--> retrieving cluster state"); ClusterState clusterState = getInstanceFromNode(ClusterService.class).state(); - logger.debug("--> creating the shard marvel document"); + logger.debug("--> creating the shard monitoring document"); ShardMarvelDoc marvelDoc = new ShardMarvelDoc(null, "shards", "my-id"); marvelDoc.setClusterUUID("test"); marvelDoc.setClusterUUID(clusterState.metaData().clusterUUID()); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/shards/ShardsTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/shards/ShardsTests.java index 3dbde1b4e0c..ce4a3f502eb 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/shards/ShardsTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/shards/ShardsTests.java @@ -12,7 +12,7 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.marvel.agent.collector.shards.ShardsCollector; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.aggregations.Aggregation; @@ -41,10 +41,10 @@ public class ShardsTests extends MarvelIntegTestCase { protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") - .put(MarvelSettings.COLLECTORS_SETTING.getKey(), ShardsCollector.NAME) - .put(MarvelSettings.INDICES_SETTING.getKey(), INDEX_PREFIX + "*") - .put("marvel.agent.exporters.default_local.type", "local") + .put(MarvelSettings.INTERVAL.getKey(), "-1") + .put(MarvelSettings.COLLECTORS.getKey(), ShardsCollector.NAME) + .put(MarvelSettings.INDICES.getKey(), INDEX_PREFIX + "*") + .put("xpack.monitoring.agent.exporters.default_local.type", "local") .build(); } @@ -68,7 +68,7 @@ public class ShardsTests extends MarvelIntegTestCase { awaitMarvelDocsCount(greaterThan(0L), ShardsCollector.TYPE); - logger.debug("--> searching for marvel documents of type [{}]", ShardsCollector.TYPE); + logger.debug("--> searching for monitoring documents of type [{}]", ShardsCollector.TYPE); SearchResponse response = client().prepareSearch().setTypes(ShardsCollector.TYPE).get(); assertThat(response.getHits().getTotalHits(), greaterThan(0L)); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/settings/MarvelSettingsTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/settings/MarvelSettingsTests.java index baf26439536..a22f238e7d7 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/settings/MarvelSettingsTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/settings/MarvelSettingsTests.java @@ -10,9 +10,9 @@ import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.agent.AgentService; import org.elasticsearch.marvel.test.MarvelIntegTestCase; -import org.elasticsearch.node.Node; import org.elasticsearch.test.ESIntegTestCase; import java.util.Arrays; @@ -46,20 +46,20 @@ public class MarvelSettingsTests extends MarvelIntegTestCase { private Settings marvelSettings() { return Settings.builder() - .put(MarvelSettings.INTERVAL_SETTING.getKey(), interval) - .put(MarvelSettings.INDEX_STATS_TIMEOUT_SETTING.getKey(), indexStatsTimeout) - .put(MarvelSettings.INDICES_STATS_TIMEOUT_SETTING.getKey(), indicesStatsTimeout) - .putArray(MarvelSettings.INDICES_SETTING.getKey(), indices) - .put(MarvelSettings.CLUSTER_STATE_TIMEOUT_SETTING.getKey(), clusterStateTimeout) - .put(MarvelSettings.CLUSTER_STATS_TIMEOUT_SETTING.getKey(), clusterStatsTimeout) - .put(MarvelSettings.INDEX_RECOVERY_TIMEOUT_SETTING.getKey(), recoveryTimeout) - .put(MarvelSettings.INDEX_RECOVERY_ACTIVE_ONLY_SETTING.getKey(), recoveryActiveOnly) - .putArray(MarvelSettings.COLLECTORS_SETTING.getKey(), collectors) + .put(MarvelSettings.INTERVAL.getKey(), interval) + .put(MarvelSettings.INDEX_STATS_TIMEOUT.getKey(), indexStatsTimeout) + .put(MarvelSettings.INDICES_STATS_TIMEOUT.getKey(), indicesStatsTimeout) + .putArray(MarvelSettings.INDICES.getKey(), indices) + .put(MarvelSettings.CLUSTER_STATE_TIMEOUT.getKey(), clusterStateTimeout) + .put(MarvelSettings.CLUSTER_STATS_TIMEOUT.getKey(), clusterStatsTimeout) + .put(MarvelSettings.INDEX_RECOVERY_TIMEOUT.getKey(), recoveryTimeout) + .put(MarvelSettings.INDEX_RECOVERY_ACTIVE_ONLY.getKey(), recoveryActiveOnly) + .putArray(MarvelSettings.COLLECTORS.getKey(), collectors) .build(); } public void testMarvelSettings() throws Exception { - logger.info("--> testing marvel settings service initialization"); + logger.info("--> testing monitoring settings service initialization"); for (final MarvelSettings marvelSettings : internalCluster().getInstances(MarvelSettings.class)) { assertThat(marvelSettings.indexStatsTimeout().millis(), equalTo(indexStatsTimeout.millis())); assertThat(marvelSettings.indicesStatsTimeout().millis(), equalTo(indicesStatsTimeout.millis())); @@ -76,18 +76,18 @@ public class MarvelSettingsTests extends MarvelIntegTestCase { } - logger.info("--> testing marvel dynamic settings update"); + logger.info("--> testing monitoring dynamic settings update"); Settings.Builder transientSettings = Settings.builder(); final Setting[] marvelSettings = new Setting[] { - MarvelSettings.INDICES_SETTING, - MarvelSettings.INTERVAL_SETTING, - MarvelSettings.INDEX_RECOVERY_TIMEOUT_SETTING, - MarvelSettings.INDEX_STATS_TIMEOUT_SETTING, - MarvelSettings.INDICES_STATS_TIMEOUT_SETTING, - MarvelSettings.INDEX_RECOVERY_ACTIVE_ONLY_SETTING, - MarvelSettings.COLLECTORS_SETTING, - MarvelSettings.CLUSTER_STATE_TIMEOUT_SETTING, - MarvelSettings.CLUSTER_STATS_TIMEOUT_SETTING}; + MarvelSettings.INDICES, + MarvelSettings.INTERVAL, + MarvelSettings.INDEX_RECOVERY_TIMEOUT, + MarvelSettings.INDEX_STATS_TIMEOUT, + MarvelSettings.INDICES_STATS_TIMEOUT, + MarvelSettings.INDEX_RECOVERY_ACTIVE_ONLY, + MarvelSettings.COLLECTORS, + MarvelSettings.CLUSTER_STATE_TIMEOUT, + MarvelSettings.CLUSTER_STATS_TIMEOUT }; for (Setting setting : marvelSettings) { if (setting.isDynamic()) { Object updated = null; @@ -110,30 +110,30 @@ public class MarvelSettingsTests extends MarvelIntegTestCase { final Settings updatedSettings = transientSettings.build(); assertAcked(prepareRandomUpdateSettings(updatedSettings).get()); - logger.error("--> checking that the value has been correctly updated on all marvel settings services"); + logger.error("--> checking that the value has been correctly updated on all monitoring settings services"); for (Setting setting : marvelSettings) { if (setting.isDynamic() == false) { continue; } - if (setting == MarvelSettings.INTERVAL_SETTING) { + if (setting == MarvelSettings.INTERVAL) { for (final AgentService service : internalCluster().getInstances(AgentService.class)) { assertEquals(service.getSamplingInterval(), setting.get(updatedSettings)); } } else { for (final MarvelSettings marvelSettings1 : internalCluster().getInstances(MarvelSettings.class)) { - if (setting == MarvelSettings.INDEX_STATS_TIMEOUT_SETTING) { + if (setting == MarvelSettings.INDEX_STATS_TIMEOUT) { assertEquals(marvelSettings1.indexStatsTimeout(), setting.get(updatedSettings)); - } else if (setting == MarvelSettings.INDICES_STATS_TIMEOUT_SETTING) { + } else if (setting == MarvelSettings.INDICES_STATS_TIMEOUT) { assertEquals(marvelSettings1.indicesStatsTimeout(), setting.get(updatedSettings)); - } else if (setting == MarvelSettings.CLUSTER_STATS_TIMEOUT_SETTING) { + } else if (setting == MarvelSettings.CLUSTER_STATS_TIMEOUT) { assertEquals(marvelSettings1.clusterStatsTimeout(), setting.get(updatedSettings)); - } else if (setting == MarvelSettings.CLUSTER_STATE_TIMEOUT_SETTING) { + } else if (setting == MarvelSettings.CLUSTER_STATE_TIMEOUT) { assertEquals(marvelSettings1.clusterStateTimeout(), setting.get(updatedSettings)); - } else if (setting == MarvelSettings.INDEX_RECOVERY_TIMEOUT_SETTING) { + } else if (setting == MarvelSettings.INDEX_RECOVERY_TIMEOUT) { assertEquals(marvelSettings1.recoveryTimeout(), setting.get(updatedSettings)); - } else if (setting == MarvelSettings.INDEX_RECOVERY_ACTIVE_ONLY_SETTING) { + } else if (setting == MarvelSettings.INDEX_RECOVERY_ACTIVE_ONLY) { assertEquals(Boolean.valueOf(marvelSettings1.recoveryActiveOnly()), setting.get(updatedSettings)); - } else if (setting == MarvelSettings.INDICES_SETTING) { + } else if (setting == MarvelSettings.INDICES) { assertEquals(Arrays.asList(marvelSettings1.indices()), setting.get(updatedSettings)); } else { fail("unable to check value for unknown dynamic setting [" + setting + "]"); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/cleaner/AbstractIndicesCleanerTestCase.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/cleaner/AbstractIndicesCleanerTestCase.java index 3cd9ccc456c..73d2a8eda4e 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/cleaner/AbstractIndicesCleanerTestCase.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/cleaner/AbstractIndicesCleanerTestCase.java @@ -13,7 +13,7 @@ import org.elasticsearch.license.plugin.core.Licensee; import org.elasticsearch.marvel.agent.exporter.Exporter; import org.elasticsearch.marvel.agent.exporter.Exporters; import org.elasticsearch.marvel.agent.exporter.IndexNameResolver; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.license.MarvelLicensee; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; @@ -33,8 +33,8 @@ public abstract class AbstractIndicesCleanerTestCase extends MarvelIntegTestCase protected Settings nodeSettings(int nodeOrdinal) { Settings.Builder settings = Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") - .put(CleanerService.HISTORY_SETTING.getKey(), "-1"); + .put(MarvelSettings.INTERVAL.getKey(), "-1") + .put(MarvelSettings.HISTORY_DURATION.getKey(), "-1"); return settings.build(); } @@ -49,7 +49,7 @@ public abstract class AbstractIndicesCleanerTestCase extends MarvelIntegTestCase public void testDeleteIndex() throws Exception { internalCluster().startNode(); - createIndex(MarvelSettings.MARVEL_INDICES_PREFIX + "test", now().minusDays(10)); + createIndex(MarvelSettings.MONITORING_INDICES_PREFIX + "test", now().minusDays(10)); assertIndicesCount(1); CleanerService.Listener listener = getListener(); @@ -60,7 +60,7 @@ public abstract class AbstractIndicesCleanerTestCase extends MarvelIntegTestCase public void testIgnoreDataIndex() throws Exception { internalCluster().startNode(); - createIndex(MarvelSettings.MARVEL_DATA_INDEX_PREFIX + "test", now().minusDays(10)); + createIndex(MarvelSettings.MONITORING_DATA_INDEX_PREFIX + "test", now().minusDays(10)); assertIndicesCount(1); CleanerService.Listener listener = getListener(); @@ -94,11 +94,11 @@ public abstract class AbstractIndicesCleanerTestCase extends MarvelIntegTestCase CleanerService.Listener listener = getListener(); final DateTime now = now(); - createIndex(MarvelSettings.MARVEL_INDICES_PREFIX + "one-year-ago", now.minusYears(1)); - createIndex(MarvelSettings.MARVEL_INDICES_PREFIX + "six-months-ago", now.minusMonths(6)); - createIndex(MarvelSettings.MARVEL_INDICES_PREFIX + "one-month-ago", now.minusMonths(1)); - createIndex(MarvelSettings.MARVEL_INDICES_PREFIX + "ten-days-ago", now.minusDays(10)); - createIndex(MarvelSettings.MARVEL_INDICES_PREFIX + "one-day-ago", now.minusDays(1)); + createIndex(MarvelSettings.MONITORING_INDICES_PREFIX + "one-year-ago", now.minusYears(1)); + createIndex(MarvelSettings.MONITORING_INDICES_PREFIX + "six-months-ago", now.minusMonths(6)); + createIndex(MarvelSettings.MONITORING_INDICES_PREFIX + "one-month-ago", now.minusMonths(1)); + createIndex(MarvelSettings.MONITORING_INDICES_PREFIX + "ten-days-ago", now.minusDays(10)); + createIndex(MarvelSettings.MONITORING_INDICES_PREFIX + "one-day-ago", now.minusDays(1)); assertIndicesCount(5); // Clean indices that have expired two years ago @@ -129,12 +129,12 @@ public abstract class AbstractIndicesCleanerTestCase extends MarvelIntegTestCase public void testRetentionAsGlobalSetting() throws Exception { final int max = 10; final int retention = randomIntBetween(1, max); - internalCluster().startNode(Settings.builder().put(CleanerService.HISTORY_SETTING.getKey(), + internalCluster().startNode(Settings.builder().put(MarvelSettings.HISTORY_DURATION.getKey(), String.format(Locale.ROOT, "%dd", retention))); final DateTime now = now(); for (int i = 0; i < max; i++) { - createIndex(MarvelSettings.MARVEL_INDICES_PREFIX + String.valueOf(i), now.minusDays(i)); + createIndex(MarvelSettings.MONITORING_INDICES_PREFIX + String.valueOf(i), now.minusDays(i)); } assertIndicesCount(max); @@ -149,12 +149,12 @@ public abstract class AbstractIndicesCleanerTestCase extends MarvelIntegTestCase // Default retention is between 3 and max days final int defaultRetention = randomIntBetween(3, max); - internalCluster().startNode(Settings.builder().put(CleanerService.HISTORY_SETTING.getKey(), + internalCluster().startNode(Settings.builder().put(MarvelSettings.HISTORY_DURATION.getKey(), String.format(Locale.ROOT, "%dd", defaultRetention))); final DateTime now = now(); for (int i = 0; i < max; i++) { - createIndex(MarvelSettings.MARVEL_INDICES_PREFIX + String.valueOf(i), now.minusDays(i)); + createIndex(MarvelSettings.MONITORING_INDICES_PREFIX + String.valueOf(i), now.minusDays(i)); } assertIndicesCount(max); @@ -165,8 +165,8 @@ public abstract class AbstractIndicesCleanerTestCase extends MarvelIntegTestCase // Updates the retention setting for the exporter Exporters exporters = internalCluster().getInstance(Exporters.class); for (Exporter exporter : exporters) { - Settings transientSettings = Settings.builder().put("marvel.agent.exporters." + exporter.name() + "." + - CleanerService.HISTORY_DURATION, String.format(Locale.ROOT, "%dd", exporterRetention)).build(); + Settings transientSettings = Settings.builder().put("xpack.monitoring.agent.exporters." + exporter.name() + "." + + MarvelSettings.HISTORY_DURATION_SETTING_NAME, String.format(Locale.ROOT, "%dd", exporterRetention)).build(); assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(transientSettings)); } diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/cleaner/CleanerServiceTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/cleaner/CleanerServiceTests.java index c6a9638da93..e8365de3267 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/cleaner/CleanerServiceTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/cleaner/CleanerServiceTests.java @@ -6,9 +6,9 @@ package org.elasticsearch.marvel.cleaner; import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.license.MarvelLicensee; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.ThreadPool; @@ -17,8 +17,7 @@ import org.joda.time.DateTimeZone; import org.junit.After; import org.junit.Before; -import java.util.Arrays; -import java.util.HashSet; +import java.util.Collections; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -35,7 +34,7 @@ public class CleanerServiceTests extends ESTestCase { @Before public void start() { - clusterSettings = new ClusterSettings(Settings.EMPTY, new HashSet>(Arrays.asList(CleanerService.HISTORY_SETTING))); + clusterSettings = new ClusterSettings(Settings.EMPTY, Collections.singleton(MarvelSettings.HISTORY_DURATION)); defaultRetention = TimeValue.parseTimeValue("7d", null, ""); threadPool = new ThreadPool("CleanerServiceTests"); } diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/cleaner/local/LocalIndicesCleanerTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/cleaner/local/LocalIndicesCleanerTests.java index 4ff3eb037c9..91d1f4564bb 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/cleaner/local/LocalIndicesCleanerTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/cleaner/local/LocalIndicesCleanerTests.java @@ -9,7 +9,7 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.marvel.agent.exporter.local.LocalExporter; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.cleaner.AbstractIndicesCleanerTestCase; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.InternalSettingsPlugin; @@ -35,7 +35,7 @@ public class LocalIndicesCleanerTests extends AbstractIndicesCleanerTestCase { protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - .put("marvel.agent.exporters._local.type", LocalExporter.TYPE) + .put("xpack.monitoring.agent.exporters._local.type", LocalExporter.TYPE) .build(); } @@ -52,7 +52,7 @@ public class LocalIndicesCleanerTests extends AbstractIndicesCleanerTestCase { @Override public void run() { try { - assertThat(client().admin().indices().prepareGetSettings(MarvelSettings.MARVEL_INDICES_PREFIX + "*") + assertThat(client().admin().indices().prepareGetSettings(MarvelSettings.MONITORING_INDICES_PREFIX + "*") .get().getIndexToSettings().size(), equalTo(count)); } catch (IndexNotFoundException e) { if (shieldEnabled) { diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/shield/MarvelInternalClientTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/shield/MarvelInternalClientTests.java index 58bf2ef741f..59e5e9aae03 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/shield/MarvelInternalClientTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/shield/MarvelInternalClientTests.java @@ -11,7 +11,7 @@ import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.shield.InternalClient; @@ -26,7 +26,7 @@ public class MarvelInternalClientTests extends MarvelIntegTestCase { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put(NetworkModule.HTTP_ENABLED.getKey(), false) - .put(MarvelSettings.INTERVAL_SETTING.getKey(), "-1") + .put(MarvelSettings.INTERVAL.getKey(), "-1") .build(); } @@ -45,8 +45,8 @@ public class MarvelInternalClientTests extends MarvelIntegTestCase { assertAccessIsAllowed(internalClient.admin().indices().prepareRecoveries()); assertAccessIsAllowed(internalClient.admin().indices().prepareStats()); - assertAccessIsAllowed(internalClient.admin().indices().prepareDelete(MarvelSettings.MARVEL_INDICES_PREFIX)); - assertAccessIsAllowed(internalClient.admin().indices().prepareCreate(MarvelSettings.MARVEL_INDICES_PREFIX + "test")); + assertAccessIsAllowed(internalClient.admin().indices().prepareDelete(MarvelSettings.MONITORING_INDICES_PREFIX)); + assertAccessIsAllowed(internalClient.admin().indices().prepareCreate(MarvelSettings.MONITORING_INDICES_PREFIX + "test")); assertAccessIsAllowed(internalClient.admin().indices().preparePutTemplate("foo") .setSource(MarvelTemplateUtils.loadTimestampedIndexTemplate())); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/test/MarvelIntegTestCase.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/test/MarvelIntegTestCase.java index 99397909c7a..c841cae6b44 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/test/MarvelIntegTestCase.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/test/MarvelIntegTestCase.java @@ -18,7 +18,7 @@ import org.elasticsearch.index.IndexModule; import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.marvel.agent.AgentService; import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils; -import org.elasticsearch.marvel.agent.settings.MarvelSettings; +import org.elasticsearch.marvel.MarvelSettings; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.shield.Shield; import org.elasticsearch.shield.authc.esusers.ESUsersRealm; @@ -77,9 +77,9 @@ public abstract class MarvelIntegTestCase extends ESIntegTestCase { Settings.Builder builder = Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - //TODO: for now lets isolate marvel tests from watcher (randomize this later) + //TODO: for now lets isolate monitoring tests from watcher (randomize this later) .put(XPackPlugin.featureEnabledSetting(Watcher.NAME), false) - // we do this by default in core, but for marvel this isn't needed and only adds noise. + // we do this by default in core, but for monitoring this isn't needed and only adds noise. .put("index.store.mock.check_index_on_close", false); ShieldSettings.apply(shieldEnabled, builder); @@ -163,7 +163,7 @@ public abstract class MarvelIntegTestCase extends ESIntegTestCase { @Override public void run() { try { - boolean exist = client().admin().indices().prepareExists(".marvel-es-*").get().isExists(); + boolean exist = client().admin().indices().prepareExists(".monitoring-es-*").get().isExists(); if (exist) { deleteMarvelIndices(); } else { @@ -180,12 +180,12 @@ public abstract class MarvelIntegTestCase extends ESIntegTestCase { protected void deleteMarvelIndices() { if (shieldEnabled) { try { - assertAcked(client().admin().indices().prepareDelete(".marvel-es-*")); + assertAcked(client().admin().indices().prepareDelete(".monitoring-es-*")); } catch (IndexNotFoundException e) { // if shield couldn't resolve any marvel index, it'll throw index not found exception. } } else { - assertAcked(client().admin().indices().prepareDelete(".marvel-es-*")); + assertAcked(client().admin().indices().prepareDelete(".monitoring-es-*")); } } @@ -196,17 +196,17 @@ public abstract class MarvelIntegTestCase extends ESIntegTestCase { protected void ensureMarvelIndicesYellow() { if (shieldEnabled) { try { - ensureYellow(".marvel-es-*"); + ensureYellow(".monitoring-es-*"); } catch (IndexNotFoundException e) { // might happen with shield... } } else { - ensureYellow(".marvel-es-*"); + ensureYellow(".monitoring-es-*"); } } protected void assertMarvelDocsCount(Matcher matcher, String... types) { - String indices = MarvelSettings.MARVEL_INDICES_PREFIX + "*"; + String indices = MarvelSettings.MONITORING_INDICES_PREFIX + "*"; try { securedFlushAndRefresh(indices); long count = client().prepareSearch(indices).setSize(0).setTypes(types).get().getHits().totalHits(); @@ -241,7 +241,7 @@ public abstract class MarvelIntegTestCase extends ESIntegTestCase { } protected void waitForMarvelIndices() throws Exception { - awaitIndexExists(MarvelSettings.MARVEL_INDICES_PREFIX + "*"); + awaitIndexExists(MarvelSettings.MONITORING_INDICES_PREFIX + "*"); assertBusy(this::ensureMarvelIndicesYellow); } @@ -338,7 +338,7 @@ public abstract class MarvelIntegTestCase extends ESIntegTestCase { assertTrue(Strings.hasText(segment)); boolean fieldExists = values.containsKey(segment); - assertTrue("expecting field [" + segment + "] to be present in marvel document", fieldExists); + assertTrue("expecting field [" + segment + "] to be present in monitoring document", fieldExists); Object value = values.get(segment); String next = field.substring(point + 1); @@ -349,13 +349,13 @@ public abstract class MarvelIntegTestCase extends ESIntegTestCase { assertFalse(value instanceof Map); } } else { - assertTrue("expecting field [" + field + "] to be present in marvel document", values.containsKey(field)); + assertTrue("expecting field [" + field + "] to be present in monitoring document", values.containsKey(field)); } } protected void updateMarvelInterval(long value, TimeUnit timeUnit) { assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings( - Settings.builder().put(MarvelSettings.INTERVAL_SETTING.getKey(), value, timeUnit))); + Settings.builder().put(MarvelSettings.INTERVAL.getKey(), value, timeUnit))); } /** Shield related settings */ diff --git a/elasticsearch/x-pack/marvel/src/test/resources/samples/shards.json b/elasticsearch/x-pack/marvel/src/test/resources/samples/shards.json index acc4fe007a7..900e1b47f1b 100644 --- a/elasticsearch/x-pack/marvel/src/test/resources/samples/shards.json +++ b/elasticsearch/x-pack/marvel/src/test/resources/samples/shards.json @@ -8,6 +8,6 @@ "node": "6MMNl9dXRV-kFRKh_fXxxA", "relocating_node": null, "shard": 0, - "index": ".marvel-2015.09.03" + "index": ".monitoring-2015.09.03" } } \ No newline at end of file diff --git a/elasticsearch/x-pack/shield/config/xpack/roles.yml b/elasticsearch/x-pack/shield/config/xpack/roles.yml index b08330e4d9f..a8cdacb09e6 100644 --- a/elasticsearch/x-pack/shield/config/xpack/roles.yml +++ b/elasticsearch/x-pack/shield/config/xpack/roles.yml @@ -52,18 +52,18 @@ logstash: 'logstash-*': privileges: indices:data/write/bulk, indices:data/write/delete, indices:data/write/update, indices:data/read/search, indices:data/read/scroll, create_index -# Marvel user role. Assign to marvel users. -marvel_user: +# Monitoring user role. Assign to monitoring users. +monitoring_user: indices: - '.marvel-es-*': + '.monitoring-es-*': privileges: read '.kibana': privileges: indices:admin/exists, indices:admin/mappings/fields/get, indices:admin/validate/query, indices:data/read/get, indices:data/read/mget, indices:data/read/search -# Marvel remote agent role. Assign to the agent user on the remote marvel cluster -# to which the marvel agent will export all its data -remote_marvel_agent: +# Monitoring remote agent role. Assign to the agent user on the remote monitoring cluster +# to which the monitoring agent will export all its data +remote_monitoring_agent: cluster: indices:admin/template/put, indices:admin/template/get indices: - '.marvel-es-*': + '.monitoring-es-*': privileges: all \ No newline at end of file diff --git a/elasticsearch/x-pack/shield/dev-tools/esvm/.esvmrc b/elasticsearch/x-pack/shield/dev-tools/esvm/.esvmrc index 82a46076c20..cdead6d9d28 100644 --- a/elasticsearch/x-pack/shield/dev-tools/esvm/.esvmrc +++ b/elasticsearch/x-pack/shield/dev-tools/esvm/.esvmrc @@ -19,9 +19,9 @@ "bind_host": "127.0.0.1", "publish_host": "127.0.0.1" }, - "marvel.agent.exporter.es.hosts": [ "https://admin-plain:changeme@127.0.0.1:9200"], - "marvel.agent.exporter.es.ssl.truststore.path": "../../src/test/resources/org/elasticsearch/shield/transport/ssl/certs/simple/testnode.jks", - "marvel.agent.exporter.es.ssl.truststore.password": "testnode", + "xpack.monitoring.agent.exporters.es.hosts": [ "https://admin-plain:changeme@127.0.0.1:9200"], + "xpack.monitoring.agent.exporters.es.ssl.truststore.path": "../../src/test/resources/org/elasticsearch/shield/transport/ssl/certs/simple/testnode.jks", + "xpack.monitoring.agent.exporters.es.ssl.truststore.password": "testnode", "http.cors": { "enabled": true, "allow-origin": "/http:\/\/www.elasticsearch.(org|com)/" diff --git a/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/XPackUser.java b/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/XPackUser.java index 66d4e7f9cc0..88af1c5f6f6 100644 --- a/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/XPackUser.java +++ b/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/XPackUser.java @@ -16,7 +16,7 @@ import org.elasticsearch.shield.authz.privilege.Privilege; /** * XPack internal user that manages xpack. Has all cluster/indices permissions for watcher, - * shield and marvel to operate. + * shield and monitoring to operate. */ public class XPackUser extends User { @@ -48,12 +48,12 @@ public class XPackUser extends User { -// these will be the index permissions required by marvel (will uncomment once we optimize watcher permissions) +// these will be the index permissions required by monitoring (will uncomment once we optimize monitoring permissions) // // we need all monitoring access // .add(IndexPrivilege.MONITOR, "*") -// // and full access to .marvel-es-* and .marvel-es-data indices -// .add(IndexPrivilege.ALL, MarvelSettings.MARVEL_INDICES_PREFIX + "*") +// // and full access to .monitoring-es-* and .monitoring-es-data indices +// .add(IndexPrivilege.ALL, MarvelSettings.MONITORING_INDICES_PREFIX + "*") .build(); diff --git a/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/authz/privilege/SystemPrivilege.java b/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/authz/privilege/SystemPrivilege.java index a8ae1c7fc9e..84f3c9e0777 100644 --- a/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/authz/privilege/SystemPrivilege.java +++ b/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/authz/privilege/SystemPrivilege.java @@ -20,8 +20,8 @@ public class SystemPrivilege extends Privilege { protected static final Predicate PREDICATE = new AutomatonPredicate(patterns( "internal:*", - "indices:monitor/*", // added for marvel - "cluster:monitor/*", // added for marvel + "indices:monitor/*", // added for monitoring + "cluster:monitor/*", // added for monitoring "cluster:admin/reroute" // added for DiskThresholdDecider.DiskListener )); diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/ShieldF.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/ShieldF.java index b27e90ee442..5bb089e9dfb 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/ShieldF.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/ShieldF.java @@ -42,8 +42,8 @@ public class ShieldF { settings.put("script.inline", "true"); settings.put("xpack.shield.enabled", "true"); settings.put("security.manager.enabled", "false"); - // Disable Marvel to prevent cluster activity - settings.put("xpack.marvel.enabled", "false"); + // Disable Monitoring to prevent cluster activity + settings.put("xpack.monitoring.enabled", "false"); settings.put(IndexModule.INDEX_QUERY_CACHE_TYPE_SETTING.getKey(), Shield.OPT_OUT_QUERY_CACHE); settings.put("cluster.name", ShieldF.class.getSimpleName()); diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/authz/store/FileRolesStoreTests.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/authz/store/FileRolesStoreTests.java index 74244be9706..31f4727b601 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/authz/store/FileRolesStoreTests.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/authz/store/FileRolesStoreTests.java @@ -244,8 +244,8 @@ public class FileRolesStoreTests extends ESTestCase { assertThat(roles, hasKey("kibana3")); assertThat(roles, hasKey("kibana4")); assertThat(roles, hasKey("logstash")); - assertThat(roles, hasKey("marvel_user")); - assertThat(roles, hasKey("marvel_agent")); + assertThat(roles, hasKey("monitoring_user")); + assertThat(roles, hasKey("monitoring_agent")); } public void testAutoReload() throws Exception { diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/test/ShieldSettingsSource.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/test/ShieldSettingsSource.java index 868fe63bf5d..e6b4456a00a 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/test/ShieldSettingsSource.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/test/ShieldSettingsSource.java @@ -120,7 +120,7 @@ public class ShieldSettingsSource extends ClusterDiscoveryConfiguration.UnicastZ Path folder = ShieldTestUtils.createFolder(parentFolder, subfolderPrefix + "-" + nodeOrdinal); Settings.Builder builder = settingsBuilder().put(super.nodeSettings(nodeOrdinal)) - //TODO: for now isolate shield tests from watcher & marvel (randomize this later) + //TODO: for now isolate shield tests from watcher & monitoring (randomize this later) .put(XPackPlugin.featureEnabledSetting(Watcher.NAME), false) .put(XPackPlugin.featureEnabledSetting(Marvel.NAME), false) diff --git a/elasticsearch/x-pack/shield/src/test/resources/org/elasticsearch/shield/authz/store/default_roles.yml b/elasticsearch/x-pack/shield/src/test/resources/org/elasticsearch/shield/authz/store/default_roles.yml index 08816b21821..cf6817458e8 100644 --- a/elasticsearch/x-pack/shield/src/test/resources/org/elasticsearch/shield/authz/store/default_roles.yml +++ b/elasticsearch/x-pack/shield/src/test/resources/org/elasticsearch/shield/authz/store/default_roles.yml @@ -35,14 +35,14 @@ logstash: indices: 'logstash-*': indices:data/write/bulk, indices:data/write/delete, indices:data/write/update, create_index -# Marvel role, allowing all operations -# on the marvel indices -marvel_user: +# Monitoring role, allowing all operations +# on the monitoring indices +monitoring_user: indices: - '.marvel-*': all + '.monitoring-*': all -# Marvel Agent users -marvel_agent: +# Monitoring Agent users +monitoring_agent: cluster: indices:admin/template/get, indices:admin/template/put indices: - '.marvel-*': indices:data/write/bulk, create_index + '.monitoring-*': indices:data/write/bulk, create_index diff --git a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/XPackPlugin.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/XPackPlugin.java index a1f0a17934c..767e36bae62 100644 --- a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/XPackPlugin.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/XPackPlugin.java @@ -11,6 +11,7 @@ import org.elasticsearch.client.Client; import org.elasticsearch.common.component.LifecycleComponent; import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.network.NetworkModule; +import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.env.Environment; @@ -118,6 +119,10 @@ public class XPackPlugin extends Plugin { } public void onModule(SettingsModule module) { + + // we add the `xpack.version` setting to all internal indices + module.registerSetting(Setting.simpleString("index.xpack.version", false, Setting.Scope.INDEX)); + shield.onModule(module); marvel.onModule(module); watcher.onModule(module); @@ -144,6 +149,13 @@ public class XPackPlugin extends Plugin { return !"node".equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey())); } + public static boolean isTribeNode(Settings settings) { + return settings.getGroups("tribe", true).isEmpty() == false; + } + public static boolean isTribeClientNode(Settings settings) { + return settings.get("tribe.name") != null; + } + public static Path resolveConfigFile(Environment env, String name) { return env.configFile().resolve(NAME).resolve(name); } @@ -163,6 +175,10 @@ public class XPackPlugin extends Plugin { } public static String featureEnabledSetting(String featureName) { - return NAME + "." + featureName + ".enabled"; + return featureSettingPrefix(featureName) + ".enabled"; + } + + public static String featureSettingPrefix(String featureName) { + return NAME + "." + featureName; } } diff --git a/elasticsearch/x-pack/src/test/resources/rest-api-spec/test/xpack/10_basic.yaml b/elasticsearch/x-pack/src/test/resources/rest-api-spec/test/xpack/10_basic.yaml index 88059b5d5b3..efedbf34e42 100644 --- a/elasticsearch/x-pack/src/test/resources/rest-api-spec/test/xpack/10_basic.yaml +++ b/elasticsearch/x-pack/src/test/resources/rest-api-spec/test/xpack/10_basic.yaml @@ -1,4 +1,4 @@ -# Integration tests for Marvel plugin +# Integration tests for monitoring # "X-Pack loaded": - do: diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/AbstractWatcherIntegrationTestCase.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/AbstractWatcherIntegrationTestCase.java index d39ae4283ad..32a4eb00295 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/AbstractWatcherIntegrationTestCase.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/AbstractWatcherIntegrationTestCase.java @@ -129,7 +129,7 @@ public abstract class AbstractWatcherIntegrationTestCase extends ESIntegTestCase logger.info("using schedule engine [" + scheduleImplName + "]"); return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - //TODO: for now lets isolate watcher tests from marvel (randomize this later) + //TODO: for now lets isolate watcher tests from monitoring (randomize this later) .put(XPackPlugin.featureEnabledSetting(Marvel.NAME), false) // we do this by default in core, but for watcher this isn't needed and only adds noise. .put("index.store.mock.check_index_on_close", false)