Alerting: UI for mute timings (#41578)

* wip: add form inputs for creating mute timing

* form for mute timings

* add action for submitting config

* fix bug in payload

* add table for viewing mute timings

* remove mute timing from routes when deleted

* attach mute timing to route

* edit a mute timing

* use field array for multiple intervals

* Add confirmation modal for deleting mute timing

* add default values to form inputs

* fetch am config prior to renderring form

* validation for mute timing fields

* fix tests

* tests for mute timing form

* small ui fixes for the form and table

* pass mute name as query param

* make time fields inline

* fix validation for an existing alert and overwrite on edit

* rename mute timing in routes on edit

* fix validation for time inputs

* make time interval its own component

* add descriptions for mute timings

* refactor time interval parsing functions

* fix linting and tests

* refactor makeAmLink

* docs for mute timings

* reorganize docs and add intro for mute timings

* doc review edits

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* run prettier

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
This commit is contained in:
Nathan Rodman
2022-01-05 10:16:43 -08:00
committed by GitHub
co-authored by achatterjee-grafana
parent e77b4abcc8
commit 825edddfb6
26 changed files with 1451 additions and 10 deletions
@@ -15,7 +15,7 @@ When Grafana alerting is enabled, you can:
- [View existing alerting rules and manage their current state]({{< relref "alerting-rules/rule-list.md" >}})
- [View the state and health of alerting rules]({{< relref "./fundamentals/state-and-health.md" >}})
- [Add or edit an alert contact point]({{< relref "./contact-points.md" >}})
- [Add or edit notification policies]({{< relref "./notification-policies.md" >}})
- [Add or edit notification policies]({{< relref "./notifications/_index.md" >}})
- [Add or edit silences]({{< relref "./silences.md" >}})
Before you begin using Grafana alerting, we recommend that you familiarize yourself with some [basic concepts]({{< relref "./fundamentals/_index.md" >}}) of Grafana alerting.
@@ -7,7 +7,7 @@ weight = 400
# Alert groups
Alert groups show grouped alerts from an Alertmanager instance. By default, the alerts are grouped by the label keys for the root policy in [notification policies]({{< relref "./notification-policies.md" >}}). Grouping common alerts into a single alert group prevents duplicate alerts from being fired.
Alert groups show grouped alerts from an Alertmanager instance. By default, the alerts are grouped by the label keys for the root policy in [notification policies]({{< relref "./notifications/_index.md" >}}). Grouping common alerts into a single alert group prevents duplicate alerts from being fired.
## View alert groupings
@@ -48,7 +48,7 @@ To send a test notification:
1. Find the contact point to delete, then click **Delete** (trash icon).
1. In the confirmation dialog, click **Yes, delete**.
> **Note:** You cannot delete contact points that are in use by a notification policy. You will have to either delete the [notification policy]({{< relref "./notification-policies.md" >}}) or update it to use another contact point.
> **Note:** You cannot delete contact points that are in use by a notification policy. You will have to either delete the [notification policy]({{< relref "./notifications/_index.md" >}}) or update it to use another contact point.
## Edit Alertmanager global config
@@ -0,0 +1,59 @@
+++
title = "Mute timings"
description = "Mute timings"
keywords = ["grafana", "alerting", "guide", "mute", "mute timings", "mute time interval"]
weight = 450
+++
# Mute timings
A mute timing is a recurring interval of time when no new notifications for a policy are generated or sent. are sent for a policy. Use them to prevent alerts from firing a specific and reoccurring period, for example, a regular maintenance period.
Similar to silences, mute timings do not prevent alert rules from being evaluated, nor do they stop alert instances from being shown in the user interface. They only prevent notifications from being created.
You can configure Grafana managed mute timings as well as mute timings for an [external Alertmanager data source]({{< relref "../../datasources/alertmanager.md" >}}). For more information, see [Alertmanager]({{< relref "./fundamentals/alertmanager.md" >}}).
## Mute timings vs silences
The following table highlights the key differences between mute timings and silences.
| Mute timing | Silence |
| -------------------------------------------------- | ---------------------------------------------------------------------------- |
| Uses time interval definitions that can reoccur | Has a fixed start and end time |
| Is created and then added to notification policies | Uses labels to match against an alert to determine whether to silence or not |
## Create a mute timing
1. In the Grafana menu, click the **Alerting** (bell) icon to open the Alerting page listing existing alerts.
1. Click **Notification policies**.
1. From the **Alertmanager** dropdown, select an external Alertmanager. By default, the Grafana Alertmanager is selected.
1. At the bottom of the page there will be a section titled **Mute timings**. Click the **Add mute timing** button.
1. You will be redirected to a form to create a [time interval](#time-intervals) to match against for your mute timing.
1. Click **Submit** to create the mute timing.
## Add mute timing to a notification policy
1. Identify the notification policy you would like to add the mute timing to and click the **Edit** button for that policy.
1. From the Mute Timings dropdown select the mute timings you would like to add to the route.
1. Click the **Save policy** button to save.
## Time intervals
A time interval is a definition for a moment in time. If an alert fires during this interval it will be suppressed. All fields are lists, and at least one list element must be satisfied to match the field. Fields also support ranges using `:` (ex: `monday:thursday`). The fields available for a time interval are: mute timing can contain multiple time intervals. A time interval is a specific duration when alerts are suppressed from firing. The duration typically consists of a specific time range along with days of a week, month, or year.
All properties for the time interval are lists, and at least one list element must be satisfied to match the field. The fields support ranges using `:` (ex: `monday:thursday`). If you leave a field blank, it will match with any moment of time.
Supported time interval options are:
- Time range: The time inclusive of the starting time and exclusive of the end time in UTC. - Days of the week: The day or range of days of the week. Example: `monday:thursday`. - Days of the month: The date 1-31 of a month. Negative values can also be used to represent days that begin at the end of the month. For example: `-1` for the last day of the month. - Months: The months of the year in either numerical or the full calendar month. For example: `1, may:august`. - Years: The year or years for the interval. For example: `2021:2024`.
If a field is left blank, any moment of time will match the field. For an instant of time to match a complete time interval, all fields must match. A mute timing can contain multiple time intervals.
If you want to specify an exact duration, specify all the options. For example, if you wanted to create a time interval for the first Monday of the month, for March, June, September, and December, between the hours of 12:00 and 24:00 UTC your time interval specification would be:
- Time range:
- Start time: `12:00`
- End time: `24:00`
- Days of the week: `monday`
- Months: `3, 6, 9, 12`
- Days of the month: `1:7`