diff --git a/plugin/src/main/java/org/elasticsearch/xpack/monitoring/MonitoredSystem.java b/plugin/src/main/java/org/elasticsearch/xpack/monitoring/MonitoredSystem.java index 25d7420dc2b..96cee79f148 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/monitoring/MonitoredSystem.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/monitoring/MonitoredSystem.java @@ -12,8 +12,7 @@ public enum MonitoredSystem { ES("es"), KIBANA("kibana"), LOGSTASH("logstash"), - BEATS("beats"), - LOGSTASH_STATES("logstash-states"); + BEATS("beats"); private final String system; @@ -26,23 +25,17 @@ public enum MonitoredSystem { } public static MonitoredSystem fromSystem(String system) { - switch (transformSystemName(system)) { + switch (system.toLowerCase(Locale.ROOT)) { case "es": return ES; case "kibana": return KIBANA; case "logstash": return LOGSTASH; - case "logstash-states": - return LOGSTASH_STATES; case "beats": return BEATS; default: throw new IllegalArgumentException("Unknown monitoring system [" + system + "]"); } } - - public static String transformSystemName(String systemName) { - return systemName.toLowerCase(Locale.ROOT).replace("_", "-"); - } } diff --git a/plugin/src/main/java/org/elasticsearch/xpack/monitoring/resolver/ResolversRegistry.java b/plugin/src/main/java/org/elasticsearch/xpack/monitoring/resolver/ResolversRegistry.java index 32d177b24a4..bb706cbeeec 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/monitoring/resolver/ResolversRegistry.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/monitoring/resolver/ResolversRegistry.java @@ -49,7 +49,6 @@ public class ResolversRegistry implements Iterable // register resolvers for monitored systems registerMonitoredSystem(MonitoredSystem.KIBANA, settings); registerMonitoredSystem(MonitoredSystem.LOGSTASH, settings); - registerMonitoredSystem(MonitoredSystem.LOGSTASH_STATES, settings); registerMonitoredSystem(MonitoredSystem.BEATS, settings); } diff --git a/plugin/src/main/resources/monitoring-logstash-states.json b/plugin/src/main/resources/monitoring-logstash-states.json deleted file mode 100644 index 0b7d6031286..00000000000 --- a/plugin/src/main/resources/monitoring-logstash-states.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "index_patterns": ".monitoring-logstash-states-${monitoring.template.version}-*", - "version": 6000002, - "settings": { - "index.number_of_shards": 1, - "index.number_of_replicas": 1, - "index.codec": "best_compression" - }, - "mappings": { - "doc": { - "dynamic": "false", - "properties": { - "cluster_uuid": { - "type": "keyword" - }, - "timestamp": { - "type": "date", - "format": "date_time" - }, - "type": { - "type": "keyword" - }, - "source_node": { - "properties": { - "uuid": { - "type": "keyword" - }, - "host": { - "type": "keyword" - }, - "transport_address": { - "type": "keyword" - }, - "ip": { - "type": "keyword" - }, - "name": { - "type": "keyword" - } - } - }, - "logstash_state": { - "properties": { - "timestamp": { - "type": "date" - }, - "uuid": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "host": { - "type": "keyword" - }, - "http_address": { - "type": "keyword" - }, - "version": { - "type": "keyword" - }, - "snapshot": { - "type": "boolean" - }, - "status": { - "type": "keyword" - }, - "pipeline": { - "properties": { - "name": { - "type": "keyword" - }, - "hash": { - "type": "keyword" - }, - "workers": { - "type": "short" - }, - "batch_size": { - "type": "integer" - }, - "format": { - "type": "keyword" - }, - "version": { - "type": "keyword" - }, - "representation": { - "enabled": false - } - } - } - } - } - } - } - } -} diff --git a/plugin/src/main/resources/monitoring-logstash.json b/plugin/src/main/resources/monitoring-logstash.json index d0a3ed1975d..e939f778eea 100644 --- a/plugin/src/main/resources/monitoring-logstash.json +++ b/plugin/src/main/resources/monitoring-logstash.json @@ -329,6 +329,59 @@ } } } + }, + "logstash_state": { + "properties": { + "timestamp": { + "type": "date" + }, + "uuid": { + "type": "keyword" + }, + "name": { + "type": "keyword" + }, + "host": { + "type": "keyword" + }, + "http_address": { + "type": "keyword" + }, + "version": { + "type": "keyword" + }, + "snapshot": { + "type": "boolean" + }, + "status": { + "type": "keyword" + }, + "pipeline": { + "properties": { + "name": { + "type": "keyword" + }, + "hash": { + "type": "keyword" + }, + "workers": { + "type": "short" + }, + "batch_size": { + "type": "integer" + }, + "format": { + "type": "keyword" + }, + "version": { + "type": "keyword" + }, + "representation": { + "enabled": false + } + } + } + } } } } diff --git a/plugin/src/test/java/org/elasticsearch/xpack/monitoring/MonitoredSystemTests.java b/plugin/src/test/java/org/elasticsearch/xpack/monitoring/MonitoredSystemTests.java index 90b4c454151..287f461fee5 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/monitoring/MonitoredSystemTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/monitoring/MonitoredSystemTests.java @@ -19,14 +19,16 @@ public class MonitoredSystemTests extends ESTestCase { public void testGetSystem() { // everything is just lowercased... for (final MonitoredSystem system : MonitoredSystem.values()) { - assertEquals(MonitoredSystem.transformSystemName(system.name()), system.getSystem()); + assertEquals(system.name().toLowerCase(Locale.ROOT), system.getSystem()); } } public void testFromSystem() { for (final MonitoredSystem system : MonitoredSystem.values()) { + final String lowercased = system.name().toLowerCase(Locale.ROOT); + assertSame(system, MonitoredSystem.fromSystem(system.name())); - assertSame(system, MonitoredSystem.fromSystem(MonitoredSystem.transformSystemName(system.name()))); + assertSame(system, MonitoredSystem.fromSystem(lowercased)); } } @@ -40,9 +42,4 @@ public class MonitoredSystemTests extends ESTestCase { assertThat(e.getMessage(), containsString(unknownSystem)); } - public void testTransformSystemName() { - final String systemName = "MiXED_System_Name"; - assertEquals(MonitoredSystem.transformSystemName(systemName), "mixed-system-name"); - } - } diff --git a/plugin/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterResourceTests.java b/plugin/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterResourceTests.java index 4010b09dca1..419de48d737 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterResourceTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterResourceTests.java @@ -54,7 +54,7 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe * kibana, logstash, beats */ private final int EXPECTED_TYPES = MonitoringTemplateUtils.NEW_DATA_TYPES.length; - private final int EXPECTED_TEMPLATES = 7; + private final int EXPECTED_TEMPLATES = 6; private final int EXPECTED_WATCHES = 4; private final RestClient client = mock(RestClient.class); diff --git a/plugin/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterTests.java b/plugin/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterTests.java index 324ce684e30..ff6840dfaa0 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterTests.java @@ -357,7 +357,7 @@ public class HttpExporterTests extends ESTestCase { equalTo(version + typeMappings.size() + templates.size() + pipelines.size() + watcherCheck.size() + bwc.size())); assertThat(version, equalTo(1)); assertThat(typeMappings, hasSize(MonitoringTemplateUtils.NEW_DATA_TYPES.length)); - assertThat(templates, hasSize(7)); + assertThat(templates, hasSize(6)); assertThat(pipelines, hasSize(useIngest ? 1 : 0)); assertThat(watcherCheck, hasSize(clusterAlertManagement ? 1 : 0)); assertThat(watches, hasSize(clusterAlertManagement ? ClusterAlertsUtil.WATCH_IDS.length : 0));