Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions monitor_alert_definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,13 @@ type AlertDefinition struct {
Type string `json:"type"`
ServiceType string `json:"service_type"`
Status AlertDefinitionStatus `json:"status"`
HasMoreResources bool `json:"has_more_resources"` // Deprecated: use Entities.HasMoreResources.
RuleCriteria RuleCriteria `json:"rule_criteria"`
Comment thread
shkaruna marked this conversation as resolved.
Comment thread
shkaruna marked this conversation as resolved.
TriggerConditions TriggerConditions `json:"trigger_conditions"`
AlertChannels []AlertChannelEnvelope `json:"alert_channels"`
Created *time.Time `json:"-"`
Updated *time.Time `json:"-"`
UpdatedBy string `json:"updated_by"`
CreatedBy string `json:"created_by"`
EntityIDs []string `json:"entity_ids"` // Deprecated: use Entities.url to list associated entities.
Description string `json:"description"`
Class string `json:"class"`
Scope AlertDefinitionScope `json:"scope"`
Expand Down
49 changes: 21 additions & 28 deletions test/integration/fixtures/TestMonitorAlertDefinition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ interactions:
"High Memory Usage Plan Dedicated", "description": "Alert triggers when dedicated
plan nodes consistently reach critical memory usage, risking application performance
degradation.", "service_type": "dbaas", "type": "system", "scope": "entity",
"class": "dedicated", "regions": [], "status": "enabled", "entity_ids": ["324478",
"324480", "324483", "324486", "394528"], "has_more_resources": false, "severity":
"class": "dedicated", "regions": [], "status": "enabled", "severity":
2, "rule_criteria": {"rules": [{"label": "Memory Usage", "metric": "memory_usage",
"unit": "percent", "aggregate_function": "avg", "operator": "gt", "threshold":
95, "dimension_filters": []}]}, "alert_channels": [{"id": 10000, "label": "Read-Write
Expand All @@ -32,8 +31,7 @@ interactions:
Usage Plan Shared", "description": "Alert triggers when shared plan nodes consistently
reach critical memory usage, risking application performance degradation.",
"service_type": "dbaas", "type": "system", "scope": "entity", "class": "shared",
"regions": [], "status": "enabled", "entity_ids": ["190003", "257626"], "has_more_resources":
false, "severity": 2, "rule_criteria": {"rules": [{"label": "Memory Usage",
"regions": [], "status": "enabled", "severity": 2, "rule_criteria": {"rules": [{"label": "Memory Usage",
"metric": "memory_usage", "unit": "percent", "aggregate_function": "avg", "operator":
"gt", "threshold": 90, "dimension_filters": []}]}, "alert_channels": [{"id":
10000, "label": "Read-Write Channel", "url": "/monitor/alert-channels/10000",
Expand All @@ -43,8 +41,7 @@ interactions:
"system", "updated_by": "system", "entities": {"url": "/monitor/services/dbaas/alert-definitions/10001/entities",
"has_more_resources": false, "count": 2}}, {"id": 11001, "label": "test_alert_logs_prod",
"description": "some desc1", "service_type": "logs", "type": "user", "scope":
"entity", "class": null, "regions": [], "status": "enabled", "entity_ids": ["100"],
"has_more_resources": false, "severity": 2, "rule_criteria": {"rules": [{"label":
"entity", "class": null, "regions": [], "status": "enabled", "severity": 2, "rule_criteria": {"rules": [{"label":
"Successful Upload Count", "metric": "success_upload_count", "unit": "count",
"aggregate_function": "sum", "operator": "lt", "threshold": 100000, "dimension_filters":
[]}]}, "alert_channels": [{"id": 10004, "label": "Alert Channel", "url":
Expand All @@ -55,8 +52,7 @@ interactions:
"tester", "entities": {"url": "/monitor/services/logs/alert-definitions/11001/entities",
"has_more_resources": false, "count": 1}}, {"id": 11021, "label": "Test Alert", "description": "Test Alert", "service_type":
"dbaas", "type": "user", "scope": "entity", "class": null, "regions": [], "status":
"enabled", "entity_ids": ["257626", "394528"], "has_more_resources": false,
"severity": 1, "rule_criteria": {"rules": [{"label": "Memory Usage", "metric":
"enabled", "severity": 1, "rule_criteria": {"rules": [{"label": "Memory Usage", "metric":
"memory_usage", "unit": "percent", "aggregate_function": "sum", "operator":
"gt", "threshold": 100, "dimension_filters": []}]}, "alert_channels": [{"id":
10004, "label": "Alert Channel", "url": "/monitor/alert-channels/10004",
Expand Down Expand Up @@ -88,7 +84,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Wed, 08 Apr 2026 06:05:05 GMT
- Mon, 27 Apr 2026 12:32:17 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -130,10 +126,9 @@ interactions:
url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions
method: POST
response:
body: '{"id": 11022, "label": "go-test-alert-definition-create", "description":
body: '{"id": 11072, "label": "go-test-alert-definition-create", "description":
"Test alert definition creation", "service_type": "dbaas", "type": "user", "scope":
"entity", "class": null, "regions": [], "status": "provisioning", "entity_ids":
[], "has_more_resources": false, "severity": 2, "rule_criteria": {"rules": [{"label":
"entity", "class": null, "regions": [], "status": "provisioning", "severity": 2, "rule_criteria": {"rules": [{"label":
"Memory Usage", "metric": "memory_usage", "unit": "percent", "aggregate_function":
"avg", "operator": "gt", "threshold": 90, "dimension_filters": [{"label": "Node
Type", "dimension_label": "node_type", "operator": "eq", "value": "primary"}]}]},
Expand All @@ -142,7 +137,7 @@ interactions:
"polling_interval_seconds": 300, "evaluation_period_seconds": 300, "trigger_occurrences":
1}, "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "created_by":
"tester", "updated_by": "tester", "entities":
{"url": "/monitor/services/dbaas/alert-definitions/11022/entities", "has_more_resources":
{"url": "/monitor/services/dbaas/alert-definitions/11072/entities", "has_more_resources":
false, "count": 0}}'
headers:
Access-Control-Allow-Credentials:
Expand All @@ -166,7 +161,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Wed, 08 Apr 2026 06:05:06 GMT
- Mon, 27 Apr 2026 12:32:18 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -203,13 +198,12 @@ interactions:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions/11022
url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions/11072
method: GET
response:
body: '{"id": 11022, "label": "go-test-alert-definition-create", "description":
body: '{"id": 11072, "label": "go-test-alert-definition-create", "description":
"Test alert definition creation", "service_type": "dbaas", "type": "user", "scope":
"entity", "class": null, "regions": [], "status": "enabled", "entity_ids": [],
"has_more_resources": false, "severity": 2, "rule_criteria": {"rules": [{"label":
"entity", "class": null, "regions": [], "status": "enabled", "severity": 2, "rule_criteria": {"rules": [{"label":
"Memory Usage", "metric": "memory_usage", "unit": "percent", "aggregate_function":
"avg", "operator": "gt", "threshold": 90, "dimension_filters": [{"label": "Node
Type", "dimension_label": "node_type", "operator": "eq", "value": "primary"}]}]},
Expand All @@ -218,7 +212,7 @@ interactions:
"polling_interval_seconds": 300, "evaluation_period_seconds": 300, "trigger_occurrences":
1}, "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "created_by":
"tester", "updated_by": "tester", "entities":
{"url": "/monitor/services/dbaas/alert-definitions/11022/entities", "has_more_resources":
{"url": "/monitor/services/dbaas/alert-definitions/11072/entities", "has_more_resources":
false, "count": 0}}'
headers:
Access-Control-Allow-Credentials:
Expand All @@ -242,7 +236,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Wed, 08 Apr 2026 06:05:22 GMT
- Mon, 27 Apr 2026 12:32:35 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -281,13 +275,12 @@ interactions:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions/11022
url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions/11072
method: PUT
response:
body: '{"id": 11022, "label": "go-test-alert-definition-create-updated", "description":
body: '{"id": 11072, "label": "go-test-alert-definition-create-updated", "description":
"Test alert definition creation", "service_type": "dbaas", "type": "user", "scope":
"entity", "class": null, "regions": [], "status": "enabled", "entity_ids": [],
"has_more_resources": false, "severity": 2, "rule_criteria": {"rules": [{"label":
"entity", "class": null, "regions": [], "status": "enabled", "severity": 2, "rule_criteria": {"rules": [{"label":
"Memory Usage", "metric": "memory_usage", "unit": "percent", "aggregate_function":
"avg", "operator": "gt", "threshold": 90, "dimension_filters": [{"label": "Node
Type", "dimension_label": "node_type", "operator": "eq", "value": "primary"}]}]},
Expand All @@ -296,7 +289,7 @@ interactions:
"polling_interval_seconds": 300, "evaluation_period_seconds": 300, "trigger_occurrences":
1}, "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "created_by":
"tester", "updated_by": "tester", "entities":
{"url": "/monitor/services/dbaas/alert-definitions/11022/entities", "has_more_resources":
{"url": "/monitor/services/dbaas/alert-definitions/11072/entities", "has_more_resources":
false, "count": 0}}'
headers:
Access-Control-Allow-Credentials:
Expand All @@ -320,7 +313,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Wed, 08 Apr 2026 06:05:24 GMT
- Mon, 27 Apr 2026 12:32:36 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -357,7 +350,7 @@ interactions:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions/11022
url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions/11072
method: DELETE
response:
body: '{}'
Expand Down Expand Up @@ -385,7 +378,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Wed, 08 Apr 2026 06:05:25 GMT
- Mon, 27 Apr 2026 12:32:37 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ interactions:
"High Memory Usage Plan Dedicated", "description": "Alert triggers when dedicated
plan nodes consistently reach critical memory usage, risking application performance
degradation.", "service_type": "dbaas", "type": "system", "scope": "entity",
"class": "dedicated", "regions": [], "status": "enabled", "entity_ids": ["324478",
"324480", "324483", "324486", "394528"], "has_more_resources": false, "severity":
"class": "dedicated", "regions": [], "status": "enabled", "severity":
2, "rule_criteria": {"rules": [{"label": "Memory Usage", "metric": "memory_usage",
"unit": "percent", "aggregate_function": "avg", "operator": "gt", "threshold":
95, "dimension_filters": []}]}, "alert_channels": [{"id": 10000, "label": "Read-Write
Expand Down Expand Up @@ -51,7 +50,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Wed, 08 Apr 2026 05:55:13 GMT
- Mon, 27 Apr 2026 12:32:51 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -123,7 +122,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Wed, 08 Apr 2026 05:55:14 GMT
- Mon, 27 Apr 2026 12:32:52 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Wed, 08 Apr 2026 06:27:41 GMT
- Mon, 27 Apr 2026 12:32:45 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -76,7 +76,7 @@ interactions:
code: 200
duration: ""
- request:
body: '{"label":"go-test-alert-definition-idempotency-1775629661986967956","severity":2,"channel_ids":[10000],"rule_criteria":{"rules":[{"aggregate_function":"avg","dimension_filters":[{"dimension_label":"node_type","operator":"eq","value":"primary"}],"metric":"memory_usage","operator":"gt","threshold":90}]},"trigger_conditions":{"criteria_condition":"ALL","evaluation_period_seconds":300,"polling_interval_seconds":300,"trigger_occurrences":1},"description":"Test
body: '{"label":"go-test-alert-definition-idempotency-1777293165535535919","severity":2,"channel_ids":[10000],"rule_criteria":{"rules":[{"aggregate_function":"avg","dimension_filters":[{"dimension_label":"node_type","operator":"eq","value":"primary"}],"metric":"memory_usage","operator":"gt","threshold":90}]},"trigger_conditions":{"criteria_condition":"ALL","evaluation_period_seconds":300,"polling_interval_seconds":300,"trigger_occurrences":1},"description":"Test
alert definition creation with idempotency"}'
form: {}
headers:
Expand All @@ -89,19 +89,18 @@ interactions:
url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions
method: POST
response:
body: '{"id": 11023, "label": "go-test-alert-definition-idempotency-1775629661986967956",
body: '{"id": 11073, "label": "go-test-alert-definition-idempotency-1777293165535535919",
"description": "Test alert definition creation with idempotency", "service_type":
"dbaas", "type": "user", "scope": "entity", "class": null, "regions": [], "status":
"provisioning", "entity_ids": [], "has_more_resources": false, "severity": 2,
"rule_criteria": {"rules": [{"label": "Memory Usage", "metric": "memory_usage",
"provisioning", "severity": 2, "rule_criteria": {"rules": [{"label": "Memory Usage", "metric": "memory_usage",
"unit": "percent", "aggregate_function": "avg", "operator": "gt", "threshold":
90, "dimension_filters": [{"label": "Node Type", "dimension_label": "node_type",
"operator": "eq", "value": "primary"}]}]}, "alert_channels": [{"id": 10000,
"label": "Read-Write Channel", "url": "/monitor/alert-channels/10000", "type":
"alert-channels"}], "trigger_conditions": {"criteria_condition": "ALL", "polling_interval_seconds":
300, "evaluation_period_seconds": 300, "trigger_occurrences": 1}, "created":
"2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "created_by": "tester",
"updated_by": "tester", "entities": {"url": "/monitor/services/dbaas/alert-definitions/11023/entities",
"updated_by": "tester", "entities": {"url": "/monitor/services/dbaas/alert-definitions/11073/entities",
"has_more_resources": false, "count": 0}}'
headers:
Access-Control-Allow-Credentials:
Expand All @@ -125,7 +124,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Wed, 08 Apr 2026 06:27:43 GMT
- Mon, 27 Apr 2026 12:32:46 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -153,7 +152,7 @@ interactions:
code: 200
duration: ""
- request:
body: '{"label":"go-test-alert-definition-idempotency-1775629661986967956","severity":2,"channel_ids":[10000],"rule_criteria":{"rules":[{"aggregate_function":"avg","dimension_filters":[{"dimension_label":"node_type","operator":"eq","value":"primary"}],"metric":"memory_usage","operator":"gt","threshold":90}]},"trigger_conditions":{"criteria_condition":"ALL","evaluation_period_seconds":300,"polling_interval_seconds":300,"trigger_occurrences":1},"description":"Test
body: '{"label":"go-test-alert-definition-idempotency-1777293165535535919","severity":2,"channel_ids":[10000],"rule_criteria":{"rules":[{"aggregate_function":"avg","dimension_filters":[{"dimension_label":"node_type","operator":"eq","value":"primary"}],"metric":"memory_usage","operator":"gt","threshold":90}]},"trigger_conditions":{"criteria_condition":"ALL","evaluation_period_seconds":300,"polling_interval_seconds":300,"trigger_occurrences":1},"description":"Test
alert definition creation with idempotency"}'
form: {}
headers:
Expand Down Expand Up @@ -184,7 +183,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Wed, 08 Apr 2026 06:27:43 GMT
- Mon, 27 Apr 2026 12:32:47 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -213,7 +212,7 @@ interactions:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions/11023
url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions/11073
method: DELETE
response:
body: '{}'
Expand Down Expand Up @@ -241,7 +240,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Wed, 08 Apr 2026 06:27:44 GMT
- Mon, 27 Apr 2026 12:32:48 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down
Loading
Loading