Skip to content

Commit f062232

Browse files
authored
Implemented support for configuring a cluster metrics monitor to call cat/indices, and cat/shards. (#479)
Signed-off-by: AWSHurneyt <[email protected]>
1 parent b2e9ddc commit f062232

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/main/kotlin/org/opensearch/commons/alerting/model/ClusterMetricsInput.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,13 @@ data class ClusterMetricsInput(
261261
val requiresPathParams: Boolean
262262
) {
263263
BLANK("", "", "", false, false),
264+
CAT_INDICES(
265+
"/_cat/indices",
266+
"/_cat/indices",
267+
"",
268+
true,
269+
false
270+
),
264271
CAT_PENDING_TASKS(
265272
"/_cat/pending_tasks",
266273
"/_cat/pending_tasks",
@@ -275,6 +282,13 @@ data class ClusterMetricsInput(
275282
true,
276283
false
277284
),
285+
CAT_SHARDS(
286+
"/_cat/shards",
287+
"/_cat/shards",
288+
"",
289+
true,
290+
false
291+
),
278292
CAT_SNAPSHOTS(
279293
"/_cat/snapshots",
280294
"/_cat/snapshots",

src/test/kotlin/org/opensearch/commons/alerting/TestHelpers.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,10 @@ fun randomDocLevelMonitorInput(
395395
}
396396

397397
fun randomClusterMetricsInput(
398-
path: String = ClusterMetricsInput.ClusterMetricType.CLUSTER_HEALTH.defaultPath,
398+
path: String = ClusterMetricsInput.ClusterMetricType.values()
399+
.filter { it.defaultPath.isNotBlank() && !it.requiresPathParams }
400+
.random()
401+
.defaultPath,
399402
pathParams: String = "",
400403
url: String = ""
401404
): ClusterMetricsInput {

0 commit comments

Comments
 (0)