Przeglądaj źródła

Remove Monitoring ingest pipelines (#77459)

Monitoring installs a number of ingest pipelines which have been historically used
to upgrade documents when mappings and document structures change between 
versions. Since there aren't any changes to the document format, nor will there be 
by the time the format is completely retired, we can comfortably remove these 
pipelines.
James Baiera 4 lat temu
rodzic
commit
eafbd336c2
18 zmienionych plików z 69 dodań i 816 usunięć
  1. 2 0
      docs/reference/migration/migrate_8_0.asciidoc
  2. 33 0
      docs/reference/migration/migrate_8_0/monitoring.asciidoc
  3. 0 108
      x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/exporter/MonitoringTemplateUtils.java
  4. 3 1
      x-pack/plugin/enrich/qa/common/src/main/java/org/elasticsearch/test/enrich/CommonEnrichRestTestCase.java
  5. 16 49
      x-pack/plugin/monitoring/src/internalClusterTest/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java
  6. 1 9
      x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/Exporter.java
  7. 1 44
      x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java
  8. 0 90
      x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/PipelineHttpResource.java
  9. 1 8
      x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalBulk.java
  10. 6 92
      x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporter.java
  11. 4 4
      x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/ExportersTests.java
  12. 0 18
      x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/MonitoringTemplateUtilsTests.java
  13. 1 165
      x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterResourceTests.java
  14. 1 30
      x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterTests.java
  15. 0 93
      x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/PipelineHttpResourceTests.java
  16. 0 23
      x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporterIntegTests.java
  17. 0 62
      x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporterResourceIntegTests.java
  18. 0 20
      x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/test/MonitoringIntegTestCase.java

+ 2 - 0
docs/reference/migration/migrate_8_0.asciidoc

@@ -25,6 +25,7 @@ coming[8.0.0]
 * <<breaking_80_ingest_changes>>
 * <<breaking_80_java_changes>>
 * <<breaking_80_mappings_changes>>
+* <<breaking_80_monitoring_changes>>
 * <<breaking_80_network_changes>>
 * <<breaking_80_node_changes>>
 * <<breaking_80_packaging_changes>>
@@ -126,6 +127,7 @@ include::migrate_8_0/indices.asciidoc[]
 include::migrate_8_0/ingest.asciidoc[]
 include::migrate_8_0/java.asciidoc[]
 include::migrate_8_0/mappings.asciidoc[]
+include::migrate_8_0/monitoring.asciidoc[]
 include::migrate_8_0/network.asciidoc[]
 include::migrate_8_0/node.asciidoc[]
 include::migrate_8_0/packaging.asciidoc[]

+ 33 - 0
docs/reference/migration/migrate_8_0/monitoring.asciidoc

@@ -0,0 +1,33 @@
+[discreet]
+[[breaking_80_monitoring_changes]]
+=== Monitoring changes
+
+//NOTE: The notable-breaking-changes tagged regions are re-used in the
+//Installation and Upgrade Guide
+
+//tag::notable-breaking-changes[]
+.The `use_ingest` setting on Monitoring exporter configurations has been removed.
+[%collapsible]
+====
+*Details* +
+The `xpack.monitoring.exporters.*.use_ingest` property was deprecated in 7.16.0 and
+has been removed. This parameter controlled the creation of pipelines for monitoring
+indices that previously had no function.
+
+*Impact* +
+Discontinue the use of the `xpack.monitoring.exporters.*.use_ingest` setting.
+====
+
+.The `index.pipeline.master_timeout` setting on Monitoring HTTP exporter configurations has been removed.
+[%collapsible]
+====
+*Details* +
+The `xpack.monitoring.exporters.*.index.pipeline.master_timeout` property was
+deprecated in 7.16.0. This parameter set the timeout when waiting for the remote
+Monitoring cluster to create pipelines. Those pipelines for monitoring indices previously
+had no function and are now removed in 8.0.0.
+
+*Impact* +
+Discontinue the use of the `xpack.monitoring.exporters.*.index.pipeline.master_timeout` setting.
+====
+//end::notable-breaking-changes[]

+ 0 - 108
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/exporter/MonitoringTemplateUtils.java

@@ -7,15 +7,10 @@
 package org.elasticsearch.xpack.core.monitoring.exporter;
 
 import org.elasticsearch.Version;
-import org.elasticsearch.common.Strings;
-import org.elasticsearch.common.bytes.BytesReference;
 import org.elasticsearch.common.time.DateFormatter;
-import org.elasticsearch.common.xcontent.XContentBuilder;
-import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.xpack.core.monitoring.MonitoredSystem;
 import org.elasticsearch.xpack.core.template.TemplateUtils;
 
-import java.io.IOException;
 import java.time.Instant;
 import java.util.Locale;
 
@@ -60,11 +55,6 @@ public final class MonitoringTemplateUtils {
      */
     public static final String[] OLD_TEMPLATE_IDS = { "data", "es", "kibana", "logstash" }; //excluding alerts since 6.x watches use it
 
-    /**
-     * IDs of pipelines that can be used with
-     */
-    public static final String[] PIPELINE_IDS = { TEMPLATE_VERSION, OLD_TEMPLATE_VERSION };
-
     private MonitoringTemplateUtils() { }
 
     /**
@@ -107,104 +97,6 @@ public final class MonitoringTemplateUtils {
         return "{\"index_patterns\":[\".monitoring-" + id + "-" + OLD_TEMPLATE_VERSION + "*\"],\"version\":" + LAST_UPDATED_VERSION + "}";
     }
 
-    /**
-     * Get a pipeline name for any template ID.
-     *
-     * @param id The template identifier.
-     * @return Never {@code null} {@link String} prefixed by "xpack_monitoring_" and the {@code id}.
-     * @see #TEMPLATE_IDS
-     */
-    public static String pipelineName(String id) {
-        return "xpack_monitoring_" + id;
-    }
-
-    /**
-     * Create a pipeline that allows documents for different template versions to be upgraded.
-     * <p>
-     * The expectation is that you will call either {@link Strings#toString(XContentBuilder)} or
-     * {@link BytesReference#bytes(XContentBuilder)}}.
-     *
-     * @param id The API version (e.g., "6") to use
-     * @param type The type of data you want to format for the request
-     * @return Never {@code null}. Always an ended-object.
-     * @throws IllegalArgumentException if {@code apiVersion} is unrecognized
-     * @see #PIPELINE_IDS
-     */
-    public static XContentBuilder loadPipeline(final String id, final XContentType type) {
-        switch (id) {
-            case TEMPLATE_VERSION:
-                return emptyPipeline(type);
-            case OLD_TEMPLATE_VERSION:
-                return pipelineForApiVersion6(type);
-        }
-
-        throw new IllegalArgumentException("unrecognized pipeline API version [" + id + "]");
-    }
-
-    /**
-     * Create a pipeline to upgrade documents from {@link MonitoringTemplateUtils#OLD_TEMPLATE_VERSION}
-     * The expectation is that you will call either {@link Strings#toString(XContentBuilder)} or
-     * {@link BytesReference#bytes(XContentBuilder)}}.
-     *
-     * @param type The type of data you want to format for the request
-     * @return Never {@code null}. Always an ended-object.
-     * @see #LAST_UPDATED_VERSION
-     */
-    static XContentBuilder pipelineForApiVersion6(final XContentType type) {
-        try {
-            return XContentBuilder.builder(type.xContent()).startObject()
-                    .field("description", "This pipeline upgrades documents from the older version of the Monitoring API to " +
-                        "the newer version (" + TEMPLATE_VERSION + ") by fixing breaking " +
-                        "changes in those older documents before they are indexed from the older version (" +
-                        OLD_TEMPLATE_VERSION + ").")
-                    .field("version", LAST_UPDATED_VERSION)
-                    .startArray("processors")
-                        .startObject()
-                            // remove the type
-                            .startObject("script")
-                                .field("source","ctx._type = null" )
-                            .endObject()
-                        .endObject()
-                        .startObject()
-                            // ensure the data lands in the correct index
-                            .startObject("gsub")
-                                .field("field", "_index")
-                                .field("pattern", "(.monitoring-\\w+-)6(-.+)")
-                                .field("replacement", "$1" + TEMPLATE_VERSION + "$2")
-                            .endObject()
-                        .endObject()
-                    .endArray()
-                .endObject();
-        } catch (final IOException e) {
-            throw new RuntimeException("Failed to create pipeline to upgrade from older version [" + OLD_TEMPLATE_VERSION +
-                "] to the newer version [" + TEMPLATE_VERSION + "].", e);
-        }
-    }
-
-    /**
-     * Create an empty pipeline.
-     * The expectation is that you will call either {@link Strings#toString(XContentBuilder)} or
-     * {@link BytesReference#bytes(XContentBuilder)}}.
-     *
-     * @param type The type of data you want to format for the request
-     * @return Never {@code null}. Always an ended-object.
-     * @see #LAST_UPDATED_VERSION
-     */
-    public static XContentBuilder emptyPipeline(final XContentType type) {
-        try {
-            // For now: We prepend the API version to the string so that it's easy to parse in the future; if we ever add metadata
-            //  to pipelines, then it would better serve this use case
-            return XContentBuilder.builder(type.xContent()).startObject()
-                    .field("description", "This is a placeholder pipeline for Monitoring API version " + TEMPLATE_VERSION +
-                                                " so that future versions may fix breaking changes.")
-                    .field("version", LAST_UPDATED_VERSION)
-                    .startArray("processors").endArray()
-                    .endObject();
-        } catch (final IOException e) {
-            throw new RuntimeException("Failed to create empty pipeline", e);
-        }
-    }
-
     /**
      * Get the index name given a specific date format, a monitored system and a timestamp.
      *

+ 3 - 1
x-pack/plugin/enrich/qa/common/src/main/java/org/elasticsearch/test/enrich/CommonEnrichRestTestCase.java

@@ -210,8 +210,10 @@ public abstract class CommonEnrichRestTestCase extends ESRestTestCase {
         );
         assertTrue(
             exc.getMessage()
-                .contains("Could not delete policy [my_policy] because" + " a pipeline is referencing it [my_pipeline, another_pipeline]")
+                .contains("Could not delete policy [my_policy] because a pipeline is referencing it [")
         );
+        assertTrue(exc.getMessage().contains("another_pipeline"));
+        assertTrue(exc.getMessage().contains("my_pipeline"));
 
         // delete the pipelines so the policies can be deleted
         client().performRequest(new Request("DELETE", "/_ingest/pipeline/my_pipeline"));

+ 16 - 49
x-pack/plugin/monitoring/src/internalClusterTest/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java

@@ -95,7 +95,6 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
             rarely() ? randomSubsetOf(Arrays.asList(ClusterAlertsUtil.WATCH_IDS)) : Collections.emptyList();
     private final boolean templatesExistsAlready = randomBoolean();
     private final boolean includeOldTemplates = randomBoolean();
-    private final boolean pipelineExistsAlready = randomBoolean();
     private final boolean remoteClusterAllowsWatcher = randomBoolean();
     private final boolean currentLicenseAllowsWatcher = true;
     private final boolean watcherAlreadyExists = randomBoolean();
@@ -157,7 +156,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
 
         enqueueGetClusterVersionResponse(Version.CURRENT);
         enqueueSetupResponses(webServer,
-                              templatesExistsAlready, includeOldTemplates, pipelineExistsAlready,
+                              templatesExistsAlready, includeOldTemplates,
                               remoteClusterAllowsWatcher, currentLicenseAllowsWatcher, watcherAlreadyExists);
         enqueueResponse(200, "{\"errors\": false, \"msg\": \"successful bulk request\"}");
 
@@ -165,7 +164,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
         export(settings, newRandomMonitoringDocs(nbDocs));
 
         assertMonitorResources(webServer,
-                               templatesExistsAlready, includeOldTemplates, pipelineExistsAlready,
+                               templatesExistsAlready, includeOldTemplates,
                                remoteClusterAllowsWatcher, currentLicenseAllowsWatcher, watcherAlreadyExists);
         assertBulk(webServer, nbDocs);
     }
@@ -184,7 +183,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
 
         enqueueGetClusterVersionResponse(Version.CURRENT);
         enqueueSetupResponses(webServer,
-            templatesExistsAlready, includeOldTemplates, pipelineExistsAlready,
+            templatesExistsAlready, includeOldTemplates,
             remoteClusterAllowsWatcher, currentLicenseAllowsWatcher, watcherAlreadyExists);
         enqueueResponse(200, "{\"errors\": false, \"msg\": \"successful bulk request\"}");
 
@@ -197,7 +196,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
         localStateMonitoring.getMonitoring().reload(settings);
         enqueueGetClusterVersionResponse(Version.CURRENT);
         enqueueSetupResponses(webServer,
-            templatesExistsAlready, includeOldTemplates, pipelineExistsAlready,
+            templatesExistsAlready, includeOldTemplates,
             remoteClusterAllowsWatcher, currentLicenseAllowsWatcher, watcherAlreadyExists);
         enqueueResponse(200, "{\"errors\": false, \"msg\": \"successful bulk request\"}");
 
@@ -223,7 +222,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
 
         enqueueGetClusterVersionResponse(Version.CURRENT);
         enqueueSetupResponses(webServer,
-                              templatesExistsAlready, includeOldTemplates, pipelineExistsAlready,
+                              templatesExistsAlready, includeOldTemplates,
                               remoteClusterAllowsWatcher, currentLicenseAllowsWatcher, watcherAlreadyExists);
         enqueueResponse(200, "{\"errors\": false, \"msg\": \"successful bulk request\"}");
 
@@ -231,7 +230,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
         export(settings, newRandomMonitoringDocs(nbDocs));
 
         assertMonitorResources(webServer,
-                               templatesExistsAlready, includeOldTemplates, pipelineExistsAlready,
+                               templatesExistsAlready, includeOldTemplates,
                                remoteClusterAllowsWatcher, currentLicenseAllowsWatcher, watcherAlreadyExists,
                                headers, null);
         assertBulk(webServer, nbDocs, headers, null);
@@ -276,7 +275,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
 
         enqueueGetClusterVersionResponse(Version.CURRENT);
         enqueueSetupResponses(webServer,
-                              templatesExistsAlready, includeOldTemplates, pipelineExistsAlready,
+                              templatesExistsAlready, includeOldTemplates,
                               remoteClusterAllowsWatcher, currentLicenseAllowsWatcher, watcherAlreadyExists);
         enqueueResponse(200, "{\"errors\": false}");
 
@@ -284,7 +283,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
         export(builder.build(), newRandomMonitoringDocs(nbDocs));
 
         assertMonitorResources(webServer,
-                               templatesExistsAlready, includeOldTemplates, pipelineExistsAlready,
+                               templatesExistsAlready, includeOldTemplates,
                                remoteClusterAllowsWatcher, currentLicenseAllowsWatcher, watcherAlreadyExists,
                                headers, basePath);
         assertBulk(webServer, nbDocs, headers, basePath);
@@ -295,14 +294,14 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
 
         enqueueGetClusterVersionResponse(Version.CURRENT);
         enqueueSetupResponses(webServer,
-                              templatesExistsAlready, includeOldTemplates, pipelineExistsAlready,
+                              templatesExistsAlready, includeOldTemplates,
                               remoteClusterAllowsWatcher, currentLicenseAllowsWatcher, watcherAlreadyExists);
         enqueueResponse(200, "{\"errors\": false}");
 
         export(settings, Collections.singletonList(newRandomMonitoringDoc()));
 
         assertMonitorResources(webServer,
-                               templatesExistsAlready, includeOldTemplates, pipelineExistsAlready,
+                               templatesExistsAlready, includeOldTemplates,
                                remoteClusterAllowsWatcher, currentLicenseAllowsWatcher, watcherAlreadyExists);
         assertBulk(webServer);
 
@@ -327,7 +326,6 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
                 }
             }
             // opposite of if it existed before
-            enqueuePipelineResponses(secondWebServer, pipelineExistsAlready == false);
             enqueueWatcherResponses(secondWebServer, remoteClusterAllowsWatcher, currentLicenseAllowsWatcher, watcherAlreadyExists);
             enqueueResponse(secondWebServer, 200, "{\"errors\": false}");
 
@@ -351,7 +349,6 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
                     assertThat(recordedRequest.getBody(), equalTo(getExternalTemplateRepresentation(template.v2())));
                 }
             }
-            assertMonitorPipelines(secondWebServer, pipelineExistsAlready == false, null, null);
             assertMonitorWatches(secondWebServer, remoteClusterAllowsWatcher, currentLicenseAllowsWatcher, watcherAlreadyExists,
                                  null, null);
             assertBulk(secondWebServer);
@@ -402,7 +399,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
 
         enqueueGetClusterVersionResponse(Version.CURRENT);
         enqueueSetupResponses(webServer,
-                              templatesExistsAlready, includeOldTemplates, pipelineExistsAlready,
+                              templatesExistsAlready, includeOldTemplates,
                               remoteClusterAllowsWatcher, currentLicenseAllowsWatcher, watcherAlreadyExists);
         enqueueResponse(200, "{\"errors\": false, \"msg\": \"successful bulk request\"}");
 
@@ -410,7 +407,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
         export(settings, Collections.singletonList(doc));
 
         assertMonitorResources(webServer,
-                               templatesExistsAlready, includeOldTemplates, pipelineExistsAlready,
+                               templatesExistsAlready, includeOldTemplates,
                                remoteClusterAllowsWatcher, currentLicenseAllowsWatcher, watcherAlreadyExists);
         MockRequest recordedRequest = assertBulk(webServer);
 
@@ -431,7 +428,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
                 .build();
 
         enqueueGetClusterVersionResponse(Version.CURRENT);
-        enqueueSetupResponses(webServer, true, includeOldTemplates, true,
+        enqueueSetupResponses(webServer, true, includeOldTemplates,
                               true, true, true);
         enqueueResponse(200, "{\"errors\": false, \"msg\": \"successful bulk request\"}");
 
@@ -443,7 +440,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
         String expectedMonitoringIndex = ".monitoring-es-" + TEMPLATE_VERSION + "-"
                 + newTimeFormatter.format(Instant.ofEpochMilli(doc.getTimestamp()));
 
-        assertMonitorResources(webServer, true, includeOldTemplates, true,
+        assertMonitorResources(webServer, true, includeOldTemplates,
                                true, true, true);
         recordedRequest = assertBulk(webServer);
 
@@ -473,24 +470,21 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
 
     private void assertMonitorResources(final MockWebServer webServer,
                                         final boolean templateAlreadyExists, final boolean includeOldTemplates,
-                                        final boolean pipelineAlreadyExists,
                                         final boolean remoteClusterAllowsWatcher, final boolean currentLicenseAllowsWatcher,
                                         final boolean watcherAlreadyExists) throws Exception {
-        assertMonitorResources(webServer, templateAlreadyExists, includeOldTemplates, pipelineAlreadyExists,
+        assertMonitorResources(webServer, templateAlreadyExists, includeOldTemplates,
                                remoteClusterAllowsWatcher, currentLicenseAllowsWatcher, watcherAlreadyExists,
                                null, null);
     }
 
     private void assertMonitorResources(final MockWebServer webServer,
                                         final boolean templateAlreadyExists, final boolean includeOldTemplates,
-                                        final boolean pipelineAlreadyExists,
                                         final boolean remoteClusterAllowsWatcher, final boolean currentLicenseAllowsWatcher,
                                         final boolean watcherAlreadyExists,
                                         @Nullable final Map<String, String[]> customHeaders,
                                         @Nullable final String basePath) throws Exception {
         assertMonitorVersion(webServer, customHeaders, basePath);
         assertMonitorTemplates(webServer, templateAlreadyExists, includeOldTemplates, customHeaders, basePath);
-        assertMonitorPipelines(webServer, pipelineAlreadyExists, customHeaders, basePath);
         assertMonitorWatches(webServer, remoteClusterAllowsWatcher, currentLicenseAllowsWatcher, watcherAlreadyExists,
                              customHeaders, basePath);
     }
@@ -505,14 +499,6 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
         assertMonitorVersionResource(webServer, alreadyExists, "/_template/", templates, customHeaders, basePath);
     }
 
-    private void assertMonitorPipelines(final MockWebServer webServer,
-                                        final boolean alreadyExists,
-                                        @Nullable final Map<String, String[]> customHeaders,
-                                        @Nullable final String basePath) throws Exception {
-        assertMonitorVersionResource(webServer, alreadyExists, "/_ingest/pipeline/", monitoringPipelines(),
-                                     customHeaders, basePath);
-    }
-
     private void assertMonitorVersionResource(final MockWebServer webServer, final boolean alreadyExists,
                                               final String resourcePrefix, final List<Tuple<String, String>> resources,
                                               @Nullable final Map<String, String[]> customHeaders,
@@ -722,9 +708,8 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
     }
 
     private String bulkQueryString() {
-        final String pipelineName = MonitoringTemplateUtils.pipelineName(TEMPLATE_VERSION);
 
-        return "pipeline=" + pipelineName + "&filter_path=" + "errors,items.*.error";
+        return "filter_path=" + "errors,items.*.error";
     }
 
     private void enqueueGetClusterVersionResponse(Version v) throws IOException {
@@ -739,11 +724,9 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
 
     private void enqueueSetupResponses(final MockWebServer webServer,
                                        final boolean templatesAlreadyExists, final boolean includeOldTemplates,
-                                       final boolean pipelineAlreadyExists,
                                        final boolean remoteClusterAllowsWatcher, final boolean currentLicenseAllowsWatcher,
                                        final boolean watcherAlreadyExists) throws IOException {
         enqueueTemplateResponses(webServer, templatesAlreadyExists, includeOldTemplates);
-        enqueuePipelineResponses(webServer, pipelineAlreadyExists);
         enqueueWatcherResponses(webServer, remoteClusterAllowsWatcher, currentLicenseAllowsWatcher, watcherAlreadyExists);
     }
 
@@ -769,22 +752,6 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
         enqueueVersionedResourceResponsesExistsAlready(monitoringTemplateNames(includeOldTemplates), webServer);
     }
 
-    private void enqueuePipelineResponses(final MockWebServer webServer, final boolean alreadyExists) throws IOException {
-        if (alreadyExists) {
-            enqueuePipelineResponsesExistsAlready(webServer);
-        } else {
-            enqueuePipelineResponsesDoesNotExistYet(webServer);
-        }
-    }
-
-    private void enqueuePipelineResponsesDoesNotExistYet(final MockWebServer webServer) throws IOException {
-        enqueueVersionedResourceResponsesDoesNotExistYet(monitoringPipelineNames(), webServer);
-    }
-
-    private void enqueuePipelineResponsesExistsAlready(final MockWebServer webServer) throws IOException {
-        enqueueVersionedResourceResponsesExistsAlready(monitoringPipelineNames(), webServer);
-    }
-
     private void enqueueVersionedResourceResponsesDoesNotExistYet(final List<String> names, final MockWebServer webServer)
             throws IOException {
         for (String resource : names) {

+ 1 - 9
x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/Exporter.java

@@ -81,14 +81,6 @@ public abstract class Exporter implements AutoCloseable {
             },
             Property.Dynamic,
             Property.NodeScope));
-    /**
-     * Every {@code Exporter} adds the ingest pipeline to bulk requests, but they should, at the exporter level, allow that to be disabled.
-     * <p>
-     * Note: disabling it obviously loses any benefit of using it, but it does allow clusters that don't run with ingest to not use it.
-     */
-    public static final Setting.AffixSetting<Boolean> USE_INGEST_PIPELINE_SETTING =
-            Setting.affixKeySetting("xpack.monitoring.exporters.","use_ingest",
-                    key -> Setting.boolSetting(key, true, Property.Dynamic, Property.NodeScope), TYPE_DEPENDENCY);
     /**
      * Every {@code Exporter} allows users to explicitly disable cluster alerts.
      */
@@ -178,7 +170,7 @@ public abstract class Exporter implements AutoCloseable {
     }
 
     public static List<Setting.AffixSetting<?>> getSettings() {
-        return Arrays.asList(USE_INGEST_PIPELINE_SETTING, CLUSTER_ALERTS_MANAGEMENT_SETTING, TYPE_SETTING, ENABLED_SETTING,
+        return Arrays.asList(CLUSTER_ALERTS_MANAGEMENT_SETTING, TYPE_SETTING, ENABLED_SETTING,
                 INDEX_NAME_TIME_FORMAT_SETTING, CLUSTER_ALERTS_BLACKLIST_SETTING);
     }
 

+ 1 - 44
x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java

@@ -27,7 +27,6 @@ import org.elasticsearch.cluster.ClusterStateListener;
 import org.elasticsearch.cluster.service.ClusterService;
 import org.elasticsearch.core.Nullable;
 import org.elasticsearch.common.Strings;
-import org.elasticsearch.common.bytes.BytesReference;
 import org.elasticsearch.common.settings.SecureSetting;
 import org.elasticsearch.common.settings.SecureString;
 import org.elasticsearch.common.settings.Setting;
@@ -40,7 +39,6 @@ import org.elasticsearch.core.TimeValue;
 import org.elasticsearch.common.util.Maps;
 import org.elasticsearch.common.util.concurrent.ThreadContext;
 import org.elasticsearch.common.util.set.Sets;
-import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.license.XPackLicenseState.Feature;
 import org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils;
 import org.elasticsearch.xpack.core.ssl.SSLConfigurationSettings;
@@ -332,13 +330,6 @@ public class HttpExporter extends Exporter {
     public static final Setting.AffixSetting<Boolean> TEMPLATE_CREATE_LEGACY_VERSIONS_SETTING =
             Setting.affixKeySetting("xpack.monitoring.exporters.","index.template.create_legacy_templates",
                     (key) -> Setting.boolSetting(key, true, Property.Dynamic, Property.NodeScope), HTTP_TYPE_DEPENDENCY);
-    /**
-     * ES level timeout used when checking and writing pipelines (used to speed up tests)
-     */
-    public static final Setting.AffixSetting<TimeValue> PIPELINE_CHECK_TIMEOUT_SETTING =
-            Setting.affixKeySetting("xpack.monitoring.exporters.","index.pipeline.master_timeout",
-                    (key) -> Setting.timeSetting(key, TimeValue.MINUS_ONE, Property.Dynamic, Property.NodeScope), HTTP_TYPE_DEPENDENCY);
-
     /**
      * Minimum supported version of the remote monitoring cluster (same major).
      */
@@ -621,8 +612,6 @@ public class HttpExporter extends Exporter {
         resources.add(new VersionHttpResource(resourceOwnerName, MIN_SUPPORTED_CLUSTER_VERSION));
         // load all templates (template bodies are lazily loaded on demand)
         configureTemplateResources(config, resourceOwnerName, resources);
-        // load the pipeline (this will get added to as the monitoring API version increases)
-        configurePipelineResources(config, resourceOwnerName, resources);
 
         // load the watches for cluster alerts if Watcher is available
         final HttpResource alertingResource = configureClusterAlertsResources(config, resourceOwnerName);
@@ -817,11 +806,6 @@ public class HttpExporter extends Exporter {
             entries.add(entry("timeout", bulkTimeout.toString()));
         }
 
-        // allow the use of ingest pipelines to be completely optional
-        if (USE_INGEST_PIPELINE_SETTING.getConcreteSettingForNamespace(config.name()).get(config.settings())) {
-            entries.add(entry("pipeline", MonitoringTemplateUtils.pipelineName(MonitoringTemplateUtils.TEMPLATE_VERSION)));
-        }
-
         // widdle down the response to just what we care to check
         entries.add(entry("filter_path", "errors,items.*.error"));
 
@@ -863,33 +847,6 @@ public class HttpExporter extends Exporter {
         }
     }
 
-    /**
-     * Adds the {@code resources} necessary for checking and publishing monitoring pipelines.
-     *
-     * @param config The HTTP Exporter's configuration
-     * @param resourceOwnerName The resource owner name to display for any logging messages.
-     * @param resources The resources to add too.
-     */
-    private static void configurePipelineResources(final Config config, final String resourceOwnerName,
-                                                   final List<HttpResource> resources) {
-        // don't require pipelines if we're not using them
-        if (USE_INGEST_PIPELINE_SETTING.getConcreteSettingForNamespace(config.name()).get(config.settings())) {
-            final TimeValue pipelineTimeout =
-                    PIPELINE_CHECK_TIMEOUT_SETTING.getConcreteSettingForNamespace(config.name()).get(config.settings());
-
-            // add all pipelines
-            for (final String pipelineId : MonitoringTemplateUtils.PIPELINE_IDS) {
-                final String pipelineName = MonitoringTemplateUtils.pipelineName(pipelineId);
-                // lazily load the pipeline
-                final Supplier<byte[]> pipeline =
-                        () -> BytesReference.toBytes(BytesReference.bytes(MonitoringTemplateUtils.loadPipeline(pipelineId,
-                                                XContentType.JSON)));
-
-                resources.add(new PipelineHttpResource(resourceOwnerName, pipelineTimeout, pipelineName, pipeline));
-            }
-        }
-    }
-
     /**
      * Adds the {@code resources} necessary for checking and publishing cluster alerts.
      *
@@ -994,7 +951,7 @@ public class HttpExporter extends Exporter {
 
     public static List<Setting.AffixSetting<?>> getDynamicSettings() {
         return Arrays.asList(HOST_SETTING, TEMPLATE_CREATE_LEGACY_VERSIONS_SETTING, AUTH_USERNAME_SETTING, BULK_TIMEOUT_SETTING,
-                CONNECTION_READ_TIMEOUT_SETTING, CONNECTION_TIMEOUT_SETTING, PIPELINE_CHECK_TIMEOUT_SETTING, PROXY_BASE_PATH_SETTING,
+                CONNECTION_READ_TIMEOUT_SETTING, CONNECTION_TIMEOUT_SETTING, PROXY_BASE_PATH_SETTING,
                 SNIFF_ENABLED_SETTING, TEMPLATE_CHECK_TIMEOUT_SETTING, SSL_SETTING, HEADERS_SETTING);
     }
 

+ 0 - 90
x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/PipelineHttpResource.java

@@ -1,90 +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
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-package org.elasticsearch.xpack.monitoring.exporter.http;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.entity.ByteArrayEntity;
-import org.apache.http.entity.ContentType;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.elasticsearch.action.ActionListener;
-import org.elasticsearch.client.RestClient;
-import org.elasticsearch.core.Nullable;
-import org.elasticsearch.core.TimeValue;
-import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils;
-
-import java.util.Collections;
-import java.util.Objects;
-import java.util.function.Supplier;
-
-/**
- * {@code PipelineHttpResource}s allow the checking and uploading of ingest pipelines to a remote cluster.
- * <p>
- * In the future, we will need to also support the transformation or replacement of pipelines based on their version, but we do not need
- * that functionality until some breaking change in the Monitoring API requires it.
- */
-public class PipelineHttpResource extends PublishableHttpResource {
-
-    private static final Logger logger = LogManager.getLogger(PipelineHttpResource.class);
-
-    /**
-     * The name of the pipeline that is sent to the remote cluster.
-     */
-    private final String pipelineName;
-    /**
-     * Provides a fully formed template (e.g., no variables that need replaced).
-     */
-    private final Supplier<byte[]> pipeline;
-
-    /**
-     * Create a new {@link PipelineHttpResource}.
-     *
-     * @param resourceOwnerName The user-recognizable name
-     * @param masterTimeout Master timeout to use with any request.
-     * @param pipelineName The name of the template (e.g., ".pipeline123").
-     * @param pipeline The pipeline provider.
-     */
-    public PipelineHttpResource(final String resourceOwnerName, @Nullable final TimeValue masterTimeout,
-                                final String pipelineName, final Supplier<byte[]> pipeline) {
-        super(resourceOwnerName, masterTimeout, PublishableHttpResource.RESOURCE_VERSION_PARAMETERS);
-
-        this.pipelineName = Objects.requireNonNull(pipelineName);
-        this.pipeline = Objects.requireNonNull(pipeline);
-    }
-
-    /**
-     * Determine if the current {@linkplain #pipelineName pipeline} exists.
-     */
-    @Override
-    protected void doCheck(final RestClient client, final ActionListener<Boolean> listener) {
-        versionCheckForResource(client, listener, logger,
-                                "/_ingest/pipeline", pipelineName, "monitoring pipeline",
-                                resourceOwnerName, "monitoring cluster",
-                                XContentType.JSON.xContent(), MonitoringTemplateUtils.LAST_UPDATED_VERSION);
-    }
-
-    /**
-     * Publish the current {@linkplain #pipelineName pipeline}.
-     */
-    @Override
-    protected void doPublish(final RestClient client, final ActionListener<ResourcePublishResult> listener) {
-        putResource(client, listener, logger,
-                    "/_ingest/pipeline", pipelineName, Collections.emptyMap(), this::pipelineToHttpEntity, "monitoring pipeline",
-                    resourceOwnerName, "monitoring cluster");
-    }
-
-    /**
-     * Create a {@link HttpEntity} for the {@link #pipeline}.
-     *
-     * @return Never {@code null}.
-     */
-    HttpEntity pipelineToHttpEntity() {
-        return new ByteArrayEntity(pipeline.get(), ContentType.APPLICATION_JSON);
-    }
-
-}

+ 1 - 8
x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalBulk.java

@@ -39,17 +39,15 @@ public class LocalBulk extends ExportBulk {
     private final Logger logger;
     private final Client client;
     private final DateFormatter formatter;
-    private final boolean usePipeline;
 
     private BulkRequestBuilder requestBuilder;
 
 
-    LocalBulk(String name, Logger logger, Client client, DateFormatter dateTimeFormatter, boolean usePipeline) {
+    LocalBulk(String name, Logger logger, Client client, DateFormatter dateTimeFormatter) {
         super(name, client.threadPool().getThreadContext());
         this.logger = logger;
         this.client = client;
         this.formatter = dateTimeFormatter;
-        this.usePipeline = usePipeline;
     }
 
     @Override
@@ -72,11 +70,6 @@ public class LocalBulk extends ExportBulk {
                 final BytesReference source = XContentHelper.toXContent(doc, XContentType.SMILE, false);
                 request.source(source, XContentType.SMILE);
 
-                // allow the use of ingest pipelines to be completely optional
-                if (usePipeline) {
-                    request.setPipeline(MonitoringTemplateUtils.pipelineName(MonitoringTemplateUtils.TEMPLATE_VERSION));
-                }
-
                 requestBuilder.add(request);
 
                 if (logger.isTraceEnabled()) {

+ 6 - 92
x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporter.java

@@ -16,7 +16,6 @@ import org.elasticsearch.ElasticsearchException;
 import org.elasticsearch.action.ActionListener;
 import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
 import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest;
-import org.elasticsearch.action.ingest.PutPipelineRequest;
 import org.elasticsearch.action.support.master.AcknowledgedResponse;
 import org.elasticsearch.client.Client;
 import org.elasticsearch.cluster.ClusterChangedEvent;
@@ -29,7 +28,6 @@ import org.elasticsearch.cluster.routing.IndexRoutingTable;
 import org.elasticsearch.cluster.service.ClusterService;
 import org.elasticsearch.core.Nullable;
 import org.elasticsearch.common.bytes.BytesArray;
-import org.elasticsearch.common.bytes.BytesReference;
 import org.elasticsearch.common.regex.Regex;
 import org.elasticsearch.common.settings.Setting;
 import org.elasticsearch.common.settings.Setting.Property;
@@ -39,8 +37,6 @@ import org.elasticsearch.common.util.concurrent.ThreadContext;
 import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.gateway.GatewayService;
 import org.elasticsearch.index.IndexNotFoundException;
-import org.elasticsearch.ingest.IngestMetadata;
-import org.elasticsearch.ingest.PipelineConfiguration;
 import org.elasticsearch.license.LicenseStateListener;
 import org.elasticsearch.license.XPackLicenseState;
 import org.elasticsearch.protocol.xpack.watcher.DeleteWatchRequest;
@@ -82,10 +78,7 @@ import static org.elasticsearch.common.Strings.collectionToCommaDelimitedString;
 import static org.elasticsearch.xpack.core.ClientHelper.MONITORING_ORIGIN;
 import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin;
 import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.LAST_UPDATED_VERSION;
-import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.PIPELINE_IDS;
 import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.TEMPLATE_VERSION;
-import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.loadPipeline;
-import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.pipelineName;
 import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.templateName;
 
 public class LocalExporter extends Exporter implements ClusterStateListener, CleanerService.Listener, LicenseStateListener {
@@ -108,7 +101,6 @@ public class LocalExporter extends Exporter implements ClusterStateListener, Cle
     private final ClusterService clusterService;
     private final XPackLicenseState licenseState;
     private final CleanerService cleanerService;
-    private final boolean useIngest;
     private final DateFormatter dateTimeFormatter;
     private final List<String> clusterAlertBlacklist;
     private final boolean decommissionClusterAlerts;
@@ -127,7 +119,6 @@ public class LocalExporter extends Exporter implements ClusterStateListener, Cle
         this.client = client;
         this.clusterService = config.clusterService();
         this.licenseState = config.licenseState();
-        this.useIngest = USE_INGEST_PIPELINE_SETTING.getConcreteSettingForNamespace(config.name()).get(config.settings());
         this.clusterAlertBlacklist = ClusterAlertsUtil.getClusterAlertsBlacklist(config);
         this.decommissionClusterAlerts = Monitoring.MIGRATION_DECOMMISSION_ALERTS.get(config.settings());
         this.migrationCoordinator = migrationCoordinator;
@@ -277,7 +268,7 @@ public class LocalExporter extends Exporter implements ClusterStateListener, Cle
             clusterService.removeListener(this);
         }
 
-        return new LocalBulk(name(), logger, client, dateTimeFormatter, useIngest);
+        return new LocalBulk(name(), logger, client, dateTimeFormatter);
     }
 
     /**
@@ -298,7 +289,7 @@ public class LocalExporter extends Exporter implements ClusterStateListener, Cle
     }
 
     /**
-     * When not on the elected master, we require all resources (mapping types, templates, and pipelines) to be available before we
+     * When not on the elected master, we require all resources (mapping types, templates) to be available before we
      * attempt to run the exporter. If those resources do not exist, then it means the elected master's exporter has not yet run, so the
      * monitoring cluster (this one, as the local exporter) is not setup yet.
      *
@@ -315,25 +306,14 @@ public class LocalExporter extends Exporter implements ClusterStateListener, Cle
             }
         }
 
-        // if we don't have the ingest pipeline, then it's going to fail anyway
-        if (useIngest) {
-            for (final String pipelineId : PIPELINE_IDS) {
-                if (hasIngestPipeline(clusterState, pipelineId) == false) {
-                    logger.debug("monitoring ingest pipeline [{}] does not exist, so service cannot start (waiting on master)",
-                                 pipelineName(pipelineId));
-                    return false;
-                }
-            }
-        }
-
-        logger.trace("monitoring index templates and pipelines are installed, service can start");
+        logger.trace("monitoring index templates are installed, service can start");
 
         // everything is setup
         return true;
     }
 
     /**
-     * When on the elected master, we setup all resources (mapping types, templates, and pipelines) before we attempt to run the exporter.
+     * When on the elected master, we setup all resources (mapping types, templates) before we attempt to run the exporter.
      * If those resources do not exist, then we will create them.
      *
      * @param clusterState The current cluster state.
@@ -376,24 +356,6 @@ public class LocalExporter extends Exporter implements ClusterStateListener, Cle
             }
         }
 
-        if (useIngest) {
-            final List<String> missingPipelines = Arrays.stream(PIPELINE_IDS)
-                    .filter(id -> hasIngestPipeline(clusterState, id) == false)
-                    .collect(Collectors.toList());
-
-            // if we don't have the ingest pipeline, then install it
-            if (missingPipelines.isEmpty() == false) {
-                for (final String pipelineId : missingPipelines) {
-                    final String pipelineName = pipelineName(pipelineId);
-                    logger.debug("pipeline [{}] not found", pipelineName);
-                    asyncActions.add(() -> putIngestPipeline(pipelineId,
-                        new ResponseActionListener<>("pipeline", pipelineName, pendingResponses)));
-                }
-            } else {
-                logger.trace("all pipelines found");
-            }
-        }
-
         // avoid constantly trying to setup Watcher, which requires a lot of overhead and avoid attempting to setup during a cluster state
         // change. Provide a way to force it to initialize though.
         setupClusterAlertsTasks(clusterState, clusterStateChange, asyncActions, pendingResponses);
@@ -410,7 +372,7 @@ public class LocalExporter extends Exporter implements ClusterStateListener, Cle
                 return false;
             }
         } else {
-            logger.debug("monitoring index templates and pipelines are installed on master node, service can start");
+            logger.debug("monitoring index templates are installed on master node, service can start");
         }
 
         // everything is setup (or running)
@@ -483,54 +445,6 @@ public class LocalExporter extends Exporter implements ClusterStateListener, Cle
         }
     }
 
-    /**
-     * Determine if the ingest pipeline for {@code pipelineId} exists in the cluster or not with an appropriate minimum version.
-     *
-     * @param clusterState The current cluster state
-     * @param pipelineId The ID of the pipeline to check (e.g., "3")
-     * @return {@code true} if the {@code clusterState} contains the pipeline with an appropriate minimum version
-     */
-    private boolean hasIngestPipeline(final ClusterState clusterState, final String pipelineId) {
-        final String pipelineName = MonitoringTemplateUtils.pipelineName(pipelineId);
-        final IngestMetadata ingestMetadata = clusterState.getMetadata().custom(IngestMetadata.TYPE);
-
-        // we ensure that we both have the pipeline and its version represents the current (or later) version
-        if (ingestMetadata != null) {
-            final PipelineConfiguration pipeline = ingestMetadata.getPipelines().get(pipelineName);
-
-            return pipeline != null && hasValidVersion(pipeline.getConfigAsMap().get("version"), LAST_UPDATED_VERSION);
-        }
-
-        return false;
-    }
-
-    /**
-     * Create the pipeline required to handle past data as well as to future-proof ingestion for <em>current</em> documents (the pipeline
-     * is initially empty, but it can be replaced later with one that translates it as-needed).
-     * <p>
-     * This should only be invoked by the <em>elected</em> master node.
-     * <p>
-     * Whenever we eventually make a backwards incompatible change, then we need to override any pipeline that already exists that is
-     * older than this one. This uses the Elasticsearch version, down to the alpha portion, to determine the version of the last change.
-     * <pre><code>
-     * {
-     *   "description": "...",
-     *   "pipelines" : [ ... ],
-     *   "version": 6000001
-     * }
-     * </code></pre>
-     */
-    private void putIngestPipeline(final String pipelineId, final ActionListener<AcknowledgedResponse> listener) {
-        final String pipelineName = pipelineName(pipelineId);
-        final BytesReference pipeline = BytesReference.bytes(loadPipeline(pipelineId, XContentType.JSON));
-        final PutPipelineRequest request = new PutPipelineRequest(pipelineName, pipeline, XContentType.JSON);
-
-        logger.debug("installing ingest pipeline [{}]", pipelineName);
-
-        executeAsyncWithOrigin(client.threadPool().getThreadContext(), MONITORING_ORIGIN, request, listener,
-                client.admin().cluster()::putPipeline);
-    }
-
     private boolean hasTemplate(final ClusterState clusterState, final String templateName) {
         final IndexTemplateMetadata template = clusterState.getMetadata().getTemplates().get(templateName);
 
@@ -726,7 +640,7 @@ public class LocalExporter extends Exporter implements ClusterStateListener, Cle
     }
 
     /**
-     * Acknowledge success / failure for any given creation attempt (e.g., template or pipeline).
+     * Acknowledge success / failure for any given creation attempt (e.g., templates).
      */
     private class ResponseActionListener<Response> implements ActionListener<Response> {
 

+ 4 - 4
x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/ExportersTests.java

@@ -253,8 +253,8 @@ public class ExportersTests extends ESTestCase {
         assertEquals(settings.get("xpack.monitoring.exporters._name1.type"), "http");
 
         Settings update = Settings.builder()
-                .put("xpack.monitoring.exporters._name0.use_ingest", true)
-                .put("xpack.monitoring.exporters._name1.use_ingest", false)
+                .put("xpack.monitoring.exporters._name0.cluster_alerts.management.blacklist", true)
+                .put("xpack.monitoring.exporters._name1.cluster_alerts.management.blacklist", false)
                 .build();
         clusterSettings.applySettings(update);
         assertThat(settingsHolder.get(), notNullValue());
@@ -262,9 +262,9 @@ public class ExportersTests extends ESTestCase {
         logger.info(settings);
         assertThat(settings.size(), is(4));
         assertEquals(settings.get("xpack.monitoring.exporters._name0.type"), "local");
-        assertEquals(settings.get("xpack.monitoring.exporters._name0.use_ingest"), "true");
+        assertEquals(settings.get("xpack.monitoring.exporters._name0.cluster_alerts.management.blacklist"), "true");
         assertEquals(settings.get("xpack.monitoring.exporters._name1.type"), "http");
-        assertEquals(settings.get("xpack.monitoring.exporters._name1.use_ingest"), "false");
+        assertEquals(settings.get("xpack.monitoring.exporters._name1.cluster_alerts.management.blacklist"), "false");
     }
 
     public void testExporterBlocksOnClusterState() {

+ 0 - 18
x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/MonitoringTemplateUtilsTests.java

@@ -6,9 +6,7 @@
  */
 package org.elasticsearch.xpack.monitoring.exporter;
 
-import org.elasticsearch.common.Strings;
 import org.elasticsearch.common.time.DateFormatter;
-import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESTestCase;
 import org.elasticsearch.xpack.core.monitoring.MonitoredSystem;
 import org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils;
@@ -23,7 +21,6 @@ import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplat
 import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.TEMPLATE_VERSION;
 import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.indexName;
 import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.oldTemplateName;
-import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.pipelineName;
 import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.templateName;
 import static org.elasticsearch.xpack.core.template.TemplateUtilsTests.assertTemplate;
 import static org.hamcrest.Matchers.containsString;
@@ -77,21 +74,6 @@ public class MonitoringTemplateUtilsTests extends ESTestCase {
         assertThat(json, containsString("\"version\":" + LAST_UPDATED_VERSION));
     }
 
-    public void testPipelineName() {
-        assertThat(pipelineName("aBc123"), equalTo("xpack_monitoring_aBc123"));
-        assertThat(pipelineName(TEMPLATE_VERSION), equalTo("xpack_monitoring_" + TEMPLATE_VERSION));
-        assertThat(pipelineName(OLD_TEMPLATE_VERSION), equalTo("xpack_monitoring_" + OLD_TEMPLATE_VERSION));
-    }
-
-    public void testEmptyPipeline() throws IOException {
-        final String json = Strings.toString(MonitoringTemplateUtils.emptyPipeline(XContentType.JSON));
-
-        // ensure the description contains the API version
-        assertThat(json, containsString("Monitoring API version " + MonitoringTemplateUtils.TEMPLATE_VERSION));
-        assertThat(json, containsString("\"processors\":[]"));
-        assertThat(json, containsString("\"version\":" + LAST_UPDATED_VERSION));
-    }
-
     public void testIndexName() {
         final long timestamp = ZonedDateTime.of(2017, 8, 3, 13, 47, 58,
             0, ZoneOffset.UTC).toInstant().toEpochMilli();

+ 1 - 165
x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterResourceTests.java

@@ -39,7 +39,6 @@ import java.util.List;
 import java.util.stream.Collectors;
 
 import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.OLD_TEMPLATE_IDS;
-import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.PIPELINE_IDS;
 import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.TEMPLATE_IDS;
 import static org.elasticsearch.xpack.monitoring.exporter.http.AsyncHttpResourceHelper.whenPerformRequestAsyncWith;
 import static org.elasticsearch.xpack.monitoring.exporter.http.AsyncHttpResourceHelper.wrapMockListener;
@@ -70,13 +69,11 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
      * kibana, logstash, and beats
      */
     private final int EXPECTED_TEMPLATES = TEMPLATE_IDS.length + (createOldTemplates ? OLD_TEMPLATE_IDS.length : 0);
-    private final int EXPECTED_PIPELINES = PIPELINE_IDS.length;
     private final int EXPECTED_WATCHES = ClusterAlertsUtil.WATCH_IDS.length;
 
     private final RestClient client = mock(RestClient.class);
     private final Response versionResponse = mock(Response.class);
     private final List<String> templateNames = new ArrayList<>(EXPECTED_TEMPLATES);
-    private final List<String> pipelineNames = new ArrayList<>(EXPECTED_PIPELINES);
     private final List<String> watchNames = new ArrayList<>(EXPECTED_WATCHES);
 
     private final Settings exporterSettings = Settings.builder()
@@ -96,11 +93,9 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
                     Arrays.stream(OLD_TEMPLATE_IDS).map(MonitoringTemplateUtils::oldTemplateName).collect(Collectors.toList()));
         }
 
-        pipelineNames.addAll(Arrays.stream(PIPELINE_IDS).map(MonitoringTemplateUtils::pipelineName).collect(Collectors.toList()));
         watchNames.addAll(Arrays.stream(ClusterAlertsUtil.WATCH_IDS).map(id -> "my_cluster_uuid_" + id).collect(Collectors.toList()));
 
         assertThat("Not all templates are supplied", templateNames, hasSize(EXPECTED_TEMPLATES));
-        assertThat("Not all pipelines are supplied", pipelineNames, hasSize(EXPECTED_PIPELINES));
         assertThat("Not all watches are supplied", watchNames, hasSize(EXPECTED_WATCHES));
     }
 
@@ -229,114 +224,14 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
         verifyNoMoreInteractions(client);
     }
 
-    public void testPipelineCheckBlocksAfterSuccessfulTemplates() {
+    public void testWatcherCheckBlocksAfterSuccessfulTemplatePublish() {
         final int successfulGetTemplates = randomIntBetween(0, EXPECTED_TEMPLATES);
         final int unsuccessfulGetTemplates = EXPECTED_TEMPLATES - successfulGetTemplates;
         final Exception exception = failureGetException();
-        final boolean firstSucceeds = randomBoolean();
-        int expectedGets = 1;
-        int expectedPuts = 0;
-
-        whenValidVersionResponse();
-        whenGetTemplates(successfulGetTemplates, unsuccessfulGetTemplates);
-        whenSuccessfulPutTemplates(EXPECTED_TEMPLATES);
-
-        // failure in the middle of various templates being checked/published; suggests a node dropped
-        if (firstSucceeds) {
-            final boolean successfulFirst = randomBoolean();
-            final String pipelineName = pipelineNames.get(0);
-
-            final Response first;
-
-            if (successfulFirst) {
-                first = successfulGetResourceResponse("/_ingest/pipeline/", pipelineName);
-            } else {
-                first = unsuccessfulGetResourceResponse("/_ingest/pipeline/", pipelineName);
-            }
-
-            // last check fails
-            whenPerformRequestAsyncWith(client, new RequestMatcher(is("GET"), startsWith("/_ingest/pipeline/")), first, exception);
-            if (successfulFirst == false) {
-                whenSuccessfulPutPipelines(1);
-            }
-
-            expectedGets = EXPECTED_PIPELINES;
-            expectedPuts = successfulFirst ? 0 : 1;
-        } else {
-            whenPerformRequestAsyncWith(client, new RequestMatcher(is("GET"), startsWith("/_ingest/pipeline/")), exception);
-        }
-
-        assertTrue(resources.isDirty());
-        awaitCheckAndPublish(null);
-        // ensure it didn't magically become not-dirty
-        assertTrue(resources.isDirty());
-
-        verifyVersionCheck();
-        verifyGetTemplates(EXPECTED_TEMPLATES);
-        verifyPutTemplates(unsuccessfulGetTemplates);
-        verifyGetPipelines(expectedGets);
-        verifyPutPipelines(expectedPuts);
-        verifyNoMoreInteractions(client);
-    }
-
-    public void testPipelinePublishBlocksAfterSuccessfulTemplates() {
-        final int successfulGetTemplates = randomIntBetween(0, EXPECTED_TEMPLATES);
-        final int unsuccessfulGetTemplates = EXPECTED_TEMPLATES - successfulGetTemplates;
-        final Exception exception = failurePutException();
-        final boolean firstSucceeds = randomBoolean();
-        int expectedGets = 1;
-        int expectedPuts = 1;
-
-        whenValidVersionResponse();
-        whenGetTemplates(successfulGetTemplates, unsuccessfulGetTemplates);
-        whenSuccessfulPutTemplates(EXPECTED_TEMPLATES);
-
-        // failure in the middle of various templates being checked/published; suggests a node dropped
-        if (firstSucceeds) {
-            final Response firstSuccess = successfulPutResponse();
-
-            // We only have two pipelines for now, so the both GETs need to be "unsuccessful" for until we have a third
-            whenGetPipelines(0, 2);
-
-            // previous publishes must have succeeded
-            whenPerformRequestAsyncWith(client, new RequestMatcher(is("PUT"), startsWith("/_ingest/pipeline/")), firstSuccess, exception);
-
-            // GETs required for each PUT attempt (first is guaranteed "unsuccessful")
-            expectedGets += 1;
-            // unsuccessful are PUT attempts
-            expectedPuts += 1;
-        } else {
-            // fail the check so that it has to attempt the PUT
-            whenGetPipelines(0, 1);
-
-            whenPerformRequestAsyncWith(client, new RequestMatcher(is("PUT"), startsWith("/_ingest/pipeline/")), exception);
-        }
-
-        assertTrue(resources.isDirty());
-        awaitCheckAndPublish(null);
-        // ensure it didn't magically become not-dirty
-        assertTrue(resources.isDirty());
-
-        verifyVersionCheck();
-        verifyGetTemplates(EXPECTED_TEMPLATES);
-        verifyPutTemplates(unsuccessfulGetTemplates);
-        verifyGetPipelines(expectedGets);
-        verifyPutPipelines(expectedPuts);
-        verifyNoMoreInteractions(client);
-    }
-
-    public void testWatcherCheckBlocksAfterSuccessfulPipelines() {
-        final int successfulGetTemplates = randomIntBetween(0, EXPECTED_TEMPLATES);
-        final int unsuccessfulGetTemplates = EXPECTED_TEMPLATES - successfulGetTemplates;
-        final int successfulGetPipelines = randomIntBetween(0, EXPECTED_PIPELINES);
-        final int unsuccessfulGetPipelines = EXPECTED_PIPELINES - successfulGetPipelines;
-        final Exception exception = failureGetException();
 
         whenValidVersionResponse();
         whenGetTemplates(successfulGetTemplates, unsuccessfulGetTemplates);
         whenSuccessfulPutTemplates(unsuccessfulGetTemplates);
-        whenGetPipelines(successfulGetPipelines, unsuccessfulGetPipelines);
-        whenSuccessfulPutPipelines(unsuccessfulGetPipelines);
 
         // there's only one check
         whenPerformRequestAsyncWith(client, new RequestMatcher(is("GET"), is("/_xpack")), exception);
@@ -349,8 +244,6 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
         verifyVersionCheck();
         verifyGetTemplates(EXPECTED_TEMPLATES);
         verifyPutTemplates(unsuccessfulGetTemplates);
-        verifyGetPipelines(EXPECTED_PIPELINES);
-        verifyPutPipelines(unsuccessfulGetPipelines);
         verifyWatcherCheck();
         verifyNoMoreInteractions(client);
     }
@@ -358,8 +251,6 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
     public void testWatchCheckBlocksAfterSuccessfulWatcherCheck() {
         final int successfulGetTemplates = randomIntBetween(0, EXPECTED_TEMPLATES);
         final int unsuccessfulGetTemplates = EXPECTED_TEMPLATES - successfulGetTemplates;
-        final int successfulGetPipelines = randomIntBetween(0, EXPECTED_PIPELINES);
-        final int unsuccessfulGetPipelines = EXPECTED_PIPELINES - successfulGetPipelines;
         final Exception exception = validLicense ? failureGetException() : failureDeleteException();
         final boolean firstSucceeds = randomBoolean();
         int expectedGets = 1;
@@ -368,8 +259,6 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
         whenValidVersionResponse();
         whenGetTemplates(successfulGetTemplates, unsuccessfulGetTemplates);
         whenSuccessfulPutTemplates(unsuccessfulGetTemplates);
-        whenGetPipelines(successfulGetPipelines, unsuccessfulGetPipelines);
-        whenSuccessfulPutPipelines(unsuccessfulGetPipelines);
         whenWatcherCanBeUsed(validLicense);
 
         // failure in the middle of various watches being checked/published; suggests a node dropped
@@ -421,8 +310,6 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
         verifyVersionCheck();
         verifyGetTemplates(EXPECTED_TEMPLATES);
         verifyPutTemplates(unsuccessfulGetTemplates);
-        verifyGetPipelines(EXPECTED_PIPELINES);
-        verifyPutPipelines(unsuccessfulGetPipelines);
         verifyWatcherCheck();
         if (validLicense) {
             verifyGetWatches(expectedGets);
@@ -436,8 +323,6 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
     public void testWatchPublishBlocksAfterSuccessfulWatcherCheck() {
         final int successfulGetTemplates = randomIntBetween(0, EXPECTED_TEMPLATES);
         final int unsuccessfulGetTemplates = EXPECTED_TEMPLATES - successfulGetTemplates;
-        final int successfulGetPipelines = randomIntBetween(0, EXPECTED_PIPELINES);
-        final int unsuccessfulGetPipelines = EXPECTED_PIPELINES - successfulGetPipelines;
         final Exception exception = failurePutException();
         final boolean firstSucceeds = randomBoolean();
         int expectedGets = 1;
@@ -446,8 +331,6 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
         whenValidVersionResponse();
         whenGetTemplates(successfulGetTemplates, unsuccessfulGetTemplates);
         whenSuccessfulPutTemplates(unsuccessfulGetTemplates);
-        whenGetPipelines(successfulGetPipelines, unsuccessfulGetPipelines);
-        whenSuccessfulPutPipelines(unsuccessfulGetPipelines);
         // license needs to be valid, otherwise we'll do DELETEs, which are tested earlier
         whenWatcherCanBeUsed(true);
 
@@ -487,8 +370,6 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
         verifyVersionCheck();
         verifyGetTemplates(EXPECTED_TEMPLATES);
         verifyPutTemplates(unsuccessfulGetTemplates);
-        verifyGetPipelines(EXPECTED_PIPELINES);
-        verifyPutPipelines(unsuccessfulGetPipelines);
         verifyWatcherCheck();
         verifyGetWatches(expectedGets);
         verifyPutWatches(expectedPuts);
@@ -498,15 +379,11 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
     public void testDeployClusterAlerts() {
         final int successfulGetTemplates = randomIntBetween(0, EXPECTED_TEMPLATES);
         final int unsuccessfulGetTemplates = EXPECTED_TEMPLATES - successfulGetTemplates;
-        final int successfulGetPipelines = randomIntBetween(0, EXPECTED_PIPELINES);
-        final int unsuccessfulGetPipelines = EXPECTED_PIPELINES - successfulGetPipelines;
         final Exception exception = failurePutException();
 
         whenValidVersionResponse();
         whenGetTemplates(successfulGetTemplates, unsuccessfulGetTemplates);
         whenSuccessfulPutTemplates(unsuccessfulGetTemplates);
-        whenGetPipelines(successfulGetPipelines, unsuccessfulGetPipelines);
-        whenSuccessfulPutPipelines(unsuccessfulGetPipelines);
         // license needs to be valid, otherwise we'll do DELETEs, which are tested earlier
         whenWatcherCanBeUsed(true);
 
@@ -536,8 +413,6 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
         verifyVersionCheck();
         verifyGetTemplates(EXPECTED_TEMPLATES);
         verifyPutTemplates(unsuccessfulGetTemplates);
-        verifyGetPipelines(EXPECTED_PIPELINES);
-        verifyPutPipelines(unsuccessfulGetPipelines);
         verifyWatcherCheck();
         verifyGetWatches(0);
         verifyPutWatches(0);
@@ -548,16 +423,12 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
     public void testSuccessfulChecksOnElectedMasterNode() {
         final int successfulGetTemplates = randomIntBetween(0, EXPECTED_TEMPLATES);
         final int unsuccessfulGetTemplates = EXPECTED_TEMPLATES - successfulGetTemplates;
-        final int successfulGetPipelines = randomIntBetween(0, EXPECTED_PIPELINES);
-        final int unsuccessfulGetPipelines = EXPECTED_PIPELINES - successfulGetPipelines;
         final int successfulGetWatches = randomIntBetween(0, EXPECTED_WATCHES);
         final int unsuccessfulGetWatches = EXPECTED_WATCHES - successfulGetWatches;
 
         whenValidVersionResponse();
         whenGetTemplates(successfulGetTemplates, unsuccessfulGetTemplates);
         whenSuccessfulPutTemplates(unsuccessfulGetTemplates);
-        whenGetPipelines(successfulGetPipelines, unsuccessfulGetPipelines);
-        whenSuccessfulPutPipelines(unsuccessfulGetPipelines);
         if (remoteClusterHasWatcher) {
             whenWatcherCanBeUsed(validLicense);
             if (validLicense) {
@@ -579,8 +450,6 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
         verifyVersionCheck();
         verifyGetTemplates(EXPECTED_TEMPLATES);
         verifyPutTemplates(unsuccessfulGetTemplates);
-        verifyGetPipelines(EXPECTED_PIPELINES);
-        verifyPutPipelines(unsuccessfulGetPipelines);
         verifyWatcherCheck();
         if (remoteClusterHasWatcher) {
             if (validLicense) {
@@ -606,14 +475,10 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
 
         final int successfulGetTemplates = randomIntBetween(0, EXPECTED_TEMPLATES);
         final int unsuccessfulGetTemplates = EXPECTED_TEMPLATES - successfulGetTemplates;
-        final int successfulGetPipelines = randomIntBetween(0, 1);
-        final int unsuccessfulGetPipelines = EXPECTED_PIPELINES - successfulGetPipelines;
 
         whenValidVersionResponse();
         whenGetTemplates(successfulGetTemplates, unsuccessfulGetTemplates);
         whenSuccessfulPutTemplates(unsuccessfulGetTemplates);
-        whenGetPipelines(successfulGetPipelines, unsuccessfulGetPipelines);
-        whenSuccessfulPutPipelines(1);
 
         assertTrue(resources.isDirty());
 
@@ -626,8 +491,6 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
         verifyVersionCheck();
         verifyGetTemplates(EXPECTED_TEMPLATES);
         verifyPutTemplates(unsuccessfulGetTemplates);
-        verifyGetPipelines(EXPECTED_PIPELINES);
-        verifyPutPipelines(unsuccessfulGetPipelines);
         verifyNoMoreInteractions(client);
     }
 
@@ -703,10 +566,6 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
         return getResourceResponses("/_template/", templateNames, skip, successful, unsuccessful);
     }
 
-    private List<Response> getPipelineResponses(final int skip, final int successful, final int unsuccessful) {
-        return getResourceResponses("/_ingest/pipeline/", pipelineNames, skip, successful, unsuccessful);
-    }
-
     private List<Response> getWatcherResponses(final int skip, final int successful, final int unsuccessful) {
         final List<Response> responses = new ArrayList<>(successful + unsuccessful);
 
@@ -777,19 +636,6 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
         whenPerformRequestAsyncWith(client, new RequestMatcher(is("PUT"), startsWith("/_template/")), successfulPuts);
     }
 
-    private void whenGetPipelines(final int successful, final int unsuccessful) {
-        final List<Response> gets = getPipelineResponses(0, successful, unsuccessful);
-
-        whenPerformRequestAsyncWith(client, new RequestMatcher(is("GET"), startsWith("/_ingest/pipeline/")), gets);
-    }
-
-    private void whenSuccessfulPutPipelines(final int successful) {
-        final List<Response> successfulPuts = successfulPutResponses(successful);
-
-        // empty is possible if they all exist
-        whenPerformRequestAsyncWith(client, new RequestMatcher(is("PUT"), startsWith("/_ingest/pipeline/")), successfulPuts);
-    }
-
     private void whenWatcherCanBeUsed(final boolean validLicense) {
         final Metadata metadata = mock(Metadata.class);
 
@@ -856,16 +702,6 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
             .performRequestAsync(argThat(new RequestMatcher(is("PUT"), startsWith("/_template/"))), any(ResponseListener.class));
     }
 
-    private void verifyGetPipelines(final int called) {
-        verify(client, times(called))
-            .performRequestAsync(argThat(new RequestMatcher(is("GET"), startsWith("/_ingest/pipeline/"))), any(ResponseListener.class));
-    }
-
-    private void verifyPutPipelines(final int called) {
-        verify(client, times(called))
-            .performRequestAsync(argThat(new RequestMatcher(is("PUT"), startsWith("/_ingest/pipeline/"))), any(ResponseListener.class));
-    }
-
     private void verifyWatcherCheck() {
         verify(client).performRequestAsync(argThat(new RequestMatcher(is("GET"), is("/_xpack"))), any(ResponseListener.class));
     }

+ 1 - 30
x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterTests.java

@@ -27,7 +27,6 @@ import org.elasticsearch.core.TimeValue;
 import org.elasticsearch.common.util.concurrent.ThreadContext;
 import org.elasticsearch.license.XPackLicenseState;
 import org.elasticsearch.test.ESTestCase;
-import org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils;
 import org.elasticsearch.xpack.core.ssl.SSLService;
 import org.elasticsearch.xpack.monitoring.exporter.ClusterAlertsUtil;
 import org.elasticsearch.xpack.monitoring.exporter.ExportBulk;
@@ -49,7 +48,6 @@ import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.OLD_TEMPLATE_IDS;
-import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.PIPELINE_IDS;
 import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.TEMPLATE_IDS;
 import static org.hamcrest.Matchers.containsString;
 import static org.hamcrest.Matchers.equalTo;
@@ -389,19 +387,13 @@ public class HttpExporterTests extends ESTestCase {
     }
 
     public void testCreateResources() {
-        final boolean useIngest = randomBoolean();
         final boolean clusterAlertManagement = randomBoolean();
         final boolean createOldTemplates = randomBoolean();
         final TimeValue templateTimeout = randomFrom(TimeValue.timeValueSeconds(30), null);
-        final TimeValue pipelineTimeout = randomFrom(TimeValue.timeValueSeconds(30), null);
 
         final Settings.Builder builder = Settings.builder()
                 .put("xpack.monitoring.exporters._http.type", "http");
 
-        if (useIngest == false) {
-            builder.put("xpack.monitoring.exporters._http.use_ingest", false);
-        }
-
         if (clusterAlertManagement == false) {
             builder.put("xpack.monitoring.exporters._http.cluster_alerts.management.enabled", false);
         }
@@ -414,11 +406,6 @@ public class HttpExporterTests extends ESTestCase {
             builder.put("xpack.monitoring.exporters._http.index.template.master_timeout", templateTimeout.getStringRep());
         }
 
-        // note: this shouldn't get used with useIngest == false, but it doesn't hurt to try to cause issues
-        if (pipelineTimeout != null) {
-            builder.put("xpack.monitoring.exporters._http.index.pipeline.master_timeout", pipelineTimeout.getStringRep());
-        }
-
         final Config config = createConfig(builder.build());
 
         final MultiHttpResource multiResource = HttpExporter.createResources(config).allResources;
@@ -429,10 +416,6 @@ public class HttpExporterTests extends ESTestCase {
                 resources.stream().filter((resource) -> resource instanceof TemplateHttpResource)
                                   .map(TemplateHttpResource.class::cast)
                                   .collect(Collectors.toList());
-        final List<PipelineHttpResource> pipelines =
-                resources.stream().filter((resource) -> resource instanceof PipelineHttpResource)
-                                  .map(PipelineHttpResource.class::cast)
-                                  .collect(Collectors.toList());
         final List<WatcherExistsHttpResource> watcherCheck =
                 resources.stream().filter((resource) -> resource instanceof WatcherExistsHttpResource)
                                   .map(WatcherExistsHttpResource.class::cast)
@@ -449,16 +432,14 @@ public class HttpExporterTests extends ESTestCase {
 
         // expected number of resources
         assertThat(multiResource.getResources().size(),
-                   equalTo(version + templates.size() + pipelines.size() + watcherCheck.size()));
+                   equalTo(version + templates.size() + watcherCheck.size()));
         assertThat(version, equalTo(1));
         assertThat(templates, hasSize(createOldTemplates ? TEMPLATE_IDS.length + OLD_TEMPLATE_IDS.length : TEMPLATE_IDS.length));
-        assertThat(pipelines, hasSize(useIngest ? PIPELINE_IDS.length : 0));
         assertThat(watcherCheck, hasSize(clusterAlertManagement ? 1 : 0));
         assertThat(watches, hasSize(clusterAlertManagement ? ClusterAlertsUtil.WATCH_IDS.length : 0));
 
         // timeouts
         assertMasterTimeoutSet(templates, templateTimeout);
-        assertMasterTimeoutSet(pipelines, pipelineTimeout);
 
         // logging owner names
         final List<String> uniqueOwners =
@@ -470,7 +451,6 @@ public class HttpExporterTests extends ESTestCase {
 
     public void testCreateDefaultParams() {
         final TimeValue bulkTimeout = randomFrom(TimeValue.timeValueSeconds(30), null);
-        final boolean useIngest = randomBoolean();
 
         final Settings.Builder builder = Settings.builder()
                 .put("xpack.monitoring.exporters._http.type", "http");
@@ -479,10 +459,6 @@ public class HttpExporterTests extends ESTestCase {
             builder.put("xpack.monitoring.exporters._http.bulk.timeout", bulkTimeout.toString());
         }
 
-        if (useIngest == false) {
-            builder.put("xpack.monitoring.exporters._http.use_ingest", false);
-        }
-
         final Config config = createConfig(builder.build());
 
         final Map<String, String> parameters = new HashMap<>(HttpExporter.createDefaultParams(config));
@@ -495,11 +471,6 @@ public class HttpExporterTests extends ESTestCase {
             assertNull(parameters.remove("timeout"));
         }
 
-        if (useIngest) {
-            assertThat(parameters.remove("pipeline"),
-                       equalTo(MonitoringTemplateUtils.pipelineName(MonitoringTemplateUtils.TEMPLATE_VERSION)));
-        }
-
         // should have removed everything
         assertThat(parameters.size(), equalTo(0));
     }

+ 0 - 93
x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/PipelineHttpResourceTests.java

@@ -1,93 +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
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-package org.elasticsearch.xpack.monitoring.exporter.http;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.entity.ByteArrayEntity;
-import org.apache.http.entity.ContentType;
-import org.elasticsearch.Version;
-import org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.function.Supplier;
-
-import static org.hamcrest.Matchers.is;
-
-/**
- * Tests {@link PipelineHttpResource}.
- */
-public class PipelineHttpResourceTests extends AbstractPublishableHttpResourceTestCase {
-
-    private final String pipelineName = ".my_pipeline";
-    private final byte[] pipelineBytes = new byte[] { randomByte(), randomByte(), randomByte() };
-    private final Supplier<byte[]> pipeline = () -> pipelineBytes;
-    private final int minimumVersion = Math.min(MonitoringTemplateUtils.LAST_UPDATED_VERSION, Version.CURRENT.id);
-
-    private final PipelineHttpResource resource = new PipelineHttpResource(owner, masterTimeout, pipelineName, pipeline);
-
-    public void testPipelineToHttpEntity() throws IOException {
-        final HttpEntity entity = resource.pipelineToHttpEntity();
-
-        assertThat(entity.getContentType().getValue(), is(ContentType.APPLICATION_JSON.toString()));
-
-        final InputStream byteStream = entity.getContent();
-
-        assertThat(byteStream.available(), is(pipelineBytes.length));
-
-        for (final byte pipelineByte : pipelineBytes) {
-            assertThat(pipelineByte, is((byte)byteStream.read()));
-        }
-
-        assertThat(byteStream.available(), is(0));
-    }
-
-    public void testDoCheckExists() {
-        final HttpEntity entity = entityForResource(true, pipelineName, minimumVersion);
-
-        doCheckWithStatusCode(resource, "/_ingest/pipeline", pipelineName, successfulCheckStatus(), true, entity);
-    }
-
-    public void testDoCheckDoesNotExist() {
-        if (randomBoolean()) {
-            // it does not exist because it's literally not there
-            assertCheckDoesNotExist(resource, "/_ingest/pipeline", pipelineName);
-        } else {
-            // it does not exist because we need to replace it
-            final HttpEntity entity = entityForResource(false, pipelineName, minimumVersion);
-
-            doCheckWithStatusCode(resource, "/_ingest/pipeline", pipelineName,
-                                  successfulCheckStatus(), false, entity);
-        }
-    }
-
-    public void testDoCheckError() {
-        if (randomBoolean()) {
-            // error because of a server error
-            assertCheckWithException(resource, "/_ingest/pipeline", pipelineName);
-        } else {
-            // error because of a malformed response
-            final HttpEntity entity = entityForResource(null, pipelineName, minimumVersion);
-
-            doCheckWithStatusCode(resource, "/_ingest/pipeline", pipelineName, successfulCheckStatus(), null, entity);
-        }
-    }
-
-    public void testDoPublishTrue() {
-        assertPublishSucceeds(resource, "/_ingest/pipeline", pipelineName, Collections.emptyMap(), ByteArrayEntity.class);
-    }
-
-    public void testDoPublishFalseWithException() {
-        assertPublishWithException(resource, "/_ingest/pipeline", pipelineName, Collections.emptyMap(), ByteArrayEntity.class);
-    }
-
-    public void testParameters() {
-        assertVersionParameters(resource);
-    }
-
-}

+ 0 - 23
x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporterIntegTests.java

@@ -9,7 +9,6 @@ package org.elasticsearch.xpack.monitoring.exporter.local;
 import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
 import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
 import org.elasticsearch.action.index.IndexRequestBuilder;
-import org.elasticsearch.action.ingest.GetPipelineResponse;
 import org.elasticsearch.action.search.SearchResponse;
 import org.elasticsearch.cluster.metadata.IndexTemplateMetadata;
 import org.elasticsearch.common.Strings;
@@ -19,7 +18,6 @@ import org.elasticsearch.common.time.DateFormatter;
 import org.elasticsearch.common.xcontent.XContentBuilder;
 import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.index.query.QueryBuilders;
-import org.elasticsearch.ingest.PipelineConfiguration;
 import org.elasticsearch.rest.RestStatus;
 import org.elasticsearch.search.SearchHit;
 import org.elasticsearch.search.aggregations.bucket.terms.Terms;
@@ -28,7 +26,6 @@ import org.elasticsearch.test.ESIntegTestCase;
 import org.elasticsearch.xpack.core.monitoring.MonitoredSystem;
 import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkDoc;
 import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkRequestBuilder;
-import org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils;
 import org.elasticsearch.xpack.monitoring.MonitoringService;
 import org.elasticsearch.xpack.monitoring.MonitoringTestUtils;
 
@@ -37,7 +34,6 @@ import java.time.Instant;
 import java.time.ZoneOffset;
 import java.time.ZonedDateTime;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -51,7 +47,6 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcke
 import static org.elasticsearch.xpack.core.monitoring.MonitoredSystem.BEATS;
 import static org.elasticsearch.xpack.core.monitoring.MonitoredSystem.KIBANA;
 import static org.elasticsearch.xpack.core.monitoring.MonitoredSystem.LOGSTASH;
-import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.PIPELINE_IDS;
 import static org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils.TEMPLATE_VERSION;
 import static org.hamcrest.Matchers.greaterThan;
 import static org.hamcrest.Matchers.is;
@@ -120,7 +115,6 @@ public class LocalExporterIntegTests extends LocalExporterIntegTestCase {
                 });
 
                 checkMonitoringTemplates();
-                checkMonitoringPipelines();
                 checkMonitoringDocs();
             }
 
@@ -174,7 +168,6 @@ public class LocalExporterIntegTests extends LocalExporterIntegTestCase {
             }, 30L, TimeUnit.SECONDS);
 
             checkMonitoringTemplates();
-            checkMonitoringPipelines();
             checkMonitoringDocs();
         } finally {
             stopMonitoring();
@@ -230,22 +223,6 @@ public class LocalExporterIntegTests extends LocalExporterIntegTestCase {
         assertEquals(templates, actualTemplates);
     }
 
-    /**
-     * Checks that the monitoring ingest pipelines have been created by the local exporter
-     */
-    private void checkMonitoringPipelines() {
-        final Set<String> expectedPipelines =
-                Arrays.stream(PIPELINE_IDS).map(MonitoringTemplateUtils::pipelineName).collect(Collectors.toSet());
-
-        final GetPipelineResponse response = client().admin().cluster().prepareGetPipeline("xpack_monitoring_*").get();
-
-        // actual pipelines
-        final Set<String> pipelines = response.pipelines().stream().map(PipelineConfiguration::getId).collect(Collectors.toSet());
-
-        assertEquals("Missing expected pipelines", expectedPipelines, pipelines);
-        assertTrue("monitoring ingest pipeline not found", response.isFound());
-    }
-
     /**
      * Checks that the monitoring documents all have the cluster_uuid, timestamp and source_node
      * fields and belongs to the right data or timestamped index.

+ 0 - 62
x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporterResourceIntegTests.java

@@ -17,7 +17,6 @@ import org.elasticsearch.common.xcontent.ObjectPath;
 import org.elasticsearch.common.xcontent.XContentBuilder;
 import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.index.query.QueryBuilders;
-import org.elasticsearch.ingest.PipelineConfiguration;
 import org.elasticsearch.protocol.xpack.watcher.PutWatchRequest;
 import org.elasticsearch.search.SearchHit;
 import org.elasticsearch.search.builder.SearchSourceBuilder;
@@ -39,7 +38,6 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
 import static org.elasticsearch.test.ESIntegTestCase.Scope.TEST;
 import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
 import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.is;
 import static org.hamcrest.Matchers.not;
 import static org.hamcrest.Matchers.notNullValue;
@@ -79,7 +77,6 @@ public class LocalExporterResourceIntegTests extends LocalExporterIntegTestCase
 
         // these were "newer" or at least the same version, so they shouldn't be replaced
         assertTemplateNotUpdated();
-        assertPipelinesNotUpdated();
     }
 
     public void testRemoveWhenResourcesShouldBeRemoved() throws Exception {
@@ -95,7 +92,6 @@ public class LocalExporterResourceIntegTests extends LocalExporterIntegTestCase
         waitNoPendingTasksOnAll();
         assertBusy(() -> {
             assertTemplatesExist();
-            assertPipelinesExist();
             assertNoWatchesExist();
         });
     }
@@ -178,7 +174,6 @@ public class LocalExporterResourceIntegTests extends LocalExporterIntegTestCase
         waitNoPendingTasksOnAll();
 
         putTemplate(version);
-        putPipelines(version);
         putWatches(version);
     }
 
@@ -189,45 +184,6 @@ public class LocalExporterResourceIntegTests extends LocalExporterIntegTestCase
         assertAcked(client().admin().indices().preparePutTemplate(templateName).setSource(source, XContentType.JSON).get());
     }
 
-    private void putPipelines(final Integer version) {
-        for (final String pipelineId : MonitoringTemplateUtils.PIPELINE_IDS) {
-            putPipeline(MonitoringTemplateUtils.pipelineName(pipelineId), version);
-        }
-    }
-
-    private void putPipeline(final String pipelineName, final Integer version) {
-        assertAcked(client().admin().cluster().preparePutPipeline(pipelineName, replaceablePipeline(version), XContentType.JSON).get());
-    }
-
-    /**
-     * Create a pipeline with nothing in it whose description is literally "test".
-     *
-     * @param version Version to add to the pipeline, if any
-     * @return Never {@code null}.
-     */
-    private BytesReference replaceablePipeline(final Integer version) {
-        try {
-            final XContentBuilder builder = XContentBuilder.builder(XContentType.JSON.xContent());
-
-            builder.startObject();
-
-            {
-                builder.startArray("processors").endArray();
-                // something we can quickly check to ensure we have/have not replaced it
-                builder.field("description", getTestName());
-
-                // sometimes give it a version that should be overwritten (and sometimes don't give it a version at all)
-                if (version != null) {
-                    builder.field("version", version);
-                }
-            }
-
-            return BytesReference.bytes(builder.endObject());
-        } catch (final IOException e) {
-            throw new RuntimeException("Failed to create pipeline", e);
-        }
-    }
-
     /**
      * Create a cluster alert that does nothing.
      * @param version Version to add to the watch, if any
@@ -297,15 +253,6 @@ public class LocalExporterResourceIntegTests extends LocalExporterIntegTestCase
         }
     }
 
-    private void assertPipelinesExist() {
-        for (PipelineConfiguration pipeline : client().admin().cluster().prepareGetPipeline("xpack_monitoring_*").get().pipelines()) {
-            final Object description = pipeline.getConfigAsMap().get("description");
-
-            // this just ensures that it's set; not who set it
-            assertThat(description, notNullValue());
-        }
-    }
-
     private void assertWatchesExist() {
         // Check if watches index exists
         if (client().admin().indices().prepareGetIndex().addIndices(".watches").get().getIndices().length == 0) {
@@ -358,7 +305,6 @@ public class LocalExporterResourceIntegTests extends LocalExporterIntegTestCase
 
         assertBusy(() -> {
             assertTemplatesExist();
-            assertPipelinesExist();
             assertWatchesExist();
         });
     }
@@ -373,12 +319,4 @@ public class LocalExporterResourceIntegTests extends LocalExporterIntegTestCase
             assertThat(docMapping, containsString("test"));
         }
     }
-
-    private void assertPipelinesNotUpdated() {
-        for (PipelineConfiguration pipeline : client().admin().cluster().prepareGetPipeline("xpack_monitoring_*").get().pipelines()) {
-            final Object description = pipeline.getConfigAsMap().get("description");
-
-            assertThat(description, equalTo(getTestName()));
-        }
-    }
 }

+ 0 - 20
x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/test/MonitoringIntegTestCase.java

@@ -14,7 +14,6 @@ import org.elasticsearch.core.Tuple;
 import org.elasticsearch.common.regex.Regex;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.common.util.concurrent.CountDown;
-import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.index.IndexNotFoundException;
 import org.elasticsearch.plugins.Plugin;
 import org.elasticsearch.test.ESIntegTestCase;
@@ -135,25 +134,6 @@ public abstract class MonitoringIntegTestCase extends ESIntegTestCase {
                     .collect(Collectors.toList());
     }
 
-    private Tuple<String, String> monitoringPipeline(final String pipelineId) {
-        final XContentType json = XContentType.JSON;
-
-        return new Tuple<>(MonitoringTemplateUtils.pipelineName(pipelineId),
-                Strings.toString(MonitoringTemplateUtils.loadPipeline(pipelineId, json)));
-    }
-
-    protected List<Tuple<String, String>> monitoringPipelines() {
-        return Arrays.stream(MonitoringTemplateUtils.PIPELINE_IDS)
-                .map(this::monitoringPipeline)
-                .collect(Collectors.toList());
-    }
-
-    protected List<String> monitoringPipelineNames() {
-        return Arrays.stream(MonitoringTemplateUtils.PIPELINE_IDS)
-                .map(MonitoringTemplateUtils::pipelineName)
-                .collect(Collectors.toList());
-    }
-
     protected List<Tuple<String, String>> monitoringWatches() {
         final ClusterService clusterService = clusterService();