[Monitoring] Change xpack.monitoring.agent to xpack.monitoring.collection

This changes the xpack.monitoring.agent.* settings so that they fall under xpack.monitoring.collection.*.

- This also changes Kibana's equivalent data_collection to collection.

Original commit: elastic/x-pack-elasticsearch@a69bc18055
This commit is contained in:
Chris Earle 2016-07-07 17:59:39 -04:00
parent eade405b8f
commit 16b3056b1f
22 changed files with 113 additions and 105 deletions

View File

@ -18,7 +18,7 @@ subprojects {
cluster {
systemProperty 'es.logger.level', 'TRACE'
plugin 'x-pack', project(':x-plugins:elasticsearch:x-pack')
setting 'xpack.monitoring.agent.interval', '3s'
setting 'xpack.monitoring.collection.interval', '3s'
extraConfigFile 'x-pack/roles.yml', '../roles.yml'
setupCommand 'setupTestAdminUser',
'bin/x-pack/users', 'useradd', 'test_admin', '-p', 'changeme', '-r', 'superuser'

View File

@ -153,13 +153,13 @@ project.rootProject.subprojects.findAll { it.path.startsWith(':plugins:') }.each
integTest {
cluster {
setting 'xpack.monitoring.agent.interval', '3s'
setting 'xpack.monitoring.agent.exporters._http.type', 'http'
setting 'xpack.monitoring.agent.exporters._http.enabled', 'false'
setting 'xpack.monitoring.agent.exporters._http.ssl.truststore.path', clientKeyStore.name
setting 'xpack.monitoring.agent.exporters._http.ssl.truststore.password', 'keypass'
setting 'xpack.monitoring.agent.exporters._http.auth.username', 'monitoring_agent'
setting 'xpack.monitoring.agent.exporters._http.auth.password', 'changeme'
setting 'xpack.monitoring.collection.interval', '3s'
setting 'xpack.monitoring.collection.exporters._http.type', 'http'
setting 'xpack.monitoring.collection.exporters._http.enabled', 'false'
setting 'xpack.monitoring.collection.exporters._http.ssl.truststore.path', clientKeyStore.name
setting 'xpack.monitoring.collection.exporters._http.ssl.truststore.password', 'keypass'
setting 'xpack.monitoring.collection.exporters._http.auth.username', 'monitoring_agent'
setting 'xpack.monitoring.collection.exporters._http.auth.password', 'changeme'
setting 'xpack.security.transport.ssl.enabled', 'true'
setting 'xpack.security.http.ssl.enabled', 'true'

View File

@ -73,8 +73,8 @@ public class SmokeTestMonitoringWithSecurityIT extends ESIntegTestCase {
URI uri = new URI("https", null, httpAddress.getHostString(), httpAddress.getPort(), "/", null, null);
Settings exporterSettings = Settings.builder()
.put("xpack.monitoring.agent.exporters._http.enabled", true)
.put("xpack.monitoring.agent.exporters._http.host", uri.toString())
.put("xpack.monitoring.collection.exporters._http.enabled", true)
.put("xpack.monitoring.collection.exporters._http.host", uri.toString())
.build();
assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(exporterSettings));
}
@ -82,8 +82,8 @@ public class SmokeTestMonitoringWithSecurityIT extends ESIntegTestCase {
@After
public void disableExporter() {
Settings exporterSettings = Settings.builder()
.putNull("xpack.monitoring.agent.exporters._http.enabled")
.putNull("xpack.monitoring.agent.exporters._http.host")
.putNull("xpack.monitoring.collection.exporters._http.enabled")
.putNull("xpack.monitoring.collection.exporters._http.host")
.build();
assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(exporterSettings));
}

View File

@ -11,9 +11,9 @@
metric: [ settings ]
- is_true: nodes
- is_true: nodes.$master.settings.xpack.monitoring.agent.exporters._http.type
- is_true: nodes.$master.settings.xpack.monitoring.collection.exporters._http.type
- is_false: nodes.$master.settings.xpack.monitoring.agent.exporters._http.auth.username
- is_false: nodes.$master.settings.xpack.monitoring.agent.exporters._http.auth.password
- is_false: nodes.$master.settings.xpack.monitoring.agent.exporters._http.ssl.truststore.path
- is_false: nodes.$master.settings.xpack.monitoring.agent.exporters._http.ssl.truststore.password
- is_false: nodes.$master.settings.xpack.monitoring.collection.exporters._http.auth.username
- is_false: nodes.$master.settings.xpack.monitoring.collection.exporters._http.auth.password
- is_false: nodes.$master.settings.xpack.monitoring.collection.exporters._http.ssl.truststore.path
- is_false: nodes.$master.settings.xpack.monitoring.collection.exporters._http.ssl.truststore.password

View File

@ -133,7 +133,7 @@ integTest {
// TODO: fix this rest test to not depend on a hardcoded port!
systemProperty 'tests.rest.blacklist', 'getting_started/10_monitor_cluster_health/*,bulk/10_basic/*'
cluster {
setting 'xpack.monitoring.agent.interval', '3s'
setting 'xpack.monitoring.collection.interval', '3s'
waitCondition = { NodeInfo node, AntBuilder ant ->
File tmpFile = new File(node.cwd, 'wait.success')
for (int i = 0; i < 10; i++) {

View File

@ -52,55 +52,55 @@ public class MonitoringSettings extends AbstractComponent {
* Sampling interval between two collections (default to 10s)
*/
public static final Setting<TimeValue> INTERVAL =
timeSetting(key("agent.interval"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope);
timeSetting(collectionKey("interval"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope);
/**
* Timeout value when collecting index statistics (default to 10m)
*/
public static final Setting<TimeValue> INDEX_STATS_TIMEOUT =
timeSetting(key("agent.index.stats.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope);
timeSetting(collectionKey("index.stats.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope);
/**
* Timeout value when collecting total indices statistics (default to 10m)
*/
public static final Setting<TimeValue> INDICES_STATS_TIMEOUT =
timeSetting(key("agent.indices.stats.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope);
timeSetting(collectionKey("indices.stats.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope);
/**
* List of indices names whose stats will be exported (default to all indices)
*/
public static final Setting<List<String>> INDICES =
listSetting(key("agent.indices"), Collections.emptyList(), Function.identity(), Property.Dynamic, Property.NodeScope);
listSetting(collectionKey("indices"), Collections.emptyList(), Function.identity(), Property.Dynamic, Property.NodeScope);
/**
* Timeout value when collecting the cluster state (default to 10m)
*/
public static final Setting<TimeValue> CLUSTER_STATE_TIMEOUT =
timeSetting(key("agent.cluster.state.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope);
timeSetting(collectionKey("cluster.state.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope);
/**
* Timeout value when collecting the recovery information (default to 10m)
*/
public static final Setting<TimeValue> CLUSTER_STATS_TIMEOUT =
timeSetting(key("agent.cluster.stats.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope);
timeSetting(collectionKey("cluster.stats.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope);
/**
* Timeout value when collecting the recovery information (default to 10m)
*/
public static final Setting<TimeValue> INDEX_RECOVERY_TIMEOUT =
timeSetting(key("agent.index.recovery.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope);
timeSetting(collectionKey("index.recovery.timeout"), TimeValue.timeValueSeconds(10), Property.Dynamic, Property.NodeScope);
/**
* Flag to indicate if only active recoveries should be collected (default to false: all recoveries are collected)
*/
public static final Setting<Boolean> INDEX_RECOVERY_ACTIVE_ONLY =
boolSetting(key("agent.index.recovery.active_only"), false, Property.Dynamic, Property.NodeScope) ;
boolSetting(collectionKey("index.recovery.active_only"), false, Property.Dynamic, Property.NodeScope) ;
/**
* List of collectors allowed to collect data (default to all)
*/
public static final Setting<List<String>> COLLECTORS =
listSetting(key("agent.collectors"), Collections.emptyList(), Function.identity(), Property.NodeScope);
listSetting(collectionKey("collectors"), Collections.emptyList(), Function.identity(), Property.NodeScope);
/**
* The default retention duration of the monitoring history data.
@ -123,7 +123,7 @@ public class MonitoringSettings extends AbstractComponent {
* Settings/Options per configured exporter
*/
public static final Setting<Settings> EXPORTERS_SETTINGS =
groupSetting(key("agent.exporters."), Property.Dynamic, Property.NodeScope);
groupSetting(collectionKey("exporters."), Property.Dynamic, Property.NodeScope);
public static List<Setting<?>> getSettings() {
return Arrays.asList(INDICES,
@ -141,7 +141,7 @@ public class MonitoringSettings extends AbstractComponent {
}
public static List<String> getSettingsFilter() {
return Arrays.asList("xpack.monitoring.agent.exporters.*.auth.*", "xpack.monitoring.agent.exporters.*.ssl.*");
return Arrays.asList("xpack.monitoring.collection.exporters.*.auth.*", "xpack.monitoring.collection.exporters.*.ssl.*");
}
@ -227,6 +227,17 @@ public class MonitoringSettings extends AbstractComponent {
this.indices = indices.toArray(new String[0]);
}
/**
* Prefix the {@code key} with the Monitoring prefix and "collection." .
*
* @param key The key to prefix
* @return The key prefixed by the product prefixes + "collection." .
* @see #key(String)
*/
static String collectionKey(String key) {
return key("collection." + key);
}
/**
* Prefix the {@code key} with the Monitoring prefix.
*

View File

@ -536,11 +536,8 @@ public class HttpExporter extends Exporter {
for (String host : hosts) {
try {
HttpExporterUtils.parseHostWithPath(host, "");
} catch (URISyntaxException e) {
throw new SettingsException("[xpack.monitoring.agent.exporter] invalid host: [" + host + "]." +
" error: [" + e.getMessage() + "]");
} catch (MalformedURLException e) {
throw new SettingsException("[xpack.monitoring.agent.exporter] invalid host: [" + host + "]." +
} catch (URISyntaxException | MalformedURLException e) {
throw new SettingsException("[xpack.monitoring.collection.exporters] invalid host: [" + host + "]." +
" error: [" + e.getMessage() + "]");
}
}

View File

@ -32,9 +32,9 @@ public class MonitoringF {
settings.put("script.inline", "true");
settings.put("security.manager.enabled", "false");
settings.put("cluster.name", MonitoringF.class.getSimpleName());
settings.put("xpack.monitoring.agent.interval", "5s");
settings.put("xpack.monitoring.collection.interval", "1s");
if (!CollectionUtils.isEmpty(args)) {
settings.putArray("xpack.monitoring.agent.collectors", args);
settings.putArray("xpack.monitoring.collection.collectors", args);
}
final CountDownLatch latch = new CountDownLatch(1);

View File

@ -32,7 +32,7 @@ public abstract class AbstractExporterTemplateTestCase extends MonitoringIntegTe
.put(MonitoringSettings.INTERVAL.getKey(), "-1");
for (Map.Entry<String, String> setting : exporterSettings().getAsMap().entrySet()) {
settings.put("xpack.monitoring.agent.exporters._exporter." + setting.getKey(), setting.getValue());
settings.put("xpack.monitoring.collection.exporters._exporter." + setting.getKey(), setting.getValue());
}
return settings.build();
}

View File

@ -176,8 +176,8 @@ public class ExportersTests extends ESTestCase {
final AtomicReference<Settings> settingsHolder = new AtomicReference<>();
Settings nodeSettings = Settings.builder()
.put("xpack.monitoring.agent.exporters._name0.type", "_type")
.put("xpack.monitoring.agent.exporters._name1.type", "_type")
.put("xpack.monitoring.collection.exporters._name0.type", "_type")
.put("xpack.monitoring.collection.exporters._name1.type", "_type")
.build();
clusterSettings = new ClusterSettings(nodeSettings, new HashSet<>(Arrays.asList(MonitoringSettings.EXPORTERS_SETTINGS)));
@ -197,8 +197,8 @@ public class ExportersTests extends ESTestCase {
assertThat(settings, hasEntry("_name1.type", "_type"));
Settings update = Settings.builder()
.put("xpack.monitoring.agent.exporters._name0.foo", "bar")
.put("xpack.monitoring.agent.exporters._name1.foo", "bar")
.put("xpack.monitoring.collection.exporters._name0.foo", "bar")
.put("xpack.monitoring.collection.exporters._name1.foo", "bar")
.build();
clusterSettings.applySettings(update);
assertThat(settingsHolder.get(), notNullValue());
@ -216,8 +216,8 @@ public class ExportersTests extends ESTestCase {
factories.put("mock", factory);
factories.put("mock_master_only", masterOnlyFactory);
Exporters exporters = new Exporters(Settings.builder()
.put("xpack.monitoring.agent.exporters._name0.type", "mock")
.put("xpack.monitoring.agent.exporters._name1.type", "mock_master_only")
.put("xpack.monitoring.collection.exporters._name0.type", "mock")
.put("xpack.monitoring.collection.exporters._name1.type", "mock_master_only")
.build(), factories, clusterService, clusterSettings);
exporters.start();
@ -241,8 +241,8 @@ public class ExportersTests extends ESTestCase {
factories.put("mock", factory);
factories.put("mock_master_only", masterOnlyFactory);
Exporters exporters = new Exporters(Settings.builder()
.put("xpack.monitoring.agent.exporters._name0.type", "mock")
.put("xpack.monitoring.agent.exporters._name1.type", "mock_master_only")
.put("xpack.monitoring.collection.exporters._name0.type", "mock")
.put("xpack.monitoring.collection.exporters._name1.type", "mock_master_only")
.build(), factories, clusterService, clusterSettings);
exporters.start();
@ -270,7 +270,7 @@ public class ExportersTests extends ESTestCase {
logger.info("--> creating {} exporters", nbExporters);
Settings.Builder settings = Settings.builder();
for (int i = 0; i < nbExporters; i++) {
settings.put("xpack.monitoring.agent.exporters._name" + String.valueOf(i) + ".type", "record");
settings.put("xpack.monitoring.collection.exporters._name" + String.valueOf(i) + ".type", "record");
}
Exporter.Factory factory = new CountingExportFactory("record", false);

View File

@ -95,10 +95,10 @@ public class HttpExporterTests extends MonitoringIntegTestCase {
Settings.Builder builder = Settings.builder()
.put(MonitoringSettings.INTERVAL.getKey(), "-1")
.put("xpack.monitoring.agent.exporters._http.type", "http")
.put("xpack.monitoring.agent.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort())
.put("xpack.monitoring.agent.exporters._http.connection.keep_alive", false)
.put("xpack.monitoring.agent.exporters._http.update_mappings", false);
.put("xpack.monitoring.collection.exporters._http.type", "http")
.put("xpack.monitoring.collection.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort())
.put("xpack.monitoring.collection.exporters._http.connection.keep_alive", false)
.put("xpack.monitoring.collection.exporters._http.update_mappings", false);
internalCluster().startNode(builder);
@ -133,23 +133,23 @@ public class HttpExporterTests extends MonitoringIntegTestCase {
// disable exporting to be able to use non valid hosts
Settings.Builder builder = Settings.builder()
.put(MonitoringSettings.INTERVAL.getKey(), "-1")
.put("xpack.monitoring.agent.exporters._http.type", "http")
.put("xpack.monitoring.agent.exporters._http.host", "test0");
.put("xpack.monitoring.collection.exporters._http.type", "http")
.put("xpack.monitoring.collection.exporters._http.host", "test0");
String nodeName = internalCluster().startNode(builder);
assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder()
.putArray("xpack.monitoring.agent.exporters._http.host", "test1")));
.putArray("xpack.monitoring.collection.exporters._http.host", "test1")));
assertThat(getExporter(nodeName).hosts, Matchers.arrayContaining("test1"));
// wipes the non array settings
assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder()
.putArray("xpack.monitoring.agent.exporters._http.host", "test2")
.put("xpack.monitoring.agent.exporters._http.host", "")));
.putArray("xpack.monitoring.collection.exporters._http.host", "test2")
.put("xpack.monitoring.collection.exporters._http.host", "")));
assertThat(getExporter(nodeName).hosts, Matchers.arrayContaining("test2"));
assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder()
.putArray("xpack.monitoring.agent.exporters._http.host", "test3")));
.putArray("xpack.monitoring.collection.exporters._http.host", "test3")));
assertThat(getExporter(nodeName).hosts, Matchers.arrayContaining("test3"));
}
@ -157,10 +157,10 @@ public class HttpExporterTests extends MonitoringIntegTestCase {
Settings.Builder builder = Settings.builder()
.put(MonitoringSettings.INTERVAL.getKey(), "-1")
.put("xpack.monitoring.agent.exporters._http.type", "http")
.put("xpack.monitoring.agent.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort())
.put("xpack.monitoring.agent.exporters._http.connection.keep_alive", false)
.put("xpack.monitoring.agent.exporters._http.update_mappings", false);
.put("xpack.monitoring.collection.exporters._http.type", "http")
.put("xpack.monitoring.collection.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort())
.put("xpack.monitoring.collection.exporters._http.connection.keep_alive", false)
.put("xpack.monitoring.collection.exporters._http.update_mappings", false);
logger.info("--> starting node");
@ -221,7 +221,7 @@ public class HttpExporterTests extends MonitoringIntegTestCase {
assertNotNull("Unable to start the second mock web server", secondWebServer);
assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(
Settings.builder().putArray("xpack.monitoring.agent.exporters._http.host",
Settings.builder().putArray("xpack.monitoring.collection.exporters._http.host",
secondWebServer.getHostName() + ":" + secondWebServer.getPort())).get());
// a new exporter is created on update, so we need to re-fetch it
@ -274,9 +274,9 @@ public class HttpExporterTests extends MonitoringIntegTestCase {
public void testUnsupportedClusterVersion() throws Exception {
Settings.Builder builder = Settings.builder()
.put(MonitoringSettings.INTERVAL.getKey(), "-1")
.put("xpack.monitoring.agent.exporters._http.type", "http")
.put("xpack.monitoring.agent.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort())
.put("xpack.monitoring.agent.exporters._http.connection.keep_alive", false);
.put("xpack.monitoring.collection.exporters._http.type", "http")
.put("xpack.monitoring.collection.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort())
.put("xpack.monitoring.collection.exporters._http.connection.keep_alive", false);
logger.info("--> starting node");
@ -302,10 +302,10 @@ public class HttpExporterTests extends MonitoringIntegTestCase {
public void testDynamicIndexFormatChange() throws Exception {
Settings.Builder builder = Settings.builder()
.put(MonitoringSettings.INTERVAL.getKey(), "-1")
.put("xpack.monitoring.agent.exporters._http.type", "http")
.put("xpack.monitoring.agent.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort())
.put("xpack.monitoring.agent.exporters._http.connection.keep_alive", false)
.put("xpack.monitoring.agent.exporters._http.update_mappings", false);
.put("xpack.monitoring.collection.exporters._http.type", "http")
.put("xpack.monitoring.collection.exporters._http.host", webServer.getHostName() + ":" + webServer.getPort())
.put("xpack.monitoring.collection.exporters._http.connection.keep_alive", false)
.put("xpack.monitoring.collection.exporters._http.update_mappings", false);
String agentNode = internalCluster().startNode(builder);
@ -356,7 +356,7 @@ public class HttpExporterTests extends MonitoringIntegTestCase {
String newTimeFormat = randomFrom("YY", "YYYY", "YYYY.MM", "YYYY-MM", "MM.YYYY", "MM");
logger.info("--> updating index time format setting to {}", newTimeFormat);
assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder()
.put("xpack.monitoring.agent.exporters._http.index.name.time_format", newTimeFormat)));
.put("xpack.monitoring.collection.exporters._http.index.name.time_format", newTimeFormat)));
logger.info("--> exporting a second event");
@ -402,9 +402,9 @@ public class HttpExporterTests extends MonitoringIntegTestCase {
Settings.Builder builder = Settings.builder()
.put(MonitoringSettings.INTERVAL.getKey(), "-1")
.put("xpack.monitoring.agent.exporters._http.type", "http")
.put("xpack.monitoring.agent.exporters._http.host", host)
.put("xpack.monitoring.agent.exporters._http.connection.keep_alive", false);
.put("xpack.monitoring.collection.exporters._http.type", "http")
.put("xpack.monitoring.collection.exporters._http.host", host)
.put("xpack.monitoring.collection.exporters._http.connection.keep_alive", false);
String agentNode = internalCluster().startNode(builder);
HttpExporter exporter = getExporter(agentNode);

View File

@ -65,8 +65,8 @@ public class LocalExporterTests extends MonitoringIntegTestCase {
public void testSimpleExport() throws Exception {
internalCluster().startNode(Settings.builder()
.put("xpack.monitoring.agent.exporters._local.type", LocalExporter.TYPE)
.put("xpack.monitoring.agent.exporters._local.enabled", true)
.put("xpack.monitoring.collection.exporters._local.type", LocalExporter.TYPE)
.put("xpack.monitoring.collection.exporters._local.enabled", true)
.build());
securedEnsureGreen();
@ -96,7 +96,7 @@ public class LocalExporterTests extends MonitoringIntegTestCase {
public void testTemplateCreation() throws Exception {
internalCluster().startNode(Settings.builder()
.put("xpack.monitoring.agent.exporters._local.type", LocalExporter.TYPE)
.put("xpack.monitoring.collection.exporters._local.type", LocalExporter.TYPE)
.build());
securedEnsureGreen();
@ -111,8 +111,8 @@ public class LocalExporterTests extends MonitoringIntegTestCase {
String timeFormat = randomFrom("YY", "YYYY", "YYYY.MM", "YYYY-MM", "MM.YYYY", "MM");
internalCluster().startNode(Settings.builder()
.put("xpack.monitoring.agent.exporters._local.type", LocalExporter.TYPE)
.put("xpack.monitoring.agent.exporters._local." + LocalExporter.INDEX_NAME_TIME_FORMAT_SETTING, timeFormat)
.put("xpack.monitoring.collection.exporters._local.type", LocalExporter.TYPE)
.put("xpack.monitoring.collection.exporters._local." + LocalExporter.INDEX_NAME_TIME_FORMAT_SETTING, timeFormat)
.build());
securedEnsureGreen();
@ -130,7 +130,7 @@ public class LocalExporterTests extends MonitoringIntegTestCase {
logger.debug("--> updates the timestamp");
timeFormat = randomFrom("dd", "dd.MM.YYYY", "dd.MM");
updateClusterSettings(Settings.builder().put("xpack.monitoring.agent.exporters._local.index.name.time_format", timeFormat));
updateClusterSettings(Settings.builder().put("xpack.monitoring.collection.exporters._local.index.name.time_format", timeFormat));
exporter = getLocalExporter("_local"); // we need to get it again.. as it was rebuilt
indexName = ".monitoring-es-" + MonitoringTemplateUtils.TEMPLATE_VERSION + "-"
+ DateTimeFormat.forPattern(timeFormat).withZoneUTC().print(doc.getTimestamp());
@ -144,8 +144,8 @@ public class LocalExporterTests extends MonitoringIntegTestCase {
public void testLocalExporterFlush() throws Exception {
internalCluster().startNode(Settings.builder()
.put("xpack.monitoring.agent.exporters._local.type", LocalExporter.TYPE)
.put("xpack.monitoring.agent.exporters._local.enabled", true)
.put("xpack.monitoring.collection.exporters._local.type", LocalExporter.TYPE)
.put("xpack.monitoring.collection.exporters._local.enabled", true)
.build());
securedEnsureGreen();

View File

@ -44,7 +44,7 @@ public class ClusterStateTests extends MonitoringIntegTestCase {
.put(super.nodeSettings(nodeOrdinal))
.put(MonitoringSettings.INTERVAL.getKey(), "-1")
.put(MonitoringSettings.COLLECTORS.getKey(), ClusterStateCollector.NAME)
.put("xpack.monitoring.agent.exporters.default_local.type", "local")
.put("xpack.monitoring.collection.exporters.default_local.type", "local")
.put("node.attr.custom", randomInt)
.build();
}

View File

@ -32,7 +32,7 @@ public class ClusterStatsTests extends MonitoringIntegTestCase {
.put(super.nodeSettings(nodeOrdinal))
.put(MonitoringSettings.INTERVAL.getKey(), "-1")
.put(MonitoringSettings.COLLECTORS.getKey(), ClusterStatsCollector.NAME)
.put("xpack.monitoring.agent.exporters.default_local.type", "local")
.put("xpack.monitoring.collection.exporters.default_local.type", "local")
.build();
}

View File

@ -38,7 +38,7 @@ public class IndexRecoveryTests extends MonitoringIntegTestCase {
.put(MonitoringSettings.INTERVAL.getKey(), "-1")
.put(MonitoringSettings.INDICES.getKey(), INDEX_PREFIX + "*")
.put(MonitoringSettings.COLLECTORS.getKey(), IndexRecoveryCollector.NAME)
.put("xpack.monitoring.agent.exporters.default_local.type", "local")
.put("xpack.monitoring.collection.exporters.default_local.type", "local")
.build();
}

View File

@ -30,7 +30,7 @@ public class IndexStatsTests extends MonitoringIntegTestCase {
.put(super.nodeSettings(nodeOrdinal))
.put(MonitoringSettings.INTERVAL.getKey(), "-1")
.put(MonitoringSettings.COLLECTORS.getKey(), IndexStatsCollector.NAME)
.put("xpack.monitoring.agent.exporters.default_local.type", "local")
.put("xpack.monitoring.collection.exporters.default_local.type", "local")
.build();
}

View File

@ -30,7 +30,7 @@ public class IndicesStatsTests extends MonitoringIntegTestCase {
.put(super.nodeSettings(nodeOrdinal))
.put(MonitoringSettings.INTERVAL.getKey(), "-1")
.put(MonitoringSettings.COLLECTORS.getKey(), IndicesStatsCollector.NAME)
.put("xpack.monitoring.agent.exporters.default_local.type", "local")
.put("xpack.monitoring.collection.exporters.default_local.type", "local")
.build();
}

View File

@ -35,7 +35,7 @@ public class MultiNodesStatsTests extends MonitoringIntegTestCase {
return Settings.builder()
.put(super.nodeSettings(nodeOrdinal))
.put(MonitoringSettings.INTERVAL.getKey(), "-1")
.put("xpack.monitoring.agent.exporters.default_local.type", "local")
.put("xpack.monitoring.collection.exporters.default_local.type", "local")
.build();
}

View File

@ -33,7 +33,7 @@ public class NodeStatsTests extends MonitoringIntegTestCase {
.put(super.nodeSettings(nodeOrdinal))
.put(MonitoringSettings.INTERVAL.getKey(), "-1")
.put(MonitoringSettings.COLLECTORS.getKey(), NodeStatsCollector.NAME)
.put("xpack.monitoring.agent.exporters.default_local.type", LocalExporter.TYPE)
.put("xpack.monitoring.collection.exporters.default_local.type", LocalExporter.TYPE)
.build();
}

View File

@ -46,7 +46,7 @@ public class ShardsTests extends MonitoringIntegTestCase {
.put(MonitoringSettings.INTERVAL.getKey(), "-1")
.put(MonitoringSettings.COLLECTORS.getKey(), ShardsCollector.NAME)
.put(MonitoringSettings.INDICES.getKey(), INDEX_PREFIX + "*")
.put("xpack.monitoring.agent.exporters.default_local.type", "local")
.put("xpack.monitoring.collection.exporters.default_local.type", "local")
.build();
}

View File

@ -33,7 +33,7 @@ public class LocalIndicesCleanerTests extends AbstractIndicesCleanerTestCase {
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder()
.put(super.nodeSettings(nodeOrdinal))
.put("xpack.monitoring.agent.exporters._local.type", LocalExporter.TYPE)
.put("xpack.monitoring.collection.exporters._local.type", LocalExporter.TYPE)
.build();
}

View File

@ -14,7 +14,6 @@ import org.elasticsearch.common.xcontent.json.JsonXContent;
import org.elasticsearch.xpack.monitoring.MonitoringSettings;
import org.elasticsearch.xpack.monitoring.test.MonitoringIntegTestCase;
import org.elasticsearch.xpack.security.authc.support.SecuredString;
import org.hamcrest.Matchers;
import java.util.Collections;
import java.util.Map;
@ -22,7 +21,8 @@ import java.util.Map;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.extractValue;
import static org.elasticsearch.xpack.security.authc.support.UsernamePasswordToken.BASIC_AUTH_HEADER;
import static org.elasticsearch.xpack.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.Matchers.equalTo;
public class MonitoringSettingsFilterTests extends MonitoringIntegTestCase {
@ -32,13 +32,13 @@ public class MonitoringSettingsFilterTests extends MonitoringIntegTestCase {
.put(super.nodeSettings(nodeOrdinal))
.put(NetworkModule.HTTP_ENABLED.getKey(), true)
.put(MonitoringSettings.INTERVAL.getKey(), "-1")
.put("xpack.monitoring.agent.exporters._http.type", "http")
.put("xpack.monitoring.agent.exporters._http.enabled", false)
.put("xpack.monitoring.agent.exporters._http.auth.username", "_user")
.put("xpack.monitoring.agent.exporters._http.auth.password", "_passwd")
.put("xpack.monitoring.agent.exporters._http.ssl.truststore.path", "/path/to/truststore")
.put("xpack.monitoring.agent.exporters._http.ssl.truststore.password", "_passwd")
.put("xpack.monitoring.agent.exporters._http.ssl.hostname_verification", true)
.put("xpack.monitoring.collection.exporters._http.type", "http")
.put("xpack.monitoring.collection.exporters._http.enabled", false)
.put("xpack.monitoring.collection.exporters._http.auth.username", "_user")
.put("xpack.monitoring.collection.exporters._http.auth.password", "_passwd")
.put("xpack.monitoring.collection.exporters._http.ssl.truststore.path", "/path/to/truststore")
.put("xpack.monitoring.collection.exporters._http.ssl.truststore.password", "_passwd")
.put("xpack.monitoring.collection.exporters._http.ssl.hostname_verification", true)
.build();
}
@ -60,13 +60,13 @@ public class MonitoringSettingsFilterTests extends MonitoringIntegTestCase {
for (Object node : nodes.values()) {
@SuppressWarnings("unchecked")
Map<String, Object> settings = (Map<String, Object>) ((Map<String, Object>) node).get("settings");
assertThat(extractValue("xpack.monitoring.agent.exporters._http.type", settings), Matchers.<Object>equalTo("http"));
assertThat(extractValue("xpack.monitoring.agent.exporters._http.enabled", settings), Matchers.<Object>equalTo("false"));
assertNullSetting(settings, "xpack.monitoring.agent.exporters._http.auth.username");
assertNullSetting(settings, "xpack.monitoring.agent.exporters._http.auth.password");
assertNullSetting(settings, "xpack.monitoring.agent.exporters._http.ssl.truststore.path");
assertNullSetting(settings, "xpack.monitoring.agent.exporters._http.ssl.truststore.password");
assertNullSetting(settings, "xpack.monitoring.agent.exporters._http.ssl.hostname_verification");
assertThat(extractValue("xpack.monitoring.collection.exporters._http.type", settings), equalTo("http"));
assertThat(extractValue("xpack.monitoring.collection.exporters._http.enabled", settings), equalTo("false"));
assertNullSetting(settings, "xpack.monitoring.collection.exporters._http.auth.username");
assertNullSetting(settings, "xpack.monitoring.collection.exporters._http.auth.password");
assertNullSetting(settings, "xpack.monitoring.collection.exporters._http.ssl.truststore.path");
assertNullSetting(settings, "xpack.monitoring.collection.exporters._http.ssl.truststore.password");
assertNullSetting(settings, "xpack.monitoring.collection.exporters._http.ssl.hostname_verification");
}
}
}