Use this file to discover all available pages before exploring further.
A notification policy connects a monitor with notifiers at warning and critical
levels. The notification policy applies rules that define how to route an alert when
it triggers, such as who to notify and through which notifier type. Chronosphere
Observability Platform runs several checks to determine
which notification policy to apply. You can
define custom overrides for notification policies based on a signal’s labels.
Select from the following methods to view your available notification policies.
Web
Chronoctl
API
To view all notification policies:
In the navigation menu select
Alerts > Notification Policies.
Use the search box to locate specific notification policies, or choose a
notification policy from the Select a Team dropdown.
Click a notification policy to view its definition.
The list includes notification policies created in Terraform, but you can’t modify
them.
To view available notification policies in Chronoctl, use the
notification-policies list command:
chronoctl notification-policies list
This command returns a list of YAML documents, each representing a notification
policy. For example, a Chronoctl listing of a notification policy in the
example-team-name team might look like this:
To complete this action with the Chronosphere API, use the
ListNotificationPolicies
endpoint.Because the Chronosphere API requires authentication, include an API token with your
curl request, as shown in the following example. For more details, see
Create an API token.
Per collection: If you configure a notification policy as the default policy on
a collection, every monitor in that collection inherits the notification policy.
Per monitor: You can set a notification policy explicitly on each monitor
rather than setting a default policy for a collection.
Notification policies use the repeat_interval parameter, which is the frequency (in seconds) to
resend alerts. Repeat interval is a
required field, and must be set separately
for each monitor.If the repeat interval isn’t set, or is set to 0, the value defaults to 3600.The repeat interval can not be lower than 300 seconds (five minutes), and should be
a multiple of 300. Repeat intervals are rounded up to the next five minute
increment.To reduce repeat notifications for the same alert, set your repeat interval to a high
value. The maximum repeat interval is 3456000 seconds (40 days).
Chronosphere recommends using
signal_grouping in most
circumstances.
This feature isn’t available to all Chronosphere Observability Platform users and
might not be visible in your app. For information about enabling this feature in your
environment, contact Chronosphere Support.
You can configure a group_by field in notification policies both on the default and
override levels. The value of group_by accepts a set of unique labels. For example,
you can group by env for environments or by endpoint.
Grouping notifications with the group_by field for a notification policy is applied
only if the associated monitor doesn’t have any custom
signals configured.
Web
Chronoctl
Terraform
API
To create a notification policy:
In the navigation menu select
Alerts > Notification Policies.
On the Notification Policies page, click Create notification policy.
Enter a name for the notification policy. Optionally, select a team to own
the policy.
For both Critical Alert Notifiers and Warning Alert Notifiers:
Select the time period for resending notifications, which defaults to one hour.
Choose a notifier to define who to notify and through which endpoint.
Click Save.
Using YAML definitions for creating a notification policy allows for more flexibility
and override options.For example, the following YAML definition creates a notification policy associated
with the api-error team. It defines notifiers for critical and warning alerts,
with the notification frequency for critical customized to 60 minutes, represented as
3600 seconds.
This example uses a default notifier with the slug slack
for critical notifications, and includes a group_by field to group notifications by
the service label. If the env label matches the production value
(env=production), then override notifiers apply and notifications are grouped by
the env and severity labels.
Replace FILE_NAME with the name of your notifier YAML file.
When you run terraform plan to generate an execution plan, Chronosphere automatically
tests configurations that include notification policies by submitting them as dry runs.
For details, see the
Terraform provider
documentation.
Create a notification policy with Terraform by using the
chronosphere_notification_policy type followed by a name. You can optionally
specify a slug.To associate a notification policy:
With a collection: define a chronosphere_collection resource and specify a
notification_policy_id.
With a monitor: define a chronosphere_monitor resource and specify a
notification_policy_id.
For example, the following code creates a notification policy that Terraform refers
to as infra, which defines notification routes for Slack and PagerDuty:
resource "chronosphere_notification_policy" "infra" { name = "Infra Development Policy" slug = "infra-development-policy" # Route that sends warning alert notifications to Slack route { # Valid values: warn, critical severity = "warn" # Set of notifiers for alerts triggered at the this severity level notifiers = [chronosphere_slack_alert_notifier.default.id] } # You can specify multiple routes in a notification policy route { # Valid values: warn, critical severity = "critical" # Set of notifiers for alerts triggered at the severity level notifiers = [chronosphere_pagerduty_alert_notifier.default.id] # The notification frequency to resend alerts, which defaults to 60m (one hour). repeat_interval = "60m" } notification_policy_id = chronosphere_notification_policy.infra_override.id}# Associates a notification policy with a collectionresource "chronosphere_collection" "infra" { name = "Infrastructure collection" team_id = infra.team_id description = "Collection of resources related to infrastructure services." notification_policy_id = chronosphere_notification_policy.infra.id}# Associates a notification policy with a monitorresource "chronosphere_monitor" "infra" { name = "Infrastructure monitor" collection_id = chronosphere_collection.infra.id ...}# Optional override if you want to override the inherited collection policy to a value specific to this monitorresource "chronosphere_monitor" "infra_with_policy_override" { name = "Infrastructure monitor with policy override" collection_id = chronosphere_collection.infra.id # Override the notification policy assigned to the collection. notification_policy_id = chronosphere_notification_policy.other.id ...}
Add the definition to a Terraform file.
Run this command to create the resource:
terraform apply
To complete this action with the Chronosphere API, use the
CreateNotificationPolicy
endpoint.Because the Chronosphere API requires authentication, include an API token with your
curl request, as shown in the following example. For more details, see
Create an API token.
To complete this action with the Chronosphere API, use the
UpdateNotificationPolicy
endpoint.Because the Chronosphere API requires authentication, include an API token with your
curl request, as shown in the following example. For more details, see
Create an API token.
Edit your Terraform configuration file to remove the pre-existing resource
definition.
Run this command to remove the resource from Observability Platform:
terraform apply
To complete this action with the Chronosphere API, use the
DeleteNotificationPolicy
endpoint.Because the Chronosphere API requires authentication, include an API token with your
curl request, as shown in the following example. For more details, see
Create an API token.
You can override notification policy defaults based on alert labels by adding an
overrides collection to its definition. Use the alert_label_matchers collection
to define the conditions for the override.You can specify either a monitor label name or a signal label name as the value of
the alert_label_matchers collection. If you specify any other label type, the
override isn’t processed for the specified monitor, even if the alerting series
includes the specified label.When an override matches the defined conditions, the notification defined in the
specified notifiers collection triggers. If an override matches multiple
conditions, only the first match triggers a notification. Any additional matches
don’t trigger a notification. Similarly, if an override matches multiple notifiers,
only the first matching notifier triggers a notification.For matcher labels within an override notifier, all matcher label conditions must be
met for an override notifier to be selected.When a monitor has signal_per_series set to true (multiple alerts) as the signal
grouping, you can use any label as a notification policy override.
Web
Chronoctl
Terraform
API
To override a notification policy:
In the navigation menu select
Alerts > Notification Policies.
On the Notification Policies page, click Create notification policy.
Enter a name for the notification policy. Optionally, select a team to own
the policy.
For both Critical Alert Notifiers and Warning Alert Notifiers:
Select the time period for resending notifications.
Choose a notifier to define who to notify and through which endpoint.
Click + Add Override Notifier to define a notification override:
Enter a label name and value to match on. To add another label and value to
match on, click Add Matcher Label.
Define the conditions for both the Critical Alert Notifiers and
Warning Alert Notifiers sections.
Click Save.
For example, the following YAML definition adds an override notifier when the
component label has the value of mysql, and another if the importance label has
the value low:
This example uses the type value EXACT for exact label matching. To use regular
expression matching, provide the type value REGEX. These are the resource’s only
type values.
routes: defaults: ... overrides: # If an alert has the component=mysql label, route to the db team. - alert_label_matchers: - type: EXACT, name: component value: mysql notifiers: critical: notifier_slugs: - db-team-urgent warn: notifier_slugs: - db-team - alert_label_matchers: - type: EXACT name: importance value: low notifiers: critical: notifier_slugs: - accounts-email
To override a notification policy override in Terraform, use the override parameter.This Terraform definition adds an override notifier when the component label has
the value of mysql, and another if the importance label has the value low:
resource "chronosphere_notification_policy" "infra" { ... # You can optionally define multiple overrides, which route alerts with # matching labels to alternative sets of notifiers. override { # One or more matchers for labels on an alert, where labels are # from a monitor's hardcoded labels or signal labels alert_label_matcher { # Name of the label name = "component" # How the label is matched: "EXACT_MATCHER_TYPE" or "REGEXP_MATCHER_TYPE" type = "EXACT_MATCHER_TYPE" # Value of the label value = "mysql" } # The set of zero or more routes used for alerts with matching labels route { # Valid values: warn, critical severity = "critical" # Set of notifiers for alerts triggered at the this severity level notifiers = [chronosphere_slack_alert_notifier.default.id] } } override { alert_label_matcher { name = "importance" type = "EXACT_MATCHER_TYPE" value = "low" } route { severity = "warn" notifiers = [chronosphere_email_alert_notifier.default.id] } }}
Add the definition to a Terraform file.
Run this command to create the resource:
terraform apply
To complete this action with the Chronosphere API, use the
UpdateNotificationPolicy
endpoint and update the overrides key.Because the Chronosphere API requires authentication, include an API token with your
curl request, as shown in the following example. For more details, see
Create an API token.
When a monitor triggers, Observability Platform runs checks to determine which
notification policy to apply. First, Observability Platform checks the notification
policy type to determine:
If the monitor has an explicit notification policy, use that policy.
If the associated collection has a default policy, use that policy. The
notification_policy_slug or notification_policy_id attribute for a collection
entity declares a default policy.
If the collection doesn’t have a default policy but has an owned policy, use that
policy. The bucket_slug attribute for a notification policy entity declares an
owned policy.