Skip to content

Commit ff0d10d

Browse files
jbaieraAdam Locke
authored and
Adam Locke
committed
Change Monitoring plugin cluster alerts to not install by default (elastic#79657)
Changes the default monitoring watches to not be installed by default any more. Tests have been updated to continue installing watches to make sure the installation process continues to work.
1 parent 2b8863a commit ff0d10d

File tree

6 files changed

+27
-10
lines changed

6 files changed

+27
-10
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ private Settings.Builder baseSettings() {
143143
.put("xpack.monitoring.exporters._http.ssl.truststore.password", "foobar") // ensure that ssl can be used by settings
144144
.put("xpack.monitoring.exporters._http.headers.ignored", "value") // ensure that headers can be used by settings
145145
.put("xpack.monitoring.exporters._http.host", getFormattedAddress(webServer))
146+
.put("xpack.monitoring.exporters._http.cluster_alerts.management.enabled", true)
146147
.putList("xpack.monitoring.exporters._http.cluster_alerts.management.blacklist", clusterAlertBlacklist)
147148
.put("xpack.monitoring.exporters._http.auth.username", userName);
148149
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public Iterator<Setting<?>> settings() {
8787
*/
8888
public static final Setting.AffixSetting<Boolean> CLUSTER_ALERTS_MANAGEMENT_SETTING =
8989
Setting.affixKeySetting("xpack.monitoring.exporters.", "cluster_alerts.management.enabled",
90-
key -> Setting.boolSetting(key, true, Property.Dynamic, Property.NodeScope, Property.Deprecated), TYPE_DEPENDENCY);
90+
key -> Setting.boolSetting(key, false, Property.Dynamic, Property.NodeScope, Property.Deprecated), TYPE_DEPENDENCY);
9191
/**
9292
* Every {@code Exporter} allows users to explicitly disable specific cluster alerts.
9393
* <p>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ private void setupClusterAlertsTasks(ClusterState clusterState, boolean clusterS
400400
logger.trace("watches shouldn't be setup, because state=[{}] and clusterStateChange=[{}]", state.get(), clusterStateChange);
401401
}
402402
} else {
403-
logger.trace("watches can't be used, because xpack.watcher.enabled=[{}] and " +
403+
logger.trace("watches will not be installed because xpack.watcher.enabled=[{}] and " +
404404
"xpack.monitoring.exporters._local.cluster_alerts.management.enabled=[{}]",
405405
XPackSettings.WATCHER_ENABLED.get(config.settings()),
406406
CLUSTER_ALERTS_MANAGEMENT_SETTING.getConcreteSettingForNamespace(config.name()).get(config.settings()));

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
7676
private final List<String> templateNames = new ArrayList<>(EXPECTED_TEMPLATES);
7777
private final List<String> watchNames = new ArrayList<>(EXPECTED_WATCHES);
7878

79-
private final Settings exporterSettings = Settings.builder().build();
79+
private final Settings exporterSettings = Settings.builder()
80+
.put("xpack.monitoring.exporters._http.cluster_alerts.management.enabled", true)
81+
.build();
8082

8183
private final MultiHttpResource resources =
8284
HttpExporter.createResources(
@@ -363,8 +365,12 @@ public void testDeployClusterAlerts() {
363365
verifyDeleteWatches(EXPECTED_WATCHES);
364366
verifyNoMoreInteractions(client);
365367

366-
assertWarnings("[xpack.monitoring.migration.decommission_alerts] setting was deprecated in Elasticsearch and will be " +
367-
"removed in a future release! See the breaking changes documentation for the next major version.");
368+
assertWarnings(
369+
"[xpack.monitoring.migration.decommission_alerts] setting was deprecated in Elasticsearch and will be " +
370+
"removed in a future release! See the breaking changes documentation for the next major version.",
371+
"[xpack.monitoring.exporters._http.cluster_alerts.management.enabled] setting was deprecated in Elasticsearch and " +
372+
"will be removed in a future release! See the breaking changes documentation for the next major version."
373+
);
368374
}
369375

370376
public void testSuccessfulChecksOnElectedMasterNode() {
@@ -431,6 +437,9 @@ public void testSuccessfulChecksIfNotElectedMasterNode() {
431437
verifyVersionCheck();
432438
verifyGetTemplates(EXPECTED_TEMPLATES);
433439
verifyNoMoreInteractions(client);
440+
441+
assertWarnings("[xpack.monitoring.exporters._http.cluster_alerts.management.enabled] setting was deprecated in Elasticsearch " +
442+
"and will be removed in a future release! See the breaking changes documentation for the next major version.");
434443
}
435444

436445
private Exception failureGetException() {

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ public void testExporterWithUnknownBlacklistedClusterAlerts() {
301301
final Settings.Builder builder = Settings.builder()
302302
.put("xpack.monitoring.exporters._http.type", HttpExporter.TYPE)
303303
.put("xpack.monitoring.exporters._http.host", "http://localhost:9200")
304+
.put("xpack.monitoring.exporters._http.cluster_alerts.management.enabled", true)
304305
.putList("xpack.monitoring.exporters._http.cluster_alerts.management.blacklist", blacklist);
305306

306307
final Config config = createConfig(builder.build());
@@ -312,8 +313,12 @@ public void testExporterWithUnknownBlacklistedClusterAlerts() {
312313
assertThat(exception.getMessage(),
313314
equalTo("[xpack.monitoring.exporters._http.cluster_alerts.management.blacklist] contains unrecognized Cluster " +
314315
"Alert IDs [does_not_exist]"));
315-
assertWarnings("[xpack.monitoring.exporters._http.cluster_alerts.management.blacklist] setting was deprecated in Elasticsearch" +
316-
" and will be removed in a future release! See the breaking changes documentation for the next major version.");
316+
assertWarnings(
317+
"[xpack.monitoring.exporters._http.cluster_alerts.management.blacklist] setting was deprecated in Elasticsearch" +
318+
" and will be removed in a future release! See the breaking changes documentation for the next major version.",
319+
"[xpack.monitoring.exporters._http.cluster_alerts.management.enabled] setting was deprecated in Elasticsearch" +
320+
" and will be removed in a future release! See the breaking changes documentation for the next major version."
321+
);
317322
}
318323

319324
public void testExporterWithHostOnly() throws Exception {
@@ -471,8 +476,8 @@ public void testCreateResources() {
471476
.put("xpack.monitoring.exporters._http.type", "http");
472477
List<String> warningsExpected = new ArrayList<>();
473478

474-
if (clusterAlertManagement == false) {
475-
builder.put("xpack.monitoring.exporters._http.cluster_alerts.management.enabled", false);
479+
if (clusterAlertManagement) {
480+
builder.put("xpack.monitoring.exporters._http.cluster_alerts.management.enabled", true);
476481
warningsExpected.add("[xpack.monitoring.exporters._http.cluster_alerts.management.enabled] setting was deprecated in " +
477482
"Elasticsearch and will be removed in a future release! See the breaking changes documentation for the next major " +
478483
"version.");

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ public void testRemoveWhenResourcesShouldBeRemoved() throws Exception {
8888
waitNoPendingTasksOnAll();
8989

9090
Settings exporterSettings = Settings.builder().put(localExporterSettings())
91-
.put("xpack.monitoring.migration.decommission_alerts", true).build();
91+
.put("xpack.monitoring.migration.decommission_alerts", true)
92+
.put("xpack.monitoring.exporters.decommission_local.cluster_alerts.management.enabled", true)
93+
.build();
9294

9395
createResources("decommission_local", exporterSettings);
9496
waitNoPendingTasksOnAll();

0 commit comments

Comments
 (0)