Skip to content

Commit f317ec8

Browse files
committed
docs: Add documentation for Monitor alert resources
Signed-off-by: Federico Barcelona <[email protected]>
1 parent f1e98dc commit f317ec8

6 files changed

+372
-0
lines changed

website/docs/index.html.markdown

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Use the navigation to the left to read about the available resources.
2020
```hcl
2121
// Configure the Sysdig provider
2222
provider "sysdig" {
23+
sysdig_monitor_api_token = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
2324
sysdig_secure_api_token = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
2425
}
2526
@@ -33,9 +34,18 @@ resource "sysdig_secure_policy" "unexpected_inbound_tcp_connection_traefik" {
3334

3435
The following keys can be used to configure the provider.
3536

37+
* `sysdig_monitor_api_token` - (Required) The Sysdig Secure API token, it must be
38+
present, but you can get it from the `SYSDIG_MONITOR_API_TOKEN` environment variable.
39+
3640
* `sysdig_secure_api_token` - (Required) The Sysdig Secure API token, it must be
3741
present, but you can get it from the `SYSDIG_SECURE_API_TOKEN` environment variable.
3842

43+
* `sysdig_monitor_url` - (Optional) This is the target Sysdig Secure base API
44+
endpoint. It's intended to be used with OnPrem installations. By defaults it
45+
points to `https://app.sysdigcloud.com`, and notice that should not be ended
46+
with an slash. It can also be sourced from the `SYSDIG_MONITOR_URL` environment
47+
variable.
48+
3949
* `sysdig_secure_url` - (Optional) This is the target Sysdig Secure base API
4050
endpoint. It's intended to be used with OnPrem installations. By defaults it
4151
points to `https://secure.sysdig.com`, and notice that should not be ended
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
layout: "sysdig"
3+
page_title: "Sysdig: sysdig_monitor_alert_anomaly"
4+
sidebar_current: "docs-sysdig-monitor-alert-anomaly"
5+
description: |-
6+
Creates a Sysdig Monitor Anomaly Alert.
7+
---
8+
9+
# sysdig\_monitor\_alert\_anomaly
10+
11+
Creates a Sysdig Monitor Anomaly Alert. Monitor hosts based on their historical behaviors and alert when they deviate.
12+
13+
~> **Note:** This resource is still experimental, and is subject of being changed.
14+
15+
## Example usage
16+
17+
```hcl
18+
resource "sysdig_monitor_alert_anomaly" "sample" {
19+
name = "[Kubernetes] Anomaly Detection Alert"
20+
description = "Detects an anomaly in the cluster"
21+
severity = 6
22+
23+
monitor = ["cpu.used.percent", "memory.bytes.used"]
24+
25+
multiple_alerts_by = ["kubernetes.cluster.name",
26+
"kubernetes.namespace.name",
27+
"kubernetes.deployment.name",
28+
"kubernetes.pod.name"]
29+
}
30+
```
31+
32+
## Argument Reference
33+
34+
### Common alert arguments
35+
36+
These arguments are common to all alerts in Sysdig Monitor.
37+
38+
* `name` - (Required) The name of the Monitor alert. It must be unique.
39+
* `description` - (Optional) The description of Monitor alert.
40+
* `severity` - (Optional) Severity of the Monitor alert. It must be a value between 0 and 7,
41+
with 0 being the most critical and 7 the less critical. Defaults to 4.
42+
* `trigger_after_minutes` - (Required) Threshold of time for the status to stabilize until the alert is fired.
43+
* `scope` - (Optional) Part of the infrastructure where the alert is valid. Defaults to the entire infrastructure.
44+
* `enabled` - (Optional) Boolean that defines if the alert is enabled or not. Defaults to true.
45+
* `notification_channels` - (Optional) List of notification channel IDs where an alert must be sent to once fired.
46+
* `renotification_minutes` - (Optional) Number of minutes for the alert to re-notify until the status is solved.
47+
48+
49+
#### Capture
50+
51+
Enables the creation of a capture file of the syscalls during the event.
52+
53+
* `filename` - (Required) Defines the name of the capture file.
54+
* `duration` - (Required) Time frame in seconds of the capture.
55+
* `filter` - (Optional) Additional filter to apply to the capture. For example: `proc.name contains nginx`.
56+
57+
### Metric alert arguments
58+
59+
* `monitor` - (Required) Array of metrics to monitor and alert on. Example: `["cpu.used.percent", "cpu.cores.used", "memory.bytes.used", "fs.used.percent", "thread.count", "net.request.count.in"]`.
60+
* `multiple_alerts_by` - (Optional) List of segments to trigger a separate alert on. Example: `["kubernetes.cluster.name", "kubernetes.namespace.name"]`.
61+
62+
## Attributes Reference
63+
64+
### Common alert attributes
65+
66+
In addition to all arguments above, the following attributes are exported, which are common to all the
67+
alerts in Sysdig Monitor:
68+
69+
* `version` - Current version of the resource in Sysdig Monitor.
70+
* `team` - Team ID that owns the alert.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
layout: "sysdig"
3+
page_title: "Sysdig: sysdig_monitor_alert_downtime"
4+
sidebar_current: "docs-sysdig-monitor-alert-downtime"
5+
description: |-
6+
Creates a Sysdig Monitor Downtime Alert.
7+
---
8+
9+
# sysdig\_monitor\_alert\_downtime
10+
11+
Creates a Sysdig Monitor Downtime Alert. Monitor any type of entity - host, container, process, service, etc - and alert when the entity goes down.
12+
13+
~> **Note:** This resource is still experimental, and is subject of being changed.
14+
15+
## Example usage
16+
17+
```hcl
18+
resource "sysdig_monitor_alert_downtime" "sample" {
19+
name = "[Kubernetes] Downtime Alert"
20+
description = "Detects a downtime in the Kubernetes cluster"
21+
severity = 2
22+
23+
entities_to_monitor = ["kubernetes.namespace.name"]
24+
25+
trigger_after_minutes = 10
26+
trigger_after_pct = 100
27+
}
28+
```
29+
30+
## Argument Reference
31+
32+
### Common alert arguments
33+
34+
These arguments are common to all alerts in Sysdig Monitor.
35+
36+
* `name` - (Required) The name of the Monitor alert. It must be unique.
37+
* `description` - (Optional) The description of Monitor alert.
38+
* `severity` - (Optional) Severity of the Monitor alert. It must be a value between 0 and 7,
39+
with 0 being the most critical and 7 the less critical. Defaults to 4.
40+
* `trigger_after_minutes` - (Required) Threshold of time for the status to stabilize until the alert is fired.
41+
* `scope` - (Optional) Part of the infrastructure where the alert is valid. Defaults to the entire infrastructure.
42+
* `enabled` - (Optional) Boolean that defines if the alert is enabled or not. Defaults to true.
43+
* `notification_channels` - (Optional) List of notification channel IDs where an alert must be sent to once fired.
44+
* `renotification_minutes` - (Optional) Number of minutes for the alert to re-notify until the status is solved.
45+
46+
47+
#### Capture
48+
49+
Enables the creation of a capture file of the syscalls during the event.
50+
51+
* `filename` - (Required) Defines the name of the capture file.
52+
* `duration` - (Required) Time frame in seconds of the capture.
53+
* `filter` - (Optional) Additional filter to apply to the capture. For example: `proc.name contains nginx`.
54+
55+
### Metric alert arguments
56+
57+
* `entities_to_monitor` - (Required) List of metrics to monitor downtime and alert on. Example: `["kubernetes.namespace.name"]` to detect namespace removal or `["host.hostName"]` to detect host downtime.
58+
* `trigger_after_pct` - (Optional) Below of this percentage of downtime the alert will be triggered. Defaults to 100.
59+
60+
## Attributes Reference
61+
62+
### Common alert attributes
63+
64+
In addition to all arguments above, the following attributes are exported, which are common to all the
65+
alerts in Sysdig Monitor:
66+
67+
* `version` - Current version of the resource in Sysdig Monitor.
68+
* `team` - Team ID that owns the alert.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
layout: "sysdig"
3+
page_title: "Sysdig: sysdig_monitor_alert_event"
4+
sidebar_current: "docs-sysdig-monitor-alert-event"
5+
description: |-
6+
Creates a Sysdig Monitor Event Alert.
7+
---
8+
9+
# sysdig\_monitor\_alert\_event
10+
11+
Creates a Sysdig Monitor Event Alert. Monitor occurrences of specific events, and alert if the total
12+
number of occurrences violates a threshold. Useful for alerting on container, orchestration, and
13+
service events like restarts and deployments.
14+
15+
~> **Note:** This resource is still experimental, and is subject of being changed.
16+
17+
## Example usage
18+
19+
```hcl
20+
resource "sysdig_monitor_alert_event" "sample" {
21+
name = "[Kubernetes] Failed to pull image"
22+
description = "A Kubernetes pod failed to pull an image from the registry"
23+
severity = 4
24+
25+
event_name = "Failed to pull image"
26+
source = "kubernetes"
27+
event_rel = ">"
28+
event_count = 0
29+
30+
multiple_alerts_by = ["kubernetes.pod.name"]
31+
32+
trigger_after_minutes = 1
33+
}
34+
```
35+
36+
## Argument Reference
37+
38+
### Common alert arguments
39+
40+
These arguments are common to all alerts in Sysdig Monitor.
41+
42+
* `name` - (Required) The name of the Monitor alert. It must be unique.
43+
* `description` - (Optional) The description of Monitor alert.
44+
* `severity` - (Optional) Severity of the Monitor alert. It must be a value between 0 and 7,
45+
with 0 being the most critical and 7 the less critical. Defaults to 4.
46+
* `trigger_after_minutes` - (Required) Threshold of time for the status to stabilize until the alert is fired.
47+
* `scope` - (Optional) Part of the infrastructure where the alert is valid. Defaults to the entire infrastructure.
48+
* `enabled` - (Optional) Boolean that defines if the alert is enabled or not. Defaults to true.
49+
* `notification_channels` - (Optional) List of notification channel IDs where an alert must be sent to once fired.
50+
* `renotification_minutes` - (Optional) Number of minutes for the alert to re-notify until the status is solved.
51+
52+
53+
#### Capture
54+
55+
Enables the creation of a capture file of the syscalls during the event.
56+
57+
* `filename` - (Required) Defines the name of the capture file.
58+
* `duration` - (Required) Time frame in seconds of the capture.
59+
* `filter` - (Optional) Additional filter to apply to the capture. For example: `proc.name contains nginx`.
60+
61+
### Metric alert arguments
62+
63+
* `event_name` - (Required) String that matches part of name, tag or the description of Sysdig Events.
64+
* `source` - (Required) Source of the event. It can be `docker` or `kubernetes`.
65+
* `event_rel` - (Required) Relationship of the event count. It can be `>`, `>=`, `<`, `<=`, `=` or `!=`.
66+
* `event_count` - (Required) Number of events to match with event_rel.
67+
* `multiple_alerts_by` - (Optional) List of segments to trigger a separate alert on. Example: `["kubernetes.cluster.name", "kubernetes.namespace.name"]`.
68+
69+
## Attributes Reference
70+
71+
### Common alert attributes
72+
73+
In addition to all arguments above, the following attributes are exported, which are common to all the
74+
alerts in Sysdig Monitor:
75+
76+
* `version` - Current version of the resource in Sysdig Monitor.
77+
* `team` - Team ID that owns the alert.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
layout: "sysdig"
3+
page_title: "Sysdig: sysdig_monitor_alert_group_outlier"
4+
sidebar_current: "docs-sysdig-monitor-alert-group-outlier"
5+
description: |-
6+
Creates a Sysdig Monitor Group Outlier Alert.
7+
---
8+
9+
# sysdig\_monitor\_alert\_group\_outlier
10+
11+
Creates a Sysdig Monitor Group Outlier Alert. Monitor a group of hosts and be notified when one acts differently from the rest.
12+
13+
~> **Note:** This resource is still experimental, and is subject of being changed.
14+
15+
## Example usage
16+
17+
```hcl
18+
resource "sysdig_monitor_alert_group_outlier" "sample" {
19+
name = "[Kubernetes] A node is using more CPU than the rest"
20+
description = "Monitors the cluster and checks when a node has more CPU usage than the others"
21+
severity = 6
22+
23+
monitor = ["cpu.used.percent"]
24+
25+
trigger_after_minutes = 10
26+
27+
capture {
28+
filename = "TERRAFORM_TEST"
29+
duration = 15
30+
}
31+
}
32+
```
33+
34+
## Argument Reference
35+
36+
### Common alert arguments
37+
38+
These arguments are common to all alerts in Sysdig Monitor.
39+
40+
* `name` - (Required) The name of the Monitor alert. It must be unique.
41+
* `description` - (Optional) The description of Monitor alert.
42+
* `severity` - (Optional) Severity of the Monitor alert. It must be a value between 0 and 7,
43+
with 0 being the most critical and 7 the less critical. Defaults to 4.
44+
* `trigger_after_minutes` - (Required) Threshold of time for the status to stabilize until the alert is fired.
45+
* `scope` - (Optional) Part of the infrastructure where the alert is valid. Defaults to the entire infrastructure.
46+
* `enabled` - (Optional) Boolean that defines if the alert is enabled or not. Defaults to true.
47+
* `notification_channels` - (Optional) List of notification channel IDs where an alert must be sent to once fired.
48+
* `renotification_minutes` - (Optional) Number of minutes for the alert to re-notify until the status is solved.
49+
50+
51+
#### Capture
52+
53+
Enables the creation of a capture file of the syscalls during the event.
54+
55+
* `filename` - (Required) Defines the name of the capture file.
56+
* `duration` - (Required) Time frame in seconds of the capture.
57+
* `filter` - (Optional) Additional filter to apply to the capture. For example: `proc.name contains nginx`.
58+
59+
### Metric alert arguments
60+
61+
* `monitor` - (Required) Array of metrics to monitor and alert on. Example: `["cpu.used.percent", "cpu.cores.used", "memory.bytes.used", "fs.used.percent", "thread.count", "net.request.count.in"]`.
62+
63+
## Attributes Reference
64+
65+
### Common alert attributes
66+
67+
In addition to all arguments above, the following attributes are exported, which are common to all the
68+
alerts in Sysdig Monitor:
69+
70+
* `version` - Current version of the resource in Sysdig Monitor.
71+
* `team` - Team ID that owns the alert.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
layout: "sysdig"
3+
page_title: "Sysdig: sysdig_monitor_alert_metric"
4+
sidebar_current: "docs-sysdig-monitor-alert-metric"
5+
description: |-
6+
Creates a Sysdig Monitor Metric Alert.
7+
---
8+
9+
# sysdig\_monitor\_alert\_metric
10+
11+
Creates a Sysdig Monitor Metric Alert. Monitor time-series metrics and alert if they violate user-defined thresholds.
12+
13+
~> **Note:** This resource is still experimental, and is subject of being changed.
14+
15+
## Example usage
16+
17+
```hcl
18+
resource "sysdig_monitor_alert_metric" "sample" {
19+
name = "[Kubernetes] CrashLoopBackOff"
20+
description = "A Kubernetes pod failed to restart"
21+
severity = 6
22+
23+
metric = "sum(timeAvg(kubernetes.pod.restart.count)) > 2"
24+
trigger_after_minutes = 1
25+
26+
multiple_alerts_by = ["kubernetes.cluster.name",
27+
"kubernetes.namespace.name",
28+
"kubernetes.deployment.name",
29+
"kubernetes.pod.name"]
30+
31+
capture {
32+
filename = "CrashLoopBackOff"
33+
duration = 15
34+
}
35+
}
36+
```
37+
38+
## Argument Reference
39+
40+
### Common alert arguments
41+
42+
These arguments are common to all alerts in Sysdig Monitor.
43+
44+
* `name` - (Required) The name of the Monitor alert. It must be unique.
45+
* `description` - (Optional) The description of Monitor alert.
46+
* `severity` - (Optional) Severity of the Monitor alert. It must be a value between 0 and 7,
47+
with 0 being the most critical and 7 the less critical. Defaults to 4.
48+
* `trigger_after_minutes` - (Required) Threshold of time for the status to stabilize until the alert is fired.
49+
* `scope` - (Optional) Part of the infrastructure where the alert is valid. Defaults to the entire infrastructure.
50+
* `enabled` - (Optional) Boolean that defines if the alert is enabled or not. Defaults to true.
51+
* `notification_channels` - (Optional) List of notification channel IDs where an alert must be sent to once fired.
52+
* `renotification_minutes` - (Optional) Number of minutes for the alert to re-notify until the status is solved.
53+
54+
55+
#### Capture
56+
57+
Enables the creation of a capture file of the syscalls during the event.
58+
59+
* `filename` - (Required) Defines the name of the capture file.
60+
* `duration` - (Required) Time frame in seconds of the capture.
61+
* `filter` - (Optional) Additional filter to apply to the capture. For example: `proc.name contains nginx`.
62+
63+
### Metric alert arguments
64+
65+
* `metric` - (Required) Metric to monitor and alert on. Example: `sum(timeAvg(kubernetes.pod.restart.count)) > 2` or `avg(avg(cpu.used.percent)) > 50`.
66+
* `multiple_alerts_by` - (Optional) List of segments to trigger a separate alert on. Example: `["kubernetes.cluster.name", "kubernetes.namespace.name"]`.
67+
68+
## Attributes Reference
69+
70+
### Common alert attributes
71+
72+
In addition to all arguments above, the following attributes are exported, which are common to all the
73+
alerts in Sysdig Monitor:
74+
75+
* `version` - Current version of the resource in Sysdig Monitor.
76+
* `team` - Team ID that owns the alert.

0 commit comments

Comments
 (0)