Skip to main content

Notifications

Mission Control provides a flexible, event-based notification system that enables filtering and templating of notifications via email, push, slack, teams, etc.

Notifications are triggered by events. An event is a specific occurrence or change in state within the system. For example, notifications can be granular such as a health check failing or a pod crashlooping - or high level based on the health of the system as a whole.

check-failed.yaml
apiVersion: mission-control.flanksource.com/v1
kind: Notification
metadata:
name: http-check
namespace: default
spec:
events:
- check.failed
to:
email: alerts@acme.com

This notification will send an email to alerts@acme.com whenever a health check fails.

FieldDescriptionScheme
events*

[]Event

body

Channel dependant e.g. email body for email

Go Template

filter

Filter for which events to send notifications on, must return true

CEL

title

Channel dependant e.g. subject for email

Go Template

to.connection

Connection to external service

connection

to.email

Send an email to an external email address

email

to.person

Send an email to the person

UUID or email of a person

to.properties

Only applicable if url is specified

map[string]string

to.team

Send an email to every person in the team

UUID or name of team

to.url

Custom notification URL

Channel

Only one recipient can be specified

Templating

You can use Go Templates to customize the content of notification titles and bodies. This allows you to include dynamic information from the event that triggered the notification.

For example, the following notification definition uses a Go Template to include the name and health status of the check in the notification title:

notification-template
apiVersion: mission-control.flanksource.com/v1
kind: Notification
spec:
title: Check {{.check.name}} is {{.check.health}}

In this example {{.check.name}} and {{.check.health}} are placeholders that will be replaced with the actual values of the name and health fields from the check object associated with the event.

Markdown

All notification templates in Mission Control are defined in markdown, and depending on the support of the notification channel in use it will either be converted to HTML or plain text.

Filtering Events

Mission Control allows you to fine-tune your notification delivery by filtering events using CEL. This enables you to specify precise conditions that dictate when a notification should be triggered. For instance, you can configure notifications to be sent only for specific event types, specific resources, or when certain conditions are met.

The CEL filters you define have access to the same set of variables as the templates, providing flexibility in defining your filtering criteria. These variables, representing various attributes and properties of the events, empower you to create highly targeted notifications.

To illustrate, consider a scenario where you want to receive notifications exclusively for failed HTTP checks. The following example demonstrates how to achieve this using a CEL filter:

filter-http.yaml
apiVersion: mission-control.flanksource.com/v1
kind: Notification
metadata:
name: http-alerts
spec:
events:
- check.failed
# Filter for events where the check type is 'http'
filter: check.type == 'http'
to:
email: alerts@acme.com

In this example:

  • The filter field specifies the CEL expression check.type == 'http'.
  • This expression evaluates to true only when the type attribute of the check object is equal to 'http'.
  • Consequently, notifications will be sent only for events that satisfy this condition, ensuring that you are alerted specifically for failed HTTP checks.