"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "docs/sources/alerting/unified-alerting/alerting-rules/create-grafana-managed-rule.md" between
grafana-8.0.0.tar.gz and grafana-8.0.1.tar.gz

About: Grafana is a visualization tool for monitoring, metric analytics and dashboards for Graphite, InfluxDB, Prometheus and many more.

create-grafana-managed-rule.md  (grafana-8.0.0):create-grafana-managed-rule.md  (grafana-8.0.1)
skipping to change at line 30 skipping to change at line 30
## Alert rule fields ## Alert rule fields
This section describes the fields you fill out to create an alert. This section describes the fields you fill out to create an alert.
### Alert type ### Alert type
- **Alert name -** Enter a descriptive name. The name will be displayed in the alert rule list, as well as added as `alertname` label to every alert instance that is created from this rule. - **Alert name -** Enter a descriptive name. The name will be displayed in the alert rule list, as well as added as `alertname` label to every alert instance that is created from this rule.
- **Alert type -** Select **Grafana managed alert**. - **Alert type -** Select **Grafana managed alert**.
- **Folder -** Select a folder this alert rule will belong to. To create a new folder, click on the drop down and type in a new folder name. - **Folder -** Select a folder this alert rule will belong to. To create a new folder, click on the drop down and type in a new folder name.
![Alert type section screenshot](/img/docs/alerting/unified/rule-edit-grafana-al ert-type-8-0.png 'Alert type section screenshot') ![Alert type section screenshot](/static/img/docs/alerting/unified/rule-edit-gra fana-alert-type-8-0.png 'Alert type section screenshot')
### Query ### Query
Add one or more [queries]({{< relref "../../../panels/queries.md" >}}) or [expre ssions]({{< relref "../../../panels/expressions.md" >}}). You can use classic co ndition expression to create a rule that will trigger a single alert if it's thr eshold is met, or use reduce and math expressions to create a multi dimensional alert rule that can trigger multiple alerts, one per matching series in the quer y result. Add one or more [queries]({{< relref "../../../panels/queries.md" >}}) or [expre ssions]({{< relref "../../../panels/expressions.md" >}}). You can use classic co ndition expression to create a rule that will trigger a single alert if it's thr eshold is met, or use reduce and math expressions to create a multi dimensional alert rule that can trigger multiple alerts, one per matching series in the quer y result.
#### Rule with classic condition #### Rule with classic condition
You can use classic condition expression to create a rule that will trigger a si ngle alert if it's conditions is met. It works about the same way as dashboard a lerts in previous versions of Grafana. You can use classic condition expression to create a rule that will trigger a si ngle alert if it's conditions is met. It works about the same way as dashboard a lerts in previous versions of Grafana.
1. Add one or more queries 1. Add one or more queries
skipping to change at line 54 skipping to change at line 54
If a query returns multiple series, then the aggregation function and threshold check will be evaluated for each series.It will not track alert state **per seri es**. This has implications that are detailed in the scenario below. If a query returns multiple series, then the aggregation function and threshold check will be evaluated for each series.It will not track alert state **per seri es**. This has implications that are detailed in the scenario below.
- Alert condition with query that returns 2 series: **server1** and **server2** - Alert condition with query that returns 2 series: **server1** and **server2**
- **server1** series causes the alert rule to fire and switch to state `Firing` - **server1** series causes the alert rule to fire and switch to state `Firing`
- Notifications are sent out with message: _load peaking (server1)_ - Notifications are sent out with message: _load peaking (server1)_
- In a subsequent evaluation of the same alert rule, the **server2** series also causes the alert rule to fire - In a subsequent evaluation of the same alert rule, the **server2** series also causes the alert rule to fire
- No new notifications are sent as the alert rule is already in state `Firing`. - No new notifications are sent as the alert rule is already in state `Firing`.
So, as you can see from the above scenario Grafana will not send out notificatio ns when other series cause the alert to fire if the rule already is in state `Fi ring`. If you want to have alert per series, create a multi dimensional alert ru le as described in the section below. So, as you can see from the above scenario Grafana will not send out notificatio ns when other series cause the alert to fire if the rule already is in state `Fi ring`. If you want to have alert per series, create a multi dimensional alert ru le as described in the section below.
![Query section classic condition](/img/docs/alerting/unified/rule-edit-classic- 8-0.png 'Query section classic condition screenshot') ![Query section classic condition](/static/img/docs/alerting/unified/rule-edit-c lassic-8-0.png 'Query section classic condition screenshot')
#### Multi dimensional rule #### Multi dimensional rule
You can use reduce and math expressions to create a rule that will create an ale rt per series returned by the query. You can use reduce and math expressions to create a rule that will create an ale rt per series returned by the query.
1. Add one or more queries 1. Add one or more queries
2. Add a `reduce` expression for each query to aggregate values in the selected time range into a single value. With some data sources this is not needed for [r ules using numeric data]({{< relref "../grafana-managed-numeric-rule.md" >}}). 2. Add a `reduce` expression for each query to aggregate values in the selected time range into a single value. With some data sources this is not needed for [r ules using numeric data]({{< relref "../grafana-managed-numeric-rule.md" >}}).
3. Add a `math` expressions with the condition for the rule. Not needed in case a query or a reduce expression already returns 0 if rule should not be firing, o r > 0 if it should be firing. Some examples: `$B > 70` if it should fire in case value of B query/expression is more than 70. `$B < $C * 100` in case it should fire if value of B is less than value of C multiplied by 100. If queries being c ompared have multiple series in their results, series from different queries are matched if they have the same labels or one is a subset of the other. 3. Add a `math` expressions with the condition for the rule. Not needed in case a query or a reduce expression already returns 0 if rule should not be firing, o r > 0 if it should be firing. Some examples: `$B > 70` if it should fire in case value of B query/expression is more than 70. `$B < $C * 100` in case it should fire if value of B is less than value of C multiplied by 100. If queries being c ompared have multiple series in their results, series from different queries are matched if they have the same labels or one is a subset of the other.
See or [expressions documentation]({{< relref "../../../panels/expressions.md" > }}) for in depth explanation of `math` and `reduce` expressions. See or [expressions documentation]({{< relref "../../../panels/expressions.md" > }}) for in depth explanation of `math` and `reduce` expressions.
![Query section multi dimensional](/img/docs/alerting/unified/rule-edit-multi-8- 0.png 'Query section multi dimensional screenshot') ![Query section multi dimensional](/static/img/docs/alerting/unified/rule-edit-m ulti-8-0.png 'Query section multi dimensional screenshot')
### Conditions ### Conditions
- **Condition -** Select the letter of the query or expression whose result wi ll trigger the alert rule. You will likely want to select either a `classic cond ition` or a `math` expression. - **Condition -** Select the letter of the query or expression whose result wi ll trigger the alert rule. You will likely want to select either a `classic cond ition` or a `math` expression.
- **Evaluate every -** How often the rule should be evaluated, executing the d efined queries and expressions. Must be no less than 10 seconds and a multiple o f 10 seconds. Examples: `1m`, `30s` - **Evaluate every -** How often the rule should be evaluated, executing the d efined queries and expressions. Must be no less than 10 seconds and a multiple o f 10 seconds. Examples: `1m`, `30s`
- **Evaluate for -** For how long the selected condition should violated befor e an alert enters `Alerting` state. When condition threshold is violated for the first time, an alert becomes `Pending`. If the **for** time elapses and the con dition is still violated, it becomes `Alerting`. Else it reverts back to `Normal `. - **Evaluate for -** For how long the selected condition should violated befor e an alert enters `Alerting` state. When condition threshold is violated for the first time, an alert becomes `Pending`. If the **for** time elapses and the con dition is still violated, it becomes `Alerting`. Else it reverts back to `Normal `.
#### No Data & Error handling #### No Data & Error handling
Toggle **Configure no data and error handling** switch to configure how the rul e should handle cases where evaluation results in error or returns no data. Toggle **Configure no data and error handling** switch to configure how the rul e should handle cases where evaluation results in error or returns no data.
skipping to change at line 89 skipping to change at line 89
| --------------- | ------------------------------------------------------------ ------------------------------ | | --------------- | ------------------------------------------------------------ ------------------------------ |
| No Data | Set alert state to `NoData` and rule state to `Normal` | | No Data | Set alert state to `NoData` and rule state to `Normal` |
| Alerting | Set alert rule state to `Alerting` | | Alerting | Set alert rule state to `Alerting` |
| Ok | Set alert rule state to `Normal` | | Ok | Set alert rule state to `Normal` |
| Error or timeout option | Description | | Error or timeout option | Description |
| ----------------------- | --------------------------------------------------- | | ----------------------- | --------------------------------------------------- |
| Alerting | Set alert rule state to `Alerting` | | Alerting | Set alert rule state to `Alerting` |
| OK | Set alert rule state to `Normal` | | OK | Set alert rule state to `Normal` |
![Conditions section](/img/docs/alerting/unified/rule-edit-grafana-conditions-8- 0.png 'Conditions section screenshot') ![Conditions section](/static/img/docs/alerting/unified/rule-edit-grafana-condit ions-8-0.png 'Conditions section screenshot')
### Details ### Details
Annotations and labels can be optionally added in the details section. Annotations and labels can be optionally added in the details section.
#### Annotations #### Annotations
Annotations are key and value pairs that provide additional meta information abo ut the alert, for example description, summary, runbook URL. They are displayed in rule and alert details in the UI and can be used in contact type message temp lates. Annotations can also be templated, for example `Instance {{ $labels.insta nce }} down` will have the evaluated `instance` label value added for every aler t this rule produces. Annotations are key and value pairs that provide additional meta information abo ut the alert, for example description, summary, runbook URL. They are displayed in rule and alert details in the UI and can be used in contact type message temp lates. Annotations can also be templated, for example `Instance {{ $labels.insta nce }} down` will have the evaluated `instance` label value added for every aler t this rule produces.
#### Labels #### Labels
Labels are key value pairs that categorize or identify an alert. Labels are use d to match alerts in silences or match and groups alerts in notification policie s. Labels are also shown in rule or alert details in the UI and can be used in c ontact type message templates. For example, it is common to add a `severity` lab el and then configure a separate notification policy for each severity. Or one c ould add a `team` label and configure team specific notification policies, or si lence all alerts for a particular team. Labels can also be templated like annota tions, for example `{{ $labels.namespace }}/{{ $labels.job }}` will produce a ne w rule label that will have the evaluated `namespace` and `job` label value adde d for every alert this rule produces. The rule labels take precedence over the l abels produced by the query/condition. Labels are key value pairs that categorize or identify an alert. Labels are use d to match alerts in silences or match and groups alerts in notification policie s. Labels are also shown in rule or alert details in the UI and can be used in c ontact type message templates. For example, it is common to add a `severity` lab el and then configure a separate notification policy for each severity. Or one c ould add a `team` label and configure team specific notification policies, or si lence all alerts for a particular team. Labels can also be templated like annota tions, for example `{{ $labels.namespace }}/{{ $labels.job }}` will produce a ne w rule label that will have the evaluated `namespace` and `job` label value adde d for every alert this rule produces. The rule labels take precedence over the l abels produced by the query/condition.
![Details section](/img/docs/alerting/unified/rule-edit-details-8-0.png 'Details section screenshot') ![Details section](/static/img/docs/alerting/unified/rule-edit-details-8-0.png ' Details section screenshot')
## Preview alerts ## Preview alerts
To evaluate the rule and see what alerts it would produce, click **Preview alert s**. It will display a list of alerts with state and value for each one. To evaluate the rule and see what alerts it would produce, click **Preview alert s**. It will display a list of alerts with state and value for each one.
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)