-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: slack template for components, config & check events
- Loading branch information
1 parent
02c8984
commit 0529fff
Showing
3 changed files
with
105 additions
and
82 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -10,20 +10,7 @@ Component status updates emit the following events | |
- `component.warning` | ||
- `component.unknown` | ||
|
||
The default notification template used is: | ||
_ **Title:** `Component {{.component.name}} is {{.component.health}}` | ||
_ **Body:** | ||
|
||
``` | ||
### Labels: | ||
{{range $k, $v := .component.labels}}**{{$k}}**: {{$v}} | ||
{{end}} | ||
[Reference]({{.permalink}}) | ||
``` | ||
|
||
Sample notification: | ||
|
||
```yaml title="notification.yaml" | ||
```yaml title="unhelthy-component-notification.yaml" | ||
apiVersion: mission-control.flanksource.com/v1 | ||
kind: Notification | ||
metadata: | ||
|
@@ -42,9 +29,25 @@ spec: | |
email: [email protected] | ||
``` | ||
The notification title and body can be changed using the variables below: | ||
## Default Templates | ||
The default notification template used is: | ||
### Title | ||
## Variables | ||
``` | ||
{{ 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: | ||
|
||
| Field | Description | Schema | Optional | | ||
| ----------- | ----------------------------- | ------------------------- | -------- | | ||
|
This file contains 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 |
---|---|---|
|
@@ -12,58 +12,76 @@ Configs emit events when their health changes or when they are created, modified | |
- `config.warning` | ||
- `config.unknown` | ||
|
||
The default notification template for health events is: | ||
|
||
- **Title:** `{{.config.type}} {{.config.name}} is {{.config.health}}` | ||
- **Body:** | ||
|
||
``` | ||
### Labels: | ||
{{range $k, $v := .config.labels}}**{{$k}}**: {{$v}} | ||
{{end}} | ||
[Reference]({{.permalink}}) | ||
``` | ||
|
||
**State events** | ||
|
||
- `config.created` | ||
- `config.updated` | ||
- `config.deleted` | ||
|
||
The default notification template for state events is: | ||
|
||
- **Title:** `{{.config.type}} {{.config.name}} was [created/updated/deleted]` | ||
- **Body:** | ||
- `config.deleted` _(Soft Delete)_ | ||
|
||
``` | ||
### Labels: | ||
{{range $k, $v := .config.labels}}**{{$k}}**: {{$v}} | ||
{{end}} | ||
[Reference]({{.permalink}}) | ||
``` | ||
|
||
Sample notification: | ||
|
||
```yaml title="notification.yaml" | ||
```yaml title="ec2-instance-updates.yaml" | ||
apiVersion: mission-control.flanksource.com/v1 | ||
kind: Notification | ||
metadata: | ||
name: ec2-instance-create-alert | ||
name: ec2-instance-changes | ||
namespace: default | ||
spec: | ||
events: | ||
- config.created | ||
- config.updated | ||
- config.deleted | ||
filter: config.type == 'AWS::EC2::Instance' | ||
title: New EC2 instance {{.config.name}} created | ||
body: | | ||
Region: {{.config.tags['region']}} | ||
Zone: {{.config.tags['zone']}} | ||
Account: {{.config.tags['account']}} | ||
to: | ||
email: [email protected] | ||
``` | ||
## Variables | ||
```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 | ||
|
||
| Field | Description | Schema | nullable | | ||
| ----------- | ----------------------------- | ------------------- | -------- | | ||
|
@@ -103,5 +121,3 @@ spec: | |
| `id` | The id of the agent | `uuid` | | | ||
| `name` | The name of the agent | `string` | | | ||
| `description` | Short description of the agent | `string` | | | ||
|
||
## Notification Defaults |
This file contains 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 |
---|---|---|
|
@@ -5,34 +5,8 @@ title: Health Checks | |
|
||
Health checks emit 2 events | ||
|
||
- **`check.passed`**: | ||
|
||
- **Title:** `Check {{.check.name}} has passed` | ||
- **Body:** | ||
``` | ||
Canary: {{.canary.name}} | ||
{{if .agent}}Agent: {{.agent.name}}{{end}} | ||
{{if .status.message}}Message: {{.status.message}} {{end}} | ||
### Labels: | ||
{{range $k, $v := .check.labels}}**{{$k}}**: {{$v}} | ||
{{end}} | ||
[Reference]({{.permalink}}) | ||
``` | ||
|
||
- **`check.failed`**: | ||
- **Title:** `Check {{.check.name}} has failed` | ||
- **Body:** | ||
``` | ||
Canary: {{.canary.name}} | ||
{{if .agent}}Agent: {{.agent.name}}{{end}} | ||
Error: {{.status.error}} | ||
### Labels: | ||
{{range $k, $v := .check.labels}}**{{$k}}**: {{$v}} | ||
{{end}} | ||
[Reference]({{.permalink}}) | ||
``` | ||
|
||
Sample notification: | ||
- `check.passed` | ||
- `check.failed` | ||
|
||
```yaml title="notification.yaml" | ||
apiVersion: mission-control.flanksource.com/v1 | ||
|
@@ -53,7 +27,37 @@ spec: | |
email: [email protected] | ||
``` | ||
## Variables | ||
## Default Templates | ||
### check.passed | ||
#### Title | ||
``` | ||
{{ if ne channel "slack"}}Check {{.check.name}} has passed{{end}} | ||
``` | ||
|
||
#### Template | ||
|
||
```txt file=../../../modules/mission-control/notification/templates/check.passed | ||
``` | ||
|
||
### check.failed | ||
|
||
#### Title | ||
|
||
``` | ||
{{ if ne channel "slack"}}Check {{.check.name}} has failed{{end}} | ||
``` | ||
|
||
#### Template | ||
|
||
```txt file=../../../modules/mission-control/notification/templates/check.failed | ||
``` | ||
|
||
## Template Variables | ||
|
||
| Field | Description | Schema | Optional | | ||
| ----------- | ----------------------------- | ------------------------------ | -------- | | ||
|