2020-07-16 14:09:35 -04:00
---
stage: Monitor
2022-01-27 13:14:37 -05:00
group: Respond
2020-11-26 01:09:20 -05:00
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
2020-07-16 14:09:35 -04:00
---
2021-01-28 01:08:59 -05:00
# Set up alerts for Prometheus metrics **(FREE)**
2020-07-16 14:09:35 -04:00
2021-01-29 19:09:06 -05:00
> [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/42640) to GitLab Free in 12.10.
2020-09-15 20:09:37 -04:00
2020-07-16 14:09:35 -04:00
After [configuring metrics for your CI/CD environment ](index.md ), you can set up
2021-06-18 14:10:13 -04:00
alerting for Prometheus metrics, and
2020-09-07 11:09:04 -04:00
[trigger actions from alerts ](#trigger-actions-from-alerts ) to notify
2020-07-16 14:09:35 -04:00
your team when environment performance falls outside of the boundaries you set.
2021-04-21 20:10:01 -04:00
## Prometheus cluster integrations
Alerts are not currently supported for [Prometheus cluster integrations ](../../user/clusters/integrations.md ).
2022-05-23 11:08:42 -04:00
<!-- - start_remove The following content will be removed on remove_date: '2022 - 09 - 22' -->
2020-07-16 14:09:35 -04:00
2022-05-23 11:08:42 -04:00
## External Prometheus instances (removed)
This feature was [deprecated ](https://gitlab.com/gitlab-org/gitlab/-/issues/219142 ) in GitLab 13.2 and [removed ](https://gitlab.com/gitlab-org/gitlab/-/issues/338834 ) in 15.0.
To manually configure a Prometheus server, we recommend
you use the [generic alerts integration ](../incident_management/integrations.md ).
2020-07-16 14:09:35 -04:00
2022-05-23 11:08:42 -04:00
<!-- - end_remove -->
2020-07-16 14:09:35 -04:00
## Trigger actions from alerts **(ULTIMATE)**
Alerts can be used to trigger actions, like opening an issue automatically
(disabled by default since `13.1` ). To configure the actions:
2021-06-15 14:09:57 -04:00
1. Navigate to your project's **Settings > Monitor > Alerts** .
2020-07-16 14:09:35 -04:00
1. Enable the option to create issues.
1. Choose the [issue template ](../../user/project/description_templates.md ) to create the issue from.
1. Optionally, select whether to send an email notification to the developers of the project.
2022-05-26 14:08:09 -04:00
1. Select **Save changes** .
2020-07-16 14:09:35 -04:00
After enabling, GitLab automatically opens an issue when an alert is triggered containing
2020-07-30 11:09:40 -04:00
values extracted from the [`alerts` field in webhook payload ](https://prometheus.io/docs/alerting/latest/configuration/#webhook_config ):
2020-07-16 14:09:35 -04:00
- Issue author: `GitLab Alert Bot`
2020-07-30 11:09:40 -04:00
- Issue title: Extracted from the alert payload fields `annotations/title` , `annotations/summary` , or `labels/alertname` .
2021-01-25 13:09:03 -05:00
- Issue description: Extracted from alert payload field `annotations/description` .
2020-07-30 11:09:40 -04:00
- Alert `Summary` : A list of properties from the alert's payload.
- `starts_at` : Alert start time from the payload's `startsAt` field
- `full_query` : Alert query extracted from the payload's `generatorURL` field
2020-07-16 14:09:35 -04:00
- Optional list of attached annotations extracted from `annotations/*`
2022-04-13 20:08:35 -04:00
- Alert [GLFM ](../../user/markdown.md ): GitLab Flavored Markdown from the payload's `annotations/gitlab_incident_markdown` field.
2021-10-01 17:11:37 -04:00
- Alert Severity ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50871) in GitLab version 13.9):
2021-02-10 10:11:19 -05:00
Extracted from the alert payload field `labels/severity` . Maps case-insensitive
value to [Alert's severity ](../incident_management/alerts.md#alert-severity ):
- **Critical**: `critical` , `s1` , `p1` , `emergency` , `fatal` , or any value not in this list
- **High**: `high` , `s2` , `p2` , `major` , `page`
- **Medium**: `medium` , `s3` , `p3` , `error` , `alert`
- **Low**: `low` , `s4` , `p4` , `warn` , `warning`
- **Info**: `info` , `s5` , `p5` , `debug` , `information` , `notice`
2020-07-16 14:09:35 -04:00
To further customize the issue, you can add labels, mentions, or any other supported
[quick action ](../../user/project/quick_actions.md ) in the selected issue template,
which applies to all incidents. To limit quick actions or other information to
only specific types of alerts, use the `annotations/gitlab_incident_markdown` field.
Since [version 12.2 ](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/63373 ),
GitLab tags each incident issue with the `incident` label automatically. If the label
does not yet exist, it is also created automatically.
If the metric exceeds the threshold of the alert for over 5 minutes, GitLab sends
2022-01-30 19:14:49 -05:00
an email to all Maintainers and Owners of the project.
2021-05-05 14:10:31 -04:00
### Recovery alerts
2021-10-01 17:11:37 -04:00
> [From GitLab 12.5](https://gitlab.com/gitlab-org/gitlab/-/issues/13401), when GitLab receives a recovery alert, it automatically closes the associated issue.
2021-05-05 14:10:31 -04:00
The alert in GitLab will be automatically resolved when Prometheus
sends a payload with the field `status` set to `resolved` .
You can also configure the associated [incident to be closed automatically ](../incident_management/incidents.md#automatically-close-incidents-via-recovery-alerts ) when the alert resolves.