Skip to content

Commit

Permalink
docs: Enhance komodor_monitor documentation with valid configurations…
Browse files Browse the repository at this point in the history
… and examples (#17)
  • Loading branch information
galHalup authored Jan 12, 2025
2 parents 8bfe647 + b4aae8d commit 8f202eb
Showing 1 changed file with 134 additions and 50 deletions.
184 changes: 134 additions & 50 deletions docs/resources/monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,21 @@ description: |-

# komodor_monitor (Resource)

Creates a new Komodor monitor which allows Komodor
Creates a new **Komodor monitor** to observe, detect, and analyze failures across your infrastructure. This resource allows you to define the parameters for monitoring specific components in your Kubernetes clusters and other infrastructure.

to monitor, detect, and analyze failures around infrastructure.
---

## Example Usage

### Deployment Monitor

#### Valid Configurations:
- **Valid Sinks**: `slack`, `teams`, `webhook`
- **Valid notifyOn Options**:
- `"Failure"`
- `"Successful"`
- `"All"`

```terraform
resource "komodor_monitor" "example-deploy-monitor" {
name = "example-deploy-monitor"
Expand All @@ -27,36 +34,61 @@ resource "komodor_monitor" "example-deploy-monitor" {
"exclude": {
"namespaces": ["komodor"]
},
"namespaces": [
"default"
]
"namespaces": ["default"]
}]
EOF
sinks = <<EOF
{
"slack": [
"default"
],
"teams": [
"default"
],
"pagerduty": [{
"channel": "example-channel",
"integrationKey": "example-pagerduty-integration-key",
"pagerDutyAccountName": "example-pagerduty-account-name"
}]
"slack": ["deployment-alerts"],
"teams": ["Platform-Team"]
}
EOF
EOF
sinks_options = <<EOF
{
"notifyOn": ["Failure"]
"notifyOn": ["Failure", "Successful"]
}
EOF
EOF
}
```

---

### Availability Monitor

#### Valid Configurations:
- **Valid Sinks**: `slack`, `teams`, `opsgenie`, `pagerduty`, `webhook`
- **Valid Duration**: Must be an integer between **5** and **600** (inclusive).
- **Valid Categories for variables.categories**:
- `"Creating/Initializing"`
- `"Scheduling"`
- `"Container Creation"`
- `"NonZeroExitCode"`
- `"Unhealthy - failed probes"`
- `"OOMKilled"`
- `"BackOff"`
- `"Infrastructure"`
- `"Image"`
- `"Volume/Secret/ConfigMap"`
- `"Pod Termination"`
- `"Completed"`
- `"Other"`
- **Valid notifyOn Options**: `["*"]`
- `["*"]` (all categories)
- Or any one of the following:
- `"Creating/Initializing"`
- `"Scheduling"`
- `"Container Creation"`
- `"NonZeroExitCode"`
- `"Unhealthy - failed probes"`
- `"OOMKilled"`
- `"BackOff"`
- `"Infrastructure"`
- `"Image"`
- `"Volume/Secret/ConfigMap"`
- `"Pod Termination"`
- `"Completed"`
- `"Other"`

```terraform
resource "komodor_monitor" "example-availability-monitor" {
name = "example-availability-monitor"
Expand All @@ -66,64 +98,116 @@ resource "komodor_monitor" "example-availability-monitor" {
[{
"cluster": "kind-kind",
"exclude": {
"services": ["default/service-to-exclude"]
"services": ["default/excluded-service"]
},
"services": [
"default/service-to-include"
],
"services": ["default/important-service"],
"condition": "and",
"namespaces": ["default"]
}]
EOF
sinks = <<EOF
{
"slack": [
"default"
],
"teams": [
"default"
],
"pagerduty": [{
"channel": "example-channel",
"integrationKey": "example-pagerduty-integration-key",
"pagerDutyAccountName": "example-pagerduty-account-name"
}]
"slack": ["availability-alerts"],
"teams": ["SRE-Team"]
}
EOF
EOF
variables = <<EOF
{
"categories": [
"*"
],
"categories": ["Creating/Initializing", "Unhealthy - failed probes"],
"duration": 30,
"minAvailable": "100%"
}
EOF
EOF
sinks_options = <<EOF
{
"notifyOn": ["*"]
}
EOF
EOF
}
```

---

### Node Monitor

#### Valid Configurations:
- **Valid Sinks**: `slack`, `teams`, `opsgenie`, `pagerduty`, `webhook`
- **Valid Duration**: Must be an integer between **5** and **600** (inclusive).
- **Valid NodeCreationThreshold: Should be in the format of `"3m"` (3 minutes) or `"5s"` (5 seconds).
- **Valid Variables**:
- `duration`: Required
- `nodeCreationThreshold`: Required

```terraform
resource "komodor_monitor" "example-node-monitor" {
name = "example-node-monitor"
type = "node"
active = true
sensors = <<EOF
[{
"cluster": "kind-kind"
}]
EOF
sinks = <<EOF
{
"slack": ["node-alerts"]
}
EOF
variables = <<EOF
{
"duration": 60,
"nodeCreationThreshold": "10m"
}
EOF
}
```

---

### Workflow Monitor

#### Valid Configurations:
- **Valid Sinks**: `slack`, `teams`, `opsgenie`, `pagerduty`, `webhook`
- **Valid notifyOn Options**: None (not applicable for workflows)

```terraform
resource "komodor_monitor" "example-workflow-monitor" {
name = "example-workflow-monitor"
type = "workflow"
active = true
sensors = <<EOF
[{
"cluster": "kind-kind",
"namespaces": ["workflow-namespace"]
}]
EOF
sinks = <<EOF
{
"slack": ["workflow-alerts"],
"webhook": ["webhook-url"]
}
EOF
}
```

<!-- schema generated by tfplugindocs -->
---

## Schema

### Required

- `active` (Boolean)
- `name` (String)
- `sensors` (String)
- `type` (String)
- `active` (Boolean): Indicates whether the monitor is enabled.
- `name` (String): The name of the monitor. Defaults to an empty string if not provided.
- `sensors` (String): Defines the scope of monitoring (e.g., cluster, namespaces, services, etc.).
- `type` (String): The monitor type. Must be one of: `availability`, `node`, `PVC`, `job`, `cronJob`, `deploy`, or `workflow`.

### Optional

- `is_deleted` (Boolean)
- `sinks` (String)
- `sinks_options` (String)
- `variables` (String)
- `is_deleted` (Boolean): Default is `false`. Indicates whether the monitor has been marked for deletion.
- `sinks` (String): Defines notification channels for the monitor, such as Slack, Teams, PagerDuty, Opsgenie, or Webhook.
- `sinks_options` (String): Specifies additional notification settings like notifyOn. Valid values depend on the monitor type.
- `variables` (String): Additional settings required for specific monitor types.

### Read-Only

- `id` (String) The ID of this resource.
- `id` (String): The ID of this resource.

0 comments on commit 8f202eb

Please sign in to comment.