-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ff2bb3
commit 28e096c
Showing
6 changed files
with
101 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
x-pack/plugins/monitoring/server/lib/alerts/disable_watcher_cluster_alerts.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { LegacyAPICaller } from 'src/core/server'; | ||
|
||
async function callMigrationApi(callCluster: LegacyAPICaller) { | ||
// return await callCluster('_monitoring/migrate/alerts'); | ||
return { | ||
exporters: [ | ||
{ | ||
name: 'thename', | ||
type: 'http', | ||
migration_complete: true, | ||
reason: 'optional - exception', | ||
}, | ||
{ | ||
name: 'thename2', | ||
type: 'local', | ||
migration_complete: false, | ||
reason: 'optional - exception', | ||
}, | ||
], | ||
}; | ||
} | ||
|
||
export async function disableWatcherClusterAlerts(callCluster: LegacyAPICaller) { | ||
const response = await callMigrationApi(callCluster); | ||
if (!response || response.exporters.length === 0) { | ||
return true; | ||
} | ||
if (response.exporters.every((exp) => exp.migration_complete)) { | ||
return true; | ||
} | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters