-
Notifications
You must be signed in to change notification settings - Fork 516
[MongoDB]: Add alerting rule templates #15866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+197
−3
Merged
Changes from 13 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
e03d1e0
mongodb: Package alert rule template
shmsr 5a21368
Merge branch 'main' into mongodb-alert-pkg
shmsr 587cafe
Do cleanup
shmsr 7581797
Fix PR num
shmsr 30ca7d1
More changes
shmsr bfbd589
Apply suggestion from @shmsr
shmsr 499ef61
Address review comments
shmsr 5b443c4
Apply suggestion from @shmsr
shmsr 2e82aed
Apply suggestion from @shmsr
shmsr c458c2c
Merge branch 'main' into mongodb-alert-pkg
shmsr 3774784
Address review comments
shmsr e57411e
Fix query
shmsr 0b3e048
Merge branch 'main' into mongodb-alert-pkg
shmsr d992b31
Address review comments
shmsr 05adc01
Address review comments
shmsr 1fb382f
Merge branch 'main' into mongodb-alert-pkg
shmsr 6280b8a
Merge branch 'main' into mongodb-alert-pkg
muthu-mps 51f8c42
Merge branch 'main' into mongodb-alert-pkg
shmsr bb16f0c
elastic-package test pipeline -v -g
shmsr 3dd1b97
Revert "elastic-package test pipeline -v -g"
shmsr 5da2fab
Fix CI
shmsr b97c5ce
Update stack v
shmsr 192bcbd
Update template
shmsr 1c406f8
Merge branch 'main' into mongodb-alert-pkg
shmsr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
31 changes: 31 additions & 0 deletions
31
packages/mongodb/kibana/alerting_rule_template/mongodb-cache-usage-high.json
This file contains hidden or 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,31 @@ | ||
| { | ||
| "id": "mongodb-cache-usage-high", | ||
| "type": "alerting_rule_template", | ||
| "attributes": { | ||
| "name": "[MongoDB Resources] WiredTiger cache pressure", | ||
| "tags": [ | ||
| "MongoDB" | ||
| ], | ||
| "ruleTypeId": ".es-query", | ||
| "schedule": { | ||
| "interval": "1m" | ||
| }, | ||
| "params": { | ||
| "searchType": "esqlQuery", | ||
| "timeWindowSize": 5, | ||
| "timeWindowUnit": "m", | ||
| "esqlQuery": { | ||
| "esql": "// Alert when WiredTiger cache utilization exceeds 85% over the configured time window.\n// Aggregates per instance (service.address) using averaged cache stats.\nFROM metrics-mongodb.status-*\n| STATS cache_used=AVG(mongodb.status.wired_tiger.cache.used.bytes),\n cache_max=AVG(mongodb.status.wired_tiger.cache.maximum.bytes) BY service.address\n| WHERE cache_max > 0\n| EVAL cache_usage_pct = (cache_used / cache_max) * 100\n| WHERE cache_usage_pct > 85" | ||
| }, | ||
| "groupBy": "row", | ||
| "termSize": 5, | ||
| "timeField": "@timestamp" | ||
| }, | ||
| "alertDelay": { | ||
| "active": 1 | ||
| } | ||
| }, | ||
| "managed": true, | ||
| "coreMigrationVersion": "8.8.0", | ||
| "typeMigrationVersion": "10.1.0" | ||
| } | ||
31 changes: 31 additions & 0 deletions
31
packages/mongodb/kibana/alerting_rule_template/mongodb-connection-usage-high.json
This file contains hidden or 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,31 @@ | ||
| { | ||
| "id": "mongodb-connection-usage-high", | ||
| "type": "alerting_rule_template", | ||
| "attributes": { | ||
| "name": "[MongoDB Availability] High connection usage", | ||
| "tags": [ | ||
| "MongoDB" | ||
| ], | ||
| "ruleTypeId": ".es-query", | ||
| "schedule": { | ||
| "interval": "1m" | ||
| }, | ||
| "params": { | ||
| "searchType": "esqlQuery", | ||
| "timeWindowSize": 5, | ||
| "timeWindowUnit": "m", | ||
| "esqlQuery": { | ||
| "esql": "// Alert when current connections exceed 80% of total available capacity.\n// Aggregates average current/available connections per service.address.\nFROM metrics-mongodb.status-*\n| STATS current_conn=AVG(mongodb.status.connections.current),\n available_conn=AVG(mongodb.status.connections.available) BY service.address\n| EVAL total_conn = current_conn + available_conn\n| WHERE total_conn > 0\n| EVAL connection_usage_pct = (current_conn / total_conn) * 100\n| WHERE connection_usage_pct > 80" | ||
| }, | ||
| "groupBy": "row", | ||
| "termSize": 5, | ||
| "timeField": "@timestamp" | ||
| }, | ||
| "alertDelay": { | ||
| "active": 1 | ||
| } | ||
| }, | ||
| "managed": true, | ||
| "coreMigrationVersion": "8.8.0", | ||
| "typeMigrationVersion": "10.1.0" | ||
| } |
31 changes: 31 additions & 0 deletions
31
packages/mongodb/kibana/alerting_rule_template/mongodb-oplog-headroom-critical.json
This file contains hidden or 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,31 @@ | ||
| { | ||
| "id": "mongodb-oplog-headroom-critical", | ||
| "type": "alerting_rule_template", | ||
| "attributes": { | ||
| "name": "[MongoDB Replication] Oplog headroom critically low", | ||
| "tags": [ | ||
| "MongoDB" | ||
| ], | ||
| "ruleTypeId": ".es-query", | ||
| "schedule": { | ||
| "interval": "1m" | ||
| }, | ||
| "params": { | ||
| "searchType": "esqlQuery", | ||
| "timeWindowSize": 5, | ||
| "timeWindowUnit": "m", | ||
| "esqlQuery": { | ||
| "esql": "// Alert when oplog headroom drops below 15 minutes, risking replication stalls.\n// Guards against negative values and groups by namespace + set name.\nFROM metrics-mongodb.replstatus-*\n| STATS oplog_headroom_min=MIN(mongodb.replstatus.headroom.min) BY data_stream.namespace, mongodb.replstatus.set_name\n| WHERE oplog_headroom_min IS NOT NULL\n| EVAL oplog_headroom_min = CASE(oplog_headroom_min >= 0, oplog_headroom_min, 0)\n| EVAL oplog_headroom_minutes = TO_DOUBLE(oplog_headroom_min) / 60.0\n| WHERE oplog_headroom_minutes < 15" | ||
| }, | ||
| "groupBy": "row", | ||
| "termSize": 5, | ||
| "timeField": "@timestamp" | ||
| }, | ||
| "alertDelay": { | ||
| "active": 1 | ||
| } | ||
| }, | ||
| "managed": true, | ||
| "coreMigrationVersion": "8.8.0", | ||
| "typeMigrationVersion": "10.1.0" | ||
| } |
31 changes: 31 additions & 0 deletions
31
packages/mongodb/kibana/alerting_rule_template/mongodb-replica-member-down.json
This file contains hidden or 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,31 @@ | ||
| { | ||
| "id": "mongodb-replica-member-down", | ||
| "type": "alerting_rule_template", | ||
| "attributes": { | ||
| "name": "[MongoDB Replication] Replica member down", | ||
| "tags": [ | ||
| "MongoDB" | ||
| ], | ||
| "ruleTypeId": ".es-query", | ||
| "schedule": { | ||
| "interval": "1m" | ||
| }, | ||
| "params": { | ||
| "searchType": "esqlQuery", | ||
| "timeWindowSize": 5, | ||
| "timeWindowUnit": "m", | ||
| "esqlQuery": { | ||
| "esql": "// Alert when replica sets report members in the down state within the configured time window.\n// Groups by data_stream.namespace and set name to isolate environments.\nFROM metrics-mongodb.replstatus-*\n| STATS members_down=MAX(mongodb.replstatus.members.down.count) BY data_stream.namespace, mongodb.replstatus.set_name\n| WHERE members_down > 0" | ||
shmsr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| "groupBy": "row", | ||
| "termSize": 5, | ||
| "timeField": "@timestamp" | ||
| }, | ||
| "alertDelay": { | ||
| "active": 1 | ||
| } | ||
| }, | ||
| "managed": true, | ||
| "coreMigrationVersion": "8.8.0", | ||
| "typeMigrationVersion": "10.1.0" | ||
| } | ||
31 changes: 31 additions & 0 deletions
31
packages/mongodb/kibana/alerting_rule_template/mongodb-replication-lag-high.json
This file contains hidden or 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,31 @@ | ||
| { | ||
| "id": "mongodb-replication-lag-high", | ||
| "type": "alerting_rule_template", | ||
| "attributes": { | ||
| "name": "[MongoDB Replication] High replication lag", | ||
| "tags": [ | ||
| "MongoDB" | ||
| ], | ||
| "ruleTypeId": ".es-query", | ||
| "schedule": { | ||
| "interval": "1m" | ||
| }, | ||
| "params": { | ||
| "searchType": "esqlQuery", | ||
| "timeWindowSize": 5, | ||
| "timeWindowUnit": "m", | ||
| "esqlQuery": { | ||
| "esql": "// Alert when maximum replication lag exceeds 10 seconds for any replica set.\n// Aggregates per data_stream.namespace and replica set name.\nFROM metrics-mongodb.replstatus-*\n| STATS replication_lag=MAX(mongodb.replstatus.lag.max) BY data_stream.namespace, mongodb.replstatus.set_name\n| WHERE replication_lag > 10000" | ||
| }, | ||
| "groupBy": "row", | ||
| "termSize": 5, | ||
| "timeField": "@timestamp" | ||
| }, | ||
| "alertDelay": { | ||
| "active": 1 | ||
| } | ||
| }, | ||
| "managed": true, | ||
| "coreMigrationVersion": "8.8.0", | ||
| "typeMigrationVersion": "10.1.0" | ||
| } |
31 changes: 31 additions & 0 deletions
31
packages/mongodb/kibana/alerting_rule_template/mongodb-unhealthy-replica-members.json
This file contains hidden or 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,31 @@ | ||
| { | ||
| "id": "mongodb-unhealthy-replica-members", | ||
| "type": "alerting_rule_template", | ||
| "attributes": { | ||
| "name": "[MongoDB Replication] Unhealthy replica members", | ||
| "tags": [ | ||
| "MongoDB" | ||
| ], | ||
| "ruleTypeId": ".es-query", | ||
| "schedule": { | ||
| "interval": "1m" | ||
| }, | ||
| "params": { | ||
| "searchType": "esqlQuery", | ||
| "timeWindowSize": 5, | ||
| "timeWindowUnit": "m", | ||
| "esqlQuery": { | ||
| "esql": "// Alert when replica sets report unhealthy members during the window.\n// Groups by data_stream.namespace and set name for clarity.\nFROM metrics-mongodb.replstatus-*\n| STATS unhealthy_members=MAX(mongodb.replstatus.members.unhealthy.count) BY data_stream.namespace, mongodb.replstatus.set_name\n| WHERE unhealthy_members > 0" | ||
| }, | ||
| "groupBy": "row", | ||
| "termSize": 5, | ||
| "timeField": "@timestamp" | ||
| }, | ||
| "alertDelay": { | ||
| "active": 1 | ||
| } | ||
| }, | ||
| "managed": true, | ||
| "coreMigrationVersion": "8.8.0", | ||
| "typeMigrationVersion": "10.1.0" | ||
| } |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.