diff --git a/docs/sources/alerting/alerting-rules/create-alerts-panels.md b/docs/sources/alerting/alerting-rules/create-alerts-panels.md deleted file mode 100644 index 267fe86cc03..00000000000 --- a/docs/sources/alerting/alerting-rules/create-alerts-panels.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -canonical: https://grafana.com/docs/grafana/latest/alerting/alerting-rules/create-alerts-panels/ -description: Create alert rules from panels. Reuse the queries in the panel and create alert rules based on them. -keywords: - - grafana - - alerting - - panels - - create - - grafana-managed - - data source-managed -labels: - products: - - cloud - - enterprise - - oss -title: Create alert rules from panels -weight: 300 -refs: - time-series-visualizations: - - pattern: /docs/grafana/ - destination: /docs/grafana//panels-visualizations/visualizations/time-series/ - - pattern: /docs/grafana-cloud/ - destination: /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/time-series/ ---- - -## Create alert rules from panels - -Create alert rules from time series panels. By doing so, you can reuse the queries in the panel and create alert rules based on them. - -1. Navigate to a dashboard in the **Dashboards** section. -2. Hover over the top-right corner of a time series panel and click the panel menu icon. -3. From the dropdown menu, select **More...** > **New alert rule**. - -The New alert rule form opens where you can configure and create your alert rule based on the query used in the panel. - -{{% admonition type="note" %}} -Changes to the panel aren't reflected on the linked alert rules. If you change a query, you have to update it in both the panel and the alert rule. - -Alert rules are only supported in [time series](ref:time-series-visualizations) visualizations. -{{% /admonition %}} - -{{< docs/play title="visualizations with linked alerts in Grafana" url="https://play.grafana.org/d/000000074/" >}} - -## View alert rules from panels - -To view alert rules associated with a time series panel, complete the following steps. - -1. Open the panel editor by hovering over the top-right corner of any panel -1. Click the panel menu icon that appears. -1. Click **Edit**. -1. Click the **Alert** tab to view existing alert rules or create a new one. diff --git a/docs/sources/alerting/alerting-rules/create-grafana-managed-rule.md b/docs/sources/alerting/alerting-rules/create-grafana-managed-rule.md index 33d5b94b1df..8744be27bc4 100644 --- a/docs/sources/alerting/alerting-rules/create-grafana-managed-rule.md +++ b/docs/sources/alerting/alerting-rules/create-grafana-managed-rule.md @@ -64,16 +64,11 @@ refs: destination: /docs/grafana//alerting/fundamentals/alert-rules/annotation-label/ - pattern: /docs/grafana-cloud/ destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/annotation-label/ - alert-list: + link-alert-rules-to-panels: - pattern: /docs/grafana/ - destination: /docs/grafana//panels-visualizations/visualizations/alert-list/ + destination: /docs/grafana//alerting/alerting-rules/link-alert-rules-to-panels/ - pattern: /docs/grafana-cloud/ - destination: /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/alert-list/ - time-series: - - pattern: /docs/grafana/ - destination: /docs/grafana//panels-visualizations/visualizations/time-series/ - - pattern: /docs/grafana-cloud/ - destination: /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/time-series/ + destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/link-alert-rules-to-panels/ --- # Configure Grafana-managed alert rules @@ -257,13 +252,9 @@ Annotations add metadata to provide more information on the alert in your alert Webpage where you keep your runbook for the alert 1. Optional: Add a custom annotation -1. Optional: Add a **dashboard and panel link**. +1. Optional: **Link dashboard and panel**. - Links alert rules to panels in a dashboard. - - {{% admonition type="note" %}} - At the moment, alert rules are only supported in [time series](ref:time-series) and [alert list](ref:alert-list) visualizations. - {{% /admonition %}} + [Link the alert rule to a panel](ref:link-alert-rules-to-panels) to facilitate alert investigation. 1. Click **Save rule**. diff --git a/docs/sources/alerting/alerting-rules/create-mimir-loki-managed-rule.md b/docs/sources/alerting/alerting-rules/create-mimir-loki-managed-rule.md index a4fea1bf00f..7877903a521 100644 --- a/docs/sources/alerting/alerting-rules/create-mimir-loki-managed-rule.md +++ b/docs/sources/alerting/alerting-rules/create-mimir-loki-managed-rule.md @@ -29,16 +29,11 @@ refs: destination: /docs/grafana//alerting/fundamentals/alert-rules/annotation-label/ - pattern: /docs/grafana-cloud/ destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/annotation-label/ - alert-list: + link-alert-rules-to-panels: - pattern: /docs/grafana/ - destination: /docs/grafana//panels-visualizations/visualizations/alert-list/ + destination: /docs/grafana//alerting/alerting-rules/link-alert-rules-to-panels/ - pattern: /docs/grafana-cloud/ - destination: /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/alert-list/ - time-series: - - pattern: /docs/grafana/ - destination: /docs/grafana//panels-visualizations/visualizations/time-series/ - - pattern: /docs/grafana-cloud/ - destination: /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/time-series/ + destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/link-alert-rules-to-panels/ --- # Configure data source-managed alert rules @@ -142,12 +137,8 @@ Annotations add metadata to provide more information on the alert in your alert Webpage where you keep your runbook for the alert 1. Optional: Add a custom annotation -1. Optional: Add a **dashboard and panel link**. +1. Optional: **Link dashboard and panel**. - Links alerts to panels in a dashboard. - - {{% admonition type="note" %}} - At the moment, alert rules are only supported in [time series](ref:time-series) and [alert list](ref:alert-list) visualizations. - {{% /admonition %}} + [Link the alert rule to a panel](ref:link-alert-rules-to-panels) to facilitate alert investigation. 1. Click **Save rule**. diff --git a/docs/sources/alerting/alerting-rules/link-alert-rules-to-panels.md b/docs/sources/alerting/alerting-rules/link-alert-rules-to-panels.md new file mode 100644 index 00000000000..dbeb38ba8b4 --- /dev/null +++ b/docs/sources/alerting/alerting-rules/link-alert-rules-to-panels.md @@ -0,0 +1,84 @@ +--- +aliases: + - ../../alerting/alerting-rules/create-alerts-panels/ # /docs/grafana//alerting/alerting-rules/create-alerts-panels/ +canonical: https://grafana.com/docs/grafana/latest/alerting/alerting-rules/link-alert-rules-to-panels/ +description: Grafana allows you to link alert rules with panels and dashboards. This helps connect alerts with an existing dashboard and informs alert responders on where to investigate. +keywords: + - grafana + - alerting + - panels + - create + - grafana-managed + - data source-managed +labels: + products: + - cloud + - enterprise + - oss +title: Create and link alert rules to panels +weight: 300 +refs: + time-series-visualizations: + - pattern: /docs/grafana/ + destination: /docs/grafana//panels-visualizations/visualizations/time-series/ + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/time-series/ + annotations: + - pattern: /docs/grafana/ + destination: /docs/grafana//alerting/fundamentals/alert-rules/annotation-label/#annotations + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/annotation-label/#annotations + view-alert-state-on-panels: + - pattern: /docs/grafana/ + destination: /docs/grafana//alerting/manage-notifications/view-alert-state-on-panels/ + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana-cloud/alerting-and-irm/alerting/manage-notifications/view-alert-state-on-panels/ +--- + +# Create and link alert rules to panels + +Grafana allows you to link an alert rule to a dashboard panel. This can help you: + +- Inform alert responders about where to investigate and which data to examine. +- Visualize the alert state directly from dashboards. + +An alert rule is linked to a panel by setting the [`dashboardUId` and `panelId` annotations](ref:annotations). Both annotations must be set together. + +## Link alert rules to panels + +When configuring the alert rule, you can set the dashboard and panel annotations as shown in this [video](https://youtu.be/ClLp-iSoaSY?si=qKWnvSVaQuvYcuw9&t=170). + +1. Configure the alert rule. +1. In the **Configure notification message** section, click **Link dashboard and panel**. +1. Select an existing dashboard, then choose a panel from the selected dashboard. +1. Complete the alert rule configuration and click **Save rule** to initiate the alert rule. + +You can then [view the alert state on the panel](ref:view-alert-state-on-panels). + +{{< figure src="/media/docs/alerting/panel-displays-alert-state.png" max-width="1200px" caption="A panel displaying the alert status and state changes." >}} + +## Create alert rules from panels + +To streamline alert creation, you can create an alert rule directly from a panel. + +1. Navigate to a dashboard in the **Dashboards** section. +1. Hover over the top-right corner of a panel and click the panel menu icon. +1. From the dropdown menu, select **More...** > **New alert rule**. +1. This opens the **Edit rule** form and pre-fills some values: + - Sets the `dashboardUId` and `panelId` annotations to the corresponding dashboard and panel. + - Sets the alert rule query using the panel query. +1. Complete the alert rule configuration and click **Save rule** to initiate the alert rule. + +You can then [view the alert state on the panel](ref:view-alert-state-on-panels). + +{{% admonition type="note" %}} +Changes to panel and alert rule queries aren't synchronized. If you change a query, you have to update it in both the panel and the alert rule. +{{% /admonition %}} + +## Access linked alert rules from panels + +This option is available only in [time series panels](ref:time-series-visualizations). To access alert rules associated to a time series panel, complete the following steps. + +1. Hover over the top-right corner of the panel and click the panel menu icon. +1. Click **Edit**. +1. Click the **Alert** tab to view existing alert rules or create a new one. diff --git a/docs/sources/alerting/configure-notifications/template-notifications/manage-notification-templates.md b/docs/sources/alerting/configure-notifications/template-notifications/manage-notification-templates.md index 5ebeb4882c0..1e52204320e 100644 --- a/docs/sources/alerting/configure-notifications/template-notifications/manage-notification-templates.md +++ b/docs/sources/alerting/configure-notifications/template-notifications/manage-notification-templates.md @@ -28,11 +28,6 @@ refs: destination: /docs/grafana//alerting/configure-notifications/template-notifications/reference/ - pattern: /docs/grafana-cloud/ destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/reference/ - notification-template-examples: - - pattern: /docs/grafana/ - destination: /docs/grafana//alerting/configure-notifications/template-notifications/language/ - - pattern: /docs/grafana-cloud/ - destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/language/ --- # Manage notification templates diff --git a/docs/sources/alerting/fundamentals/alert-rules/annotation-label.md b/docs/sources/alerting/fundamentals/alert-rules/annotation-label.md index 26cf255ccbb..9640d3c3fe0 100644 --- a/docs/sources/alerting/fundamentals/alert-rules/annotation-label.md +++ b/docs/sources/alerting/fundamentals/alert-rules/annotation-label.md @@ -26,11 +26,11 @@ refs: destination: /docs/grafana//alerting/fundamentals#alert-instances - pattern: /docs/grafana-cloud/ destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals#alert-instances - create-alerts-from-panel: + link-alert-rules-to-panels: - pattern: /docs/grafana/ - destination: /docs/grafana//alerting/alerting-rules/create-alerts-panels/ + destination: /docs/grafana//alerting/alerting-rules/link-alert-rules-to-panels/ - pattern: /docs/grafana-cloud/ - destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/create-alerts-panels/ + destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/link-alert-rules-to-panels/ templates: - pattern: /docs/grafana/ destination: /docs/grafana//alerting/fundamentals/templates/ @@ -139,7 +139,7 @@ Annotations are displayed in Grafana and are included by default in notification - `summary`: A short summary of what the alert has detected and why. - `description`: A detailed description of what happened and what the alert does. - `runbook_url`: The runbook page to guide operators managing a potential incident. -- `dashboardUId` and `panelId`: Link the alert to a dashboard and panel. These are automatically set when [creating an alert from panels](ref:create-alerts-from-panel). +- `dashboardUId` and `panelId`: [Link the alert to a dashboard and panel](ref:link-alert-rules-to-panels) to facilitate alert investigation. For example, you can edit the annotation `summary` to explain why the alert was triggered: diff --git a/docs/sources/alerting/manage-notifications/view-alert-state-on-panels.md b/docs/sources/alerting/manage-notifications/view-alert-state-on-panels.md new file mode 100644 index 00000000000..1daffe011b8 --- /dev/null +++ b/docs/sources/alerting/manage-notifications/view-alert-state-on-panels.md @@ -0,0 +1,54 @@ +--- +canonical: https://grafana.com/docs/grafana/latest/alerting/manage-notifications/view-alert-state-on-panels/ +description: View alert rules +keywords: + - grafana + - alerting + - guide + - rules + - view +labels: + products: + - cloud + - enterprise + - oss +title: View alert state on panels +weight: 430 +refs: + time-series-visualizations: + - pattern: /docs/grafana/ + destination: /docs/grafana//panels-visualizations/visualizations/time-series/ + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/time-series/ + alert-list-panel: + - pattern: /docs/grafana/ + destination: /docs/grafana//panels-visualizations/visualizations/alert-list/ + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/alert-list/ + link-alert-rules-to-panels: + - pattern: /docs/grafana/ + destination: /docs/grafana//alerting/alerting-rules/link-alert-rules-to-panels/ + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/link-alert-rules-to-panels/ +--- + +# View alert state on panels + +When an [alert rule is linked to a time series panel](ref:link-alert-rules-to-panels), the time series panel displays the alert state and alert events. + +A heart icon near the panel title shows the current alert state: + +- A broken red heart when the alert is in `Alerting` state. +- A green heart when the alert is in `Normal` state. + +Colored annotations indicate changes in alert state, such as pending, alerting, and resolving. + +{{< figure src="/media/docs/alerting/panel-displays-alert-state.png" max-width="1200px" alt="A panel with a firing alert and annotations that display the pending and alerting state changes." >}} + +Additionally, Grafana provides an [alert list panel](ref:alert-list-panel) that you can add to a dashboard to display a list of alerts and their states. + +{{< figure src="/static/img/docs/alert-list-panel/alert-list-panel.png" max-width="850px" alt="Two alert list panels displaying distinct lists of alerts." >}} + +You can configure the alert list panel with various visualization options and filters to control how alerts are displayed. For more details, refer to the [Alert list documentation](ref:alert-list-panel). + +{{< docs/play title="this demo dashboard with alert list panels and linked alert rules" url="https://play.grafana.org/d/000000074/" >}} diff --git a/docs/sources/shared/alerts/alerting_provisioning.md b/docs/sources/shared/alerts/alerting_provisioning.md index b5fe4c23eac..1ec0fb133f2 100644 --- a/docs/sources/shared/alerts/alerting_provisioning.md +++ b/docs/sources/shared/alerts/alerting_provisioning.md @@ -1807,24 +1807,24 @@ Status: Accepted {{% responsive-table %}} -| Name | Type | Go type | Required | Default | Description | Example | -| ------------ | ---------------------------- | ------------------- | :------: | ------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| annotations | map of string | `map[string]string` | | | | `{"runbook_url":"https://supercoolrunbook.com/page/13"}` | -| condition | string | `string` | ✓ | | | `A` | -| data | [][AlertQuery](#alert-query) | `[]*AlertQuery` | ✓ | | | `[{"datasourceUid":"__expr__","model":{"conditions":[{"evaluator":{"params":[0,0],"type":"gt"},"operator":{"type":"and"},"query":{"params":[]},"reducer":{"params":[],"type":"avg"},"type":"query"}],"datasource":{"type":"__expr__","uid":"__expr__"},"expression":"1 == 1","hide":false,"intervalMs":1000,"maxDataPoints":43200,"refId":"A","type":"math"},"queryType":"","refId":"A","relativeTimeRange":{"from":0,"to":0}}]` | -| execErrState | string | `string` | ✓ | | | | -| folderUID | string | `string` | ✓ | | | `project_x` | -| for | [Duration](#duration) | `Duration` | ✓ | | | | -| id | int64 (formatted integer) | `int64` | | | | | -| isPaused | boolean | `bool` | | | | `false` | -| labels | map of string | `map[string]string` | | | | `{"team":"sre-team-1"}` | -| noDataState | string | `string` | ✓ | | | | -| orgID | int64 (formatted integer) | `int64` | ✓ | | | | -| provenance | [Provenance](#provenance) | `Provenance` | | | | | -| ruleGroup | string | `string` | ✓ | | | `eval_group_1` | -| title | string | `string` | ✓ | | | `Always firing` | -| uid | string | `string` | | | | | -| updated | date-time (formatted string) | `strfmt.DateTime` | | | | | +| Name | Type | Go type | Required | Default | Description | Example | +| ------------ | ---------------------------- | ------------------- | :------: | ------- | ----------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| annotations | map of string | `map[string]string` | | | Optional key-value pairs. `dashboardUId` and `panelId` must be set together; one cannot be set without the other. | `{"runbook_url":"https://supercoolrunbook.com/page/13"}` | +| condition | string | `string` | ✓ | | | `A` | +| data | [][AlertQuery](#alert-query) | `[]*AlertQuery` | ✓ | | | `[{"datasourceUid":"__expr__","model":{"conditions":[{"evaluator":{"params":[0,0],"type":"gt"},"operator":{"type":"and"},"query":{"params":[]},"reducer":{"params":[],"type":"avg"},"type":"query"}],"datasource":{"type":"__expr__","uid":"__expr__"},"expression":"1 == 1","hide":false,"intervalMs":1000,"maxDataPoints":43200,"refId":"A","type":"math"},"queryType":"","refId":"A","relativeTimeRange":{"from":0,"to":0}}]` | +| execErrState | string | `string` | ✓ | | | | +| folderUID | string | `string` | ✓ | | | `project_x` | +| for | [Duration](#duration) | `Duration` | ✓ | | | | +| id | int64 (formatted integer) | `int64` | | | | | +| isPaused | boolean | `bool` | | | | `false` | +| labels | map of string | `map[string]string` | | | | `{"team":"sre-team-1"}` | +| noDataState | string | `string` | ✓ | | | | +| orgID | int64 (formatted integer) | `int64` | ✓ | | | | +| provenance | [Provenance](#provenance) | `Provenance` | | | | | +| ruleGroup | string | `string` | ✓ | | | `eval_group_1` | +| title | string | `string` | ✓ | | | `Always firing` | +| uid | string | `string` | | | | | +| updated | date-time (formatted string) | `strfmt.DateTime` | | | | | {{% /responsive-table %}}