From 52f6f69d4be7ec64f58bdc420b7e6fa3e094f577 Mon Sep 17 00:00:00 2001 From: brendamuir <100768211+brendamuir@users.noreply.github.com> Date: Tue, 26 Nov 2024 19:20:55 +0100 Subject: [PATCH] Alerting docs: adds new export alert rule definition (#97028) * Alerting docs: adds new export alert rule definition * update * Update button text for exporting new rule definition * Update docs/sources/alerting/set-up/provision-alerting-resources/export-alerting-resources/index.md Co-authored-by: Sonia Aguilar <33540275+soniaAguilarPeiron@users.noreply.github.com> * Update docs/sources/alerting/set-up/provision-alerting-resources/export-alerting-resources/index.md Co-authored-by: Sonia Aguilar <33540275+soniaAguilarPeiron@users.noreply.github.com> * definition * type * definition 2 * pepes feedback * removes will --------- Co-authored-by: Sonia Aguilar Co-authored-by: Sonia Aguilar <33540275+soniaAguilarPeiron@users.noreply.github.com> --- .../export-alerting-resources/index.md | 25 ++++++++++++++++--- .../unified/rule-list/RuleList.v1.tsx | 2 +- public/locales/en-US/grafana.json | 2 +- public/locales/pseudo-LOCALE/grafana.json | 2 +- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/docs/sources/alerting/set-up/provision-alerting-resources/export-alerting-resources/index.md b/docs/sources/alerting/set-up/provision-alerting-resources/export-alerting-resources/index.md index b5e58fe3eab..3a6f3576452 100644 --- a/docs/sources/alerting/set-up/provision-alerting-resources/export-alerting-resources/index.md +++ b/docs/sources/alerting/set-up/provision-alerting-resources/export-alerting-resources/index.md @@ -153,6 +153,23 @@ To export a modified alert rule without saving the modifications, complete the f 1. Click **Copy Code** or **Download**. +### Export a new alert rule definition without saving changes + +{{% admonition type="note" %}} You can only export in Terraform (HCL) format. {{% /admonition %}} + +Add a new alert rule definition to an existing provisioned rule group rather than creating the code manually. You can then copy it to your Terraform pipeline, and quickly deploy and manage alert rules as part of your infrastructure as code. + +An alert rule definition differs from an alert rule in the sense that you define your alert rule, but you do not save it. It only becomes a saved alert rule once you provision it using Terraform. + +To export your alert rule definition into Terraform (HCL) format, complete the following steps. + +1. Click **Alerts & IRM** -> **Alert rules**. +2. Click **Export rule definition**. +3. Fill out the alert rule details. +4. Choose a provisioned folder and group to add your alert rule definition to. +5. Click **Export**. +6. Copy and paste the code into your Terraform pipeline to create your new alert rule. + ### Export contact points To export contact points from the Grafana UI, complete the following steps. @@ -182,19 +199,19 @@ All notification policies are provisioned through a single resource: the root of {{% admonition type="warning" %}} -Since the policy tree is a single resource, provisioning it will overwrite a policy tree created through any other means. +Since the policy tree is a single resource, provisioning it overwrites a policy tree created through any other means. {{< /admonition >}} To export the notification policy tree from the Grafana UI, complete the following steps. 1. Click **Alerts & IRM** -> **Notification policies**. -1. In the **Default notification policy** section, click **...** -> **Export**. -1. Choose the format to export in. +2. In the **Default notification policy** section, click **...** -> **Export**. +3. Choose the format to export in. The exported contact point appears in different formats - YAML, JSON, Terraform. -1. Click **Copy Code** or **Download**. +4. Click **Copy Code** or **Download**. ### Export mute timings diff --git a/public/app/features/alerting/unified/rule-list/RuleList.v1.tsx b/public/app/features/alerting/unified/rule-list/RuleList.v1.tsx index f09745074e4..1180a01545d 100644 --- a/public/app/features/alerting/unified/rule-list/RuleList.v1.tsx +++ b/public/app/features/alerting/unified/rule-list/RuleList.v1.tsx @@ -194,7 +194,7 @@ function ExportNewRuleButton() { tooltip="Export new grafana rule" onClick={() => logInfo(LogMessages.exportNewGrafanaRule)} > - Export new alert rule + Export rule definition ); } diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json index f9d43626348..919d3af863d 100644 --- a/public/locales/en-US/grafana.json +++ b/public/locales/en-US/grafana.json @@ -307,7 +307,7 @@ "title": "Data source-managed" }, "grafanaManaged": { - "export-new-rule": "Export new alert rule", + "export-new-rule": "Export rule definition", "export-rules": "Export rules", "loading": "Loading...", "new-recording-rule": "New recording rule", diff --git a/public/locales/pseudo-LOCALE/grafana.json b/public/locales/pseudo-LOCALE/grafana.json index ef7d1e95cf8..bf2ea270830 100644 --- a/public/locales/pseudo-LOCALE/grafana.json +++ b/public/locales/pseudo-LOCALE/grafana.json @@ -307,7 +307,7 @@ "title": "Đäŧä şőūřčę-mäʼnäģęđ" }, "grafanaManaged": { - "export-new-rule": "Ēχpőřŧ ʼnęŵ äľęřŧ řūľę", + "export-new-rule": "Ēχpőřŧ řūľę đęƒįʼnįŧįőʼn", "export-rules": "Ēχpőřŧ řūľęş", "loading": "Ŀőäđįʼnģ...", "new-recording-rule": "Ńęŵ řęčőřđįʼnģ řūľę",