Skip to content

Commit

Permalink
docs: complete all template vars for notification
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Aug 30, 2024
1 parent cef5f01 commit 8c979d5
Show file tree
Hide file tree
Showing 8 changed files with 554 additions and 409 deletions.
93 changes: 0 additions & 93 deletions mission-control/docs/notifications/events/components.md

This file was deleted.

60 changes: 60 additions & 0 deletions mission-control/docs/notifications/events/components.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: Components
description: Events that fire on topology/component changes
---

import { ComponentHealthEnv, AgentEnv, ComponentEnv } from "../../reference/notifications/_env_vars.mdx"

Components updates emit the following events when its health changes

- `component.healthy`
- `component.unhealthy`
- `component.warning`
- `component.unknown`

```yaml title="unhelthy-component-notification.yaml"
apiVersion: mission-control.flanksource.com/v1
kind: Notification
metadata:
name: web-api-component-alert
namespace: default
spec:
events:
- component.unhealthy
filter: component.type == 'WebAPI'
title: WebAPI {{.component.name}} failing
body: |
## Component Failed
Status: {{.component.status}} | {{.component.status_reason}}
Last updated: {{.component.updated_at}}
to:
email: [email protected]
```
## Default Templates
The default notification template used is:
### Title
```
{{ if ne channel "slack"}}Component {{.component.name}} is {{.component.health}}{{end}}
```

### Template

```txt file=../../../modules/mission-control/notification/templates/component.health
```

## Template Variables

The notification title and body can be changed using the variables below:
<ComponentHealthEnv />

### Component

<ComponentEnv />

### Agent
<AgentEnv />
123 changes: 0 additions & 123 deletions mission-control/docs/notifications/events/configs.md

This file was deleted.

102 changes: 102 additions & 0 deletions mission-control/docs/notifications/events/configs.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
title: Configs
description: Events that fire on config changes and health
---

import {
ConfigDBStateEnv, CheckHealthEnv, ConfigHealthEnv, ComponentHealthEnv,
AgentEnv, ConfigItemEnv, ComponentEnv, CanaryEnv, CheckEnv, CheckStatus,
Uptime, Latency
} from "../../reference/notifications/_env_vars.mdx"

Configs emit events when their health changes or when they are created, modified, or removed.

**Health events**

- `config.healthy`
- `config.unhealthy`
- `config.warning`
- `config.unknown`

**State events**

- `config.created`
- `config.updated`
- `config.deleted` _(Soft Delete)_

```yaml title="ec2-instance-updates.yaml"
apiVersion: mission-control.flanksource.com/v1
kind: Notification
metadata:
name: ec2-instance-changes
namespace: default
spec:
events:
- config.created
- config.updated
- config.deleted
filter: config.type == 'AWS::EC2::Instance'
to:
email: [email protected]
```
```yaml title="ec2-health-notification.yaml"
apiVersion: mission-control.flanksource.com/v1
kind: Notification
metadata:
name: ec2-instance-health-alerts
namespace: default
spec:
events:
- config.unhealthy
- config.warning
filter: config.type == 'AWS::EC2::Instance'
to:
email: [email protected]
```
## Default Templates
The default notification template for health events is:
### Health notifications
#### Title
```
{{ if ne channel "slack"}}{{.config.type}} {{.config.name}} is {{.config.health}}{{end}}
```

#### Template

```txt file=../../../modules/mission-control/notification/templates/config.health
```

### State change notifications

#### Title

```
{{ if ne channel "slack"}}{{.config.type}} {{.config.name}} was {{.new_state}}{{end}}
```

#### Template

```txt file=../../../modules/mission-control/notification/templates/config.db.update
```

## Template Variables

### Config State Env
<ConfigDBStateEnv />

### Config Health Env
<ConfigHealthEnv />

### Config Item
<ConfigItemEnv />

### Agent
<AgentEnv />
Loading

0 comments on commit 8c979d5

Please sign in to comment.