Docs: Move alert rule section to alerting fundamentals section (#49657)

* initial commit

* Added links to alert rules, and fixes one broken alerting relref.
This commit is contained in:
JitaC
2022-05-25 18:53:05 -04:00
committed by GitHub
parent b5d48d217a
commit a968a43e0c
7 changed files with 6 additions and 4 deletions
@@ -0,0 +1,19 @@
+++
title = "Alert rules"
description = "About Grafana alert rules"
keywords = ["grafana", "alerting", "rules"]
weight = 101
+++
# About alert rules
An alerting rule is a set of evaluation criteria that determines whether an alert instance will fire. The rule consists of one or more queries and expressions, a condition, the frequency of evaluation, and optionally, the duration over which the condition is met.
While queries and expressions select the data set to evaluate, a condition sets the threshold that an alert must meet or exceed to create an alert.
An interval specifies how frequently an alerting rule is evaluated. Duration, when configured, indicates how long a condition must be met. The alert rules can also define alerting behavior in the absence of data.
- [Alert rule types]({{< relref "./alert-rule-types.md" >}})
- [Alert instances]({{< relref "./alert-instances.md" >}})
- [Organising alert rules]({{< relref "./organising-alerts.md" >}})
- [Annotation and labels]({{< relref "../annotation-label/_index.md" >}})
@@ -0,0 +1,22 @@
+++
title = "Alert instances"
description = "Learn about Grafana alert instances"
keywords = ["grafana", "alerting", "instances"]
weight = 103
+++
# Alert instances
Grafana managed alerts support multi-dimensional alerting. Each alert rule can create multiple alert instances. This is exceptionally powerful if you are observing multiple series in a single expression.
Consider the following PromQL expression:
```promql
sum by(cpu) (
rate(node_cpu_seconds_total{mode!="idle"}[1m])
)
```
A rule using this expression will create as many alert instances as the amount of CPUs we are observing after the first evaluation, allowing a single rule to report the status of each CPU.
{{< figure src="/static/img/docs/alerting/unified/multi-dimensional-alert.png" caption="A multi-dimensional Grafana managed alert rule" >}}
@@ -0,0 +1,30 @@
+++
title = "Alert rule types"
description = "Learn about the different alert rule types"
keywords = ["grafana", "alerting", "rule types"]
weight = 102
+++
# Alert rule types
Grafana supports several alert rule types, the following sections will explain their merits and demerits and help you choose the right alert type for your use case.
## Grafana managed rules
Grafana-managed rules are the most flexible alert rule type. They allow you to create alerts that can act on data from any of your existing data sources.
In additional to supporting any datasource you can also add additional [expressions]({{< relref "../../panels/query-a-data-source/use-expressions-to-manipulate-data/_index.md" >}}) to transform your data and express alert conditions.
## Mimir, Loki and Cortex rules
To create Mimir, Loki or Cortex alerts you must have a compatible Prometheus data source. You can check if your data source is compatible by testing the data source and checking the details if the ruler API is supported.
{{< figure src="/static/img/docs/alerting/unified/mimir-datasource-check.png" caption="Successfully connected to a Mimir Prometheus datasource" max-width="40%" >}}
## Recording rules
Recording rules are only available for compatible Prometheus data sources like Mimir, Loki and Cortex.
A recording rule allows you to save an expression's result to a new set of time series. This is useful if you want to run alerts on aggregated data or if you have dashboards that query the same expression repeatedly.
Read more about [recording rules](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/) in Prometheus.
@@ -0,0 +1,22 @@
+++
title = "Organising alert rules"
description = "Learn how to organize alert rules"
keywords = ["grafana", "alerting", "organization"]
weight = 104
+++
## Namespaces and groups
Alerts can be organized using Folders for Grafana-managed rules and namespaces for Mimir or Loki rules and group names.
### Namespaces
When creating Grafana-managed rules, the folder can be used to perform access control and grant or deny access to all rules within a specific folder.
### Groups
All rules within a group are evaluated at the same **interval**.
Alert rules and recording rules within a group will always be evaluated **sequentially**, meaning no rules will be evaluated at the same time and in order of appearance.
> **Note** If you want rules to be evaluated concurrently and with different intervals, consider storing them in different groups.