Configure Grafana Cloud Knowledge Graph notifications
This topic describes how to configure knowledge graph notifications so that you can link back to RCA workbench from SLO and knowledge graph notification alerts.
For more information about how knowledge graph notification alerts work, refer to How notifications work in Grafana Cloud Knowledge Graph.
Note
If you use the mimirtool for syncing rule group state, this can cause unauthorized errors because the knowledge graph was enabled. Errors occur because the knowledge graph rules are stored in a protected namespace that our users can’t change.
Before you instruct mimirtool to ignore the knowledge graph namespace, disable the knowledge graph. After you have set up ignoring the namespace with mimirtool, re-enable the knowledge graph.
Before you begin
Before you configure Grafana Cloud Knowledge Graph notifications, ensure that you have configured a contact point.
Note
Knowledge graph notifications are only supported with the Prometheus Alertmanager and not the Grafana Alertmanager.
Configure SLO alerts
If you are managing SLOs from the knowledge graph, you must create a notification policy and configure an Alertmanager template.
Create a notification policy
To create a notification policy, complete the following steps:
In the left-side menu, click Alerts & IRM > Alerting > Notification policies.
From the Choose Alertmanager drop-down menu, select the Prometheus Alertmanager.
By default, the Grafana Alertmanager is selected.
Click +New child policy from the default policy.
In the Matching labels section, add the following labels and values:
Label Operator Value grafana_slo_provenance=assertsgrafana_slo_severity=criticalIn the Contact point drop-down menu, select the contact point to send notifications to.
Select the
Override groupingtoggle.Select or enter the following Group by values:
alertnameasserts_envnamespace
Click Save policy.
Configure Alertmanager template
If the knowledge graph manages your SLO, you can link back to RCA workbench by modifying an existing Alertmanager template.
Modify Alertmanager template
You can modify your existing Alertmanager template to include a URL that links back to RCA workbench.
The following code snippet shows how to modify a Slack template:
{{- if eq .CommonLabels.grafana_slo_provenance "asserts" }}
:fire: *<INSTANCE_URL/a/grafana-asserts-app/assertions?env[0]={{ .CommonLabels.asserts_env }}{{ with .CommonLabels.asserts_site }}&site[0]={{ . }}{{ end }}&grafana_slo_uuid={{ .CommonLabels.grafana_slo_uuid }}&start={{(index .Alerts 0).StartsAt.Unix}}000-30m&end={{(index .Alerts 0).StartsAt.Unix}}000%2B30m|Asserts RCA workbench>*
{{- end }}Where INSTANCE_URL is the URL of the instance the knowledge graph is running, for example:
https://acme.grafana.netConfigure notification alerts
The knowledge graph also lets you to create notifications from assertions. For more information about how notification alerts work, refer to How notifications work in Grafana Cloud Knowledge Graph.
To configure a knowledge graph notification alert, you must create a notification policy and configure an Alertmanager template.
Create a notification policy
To create a notification policy, complete the following steps:
In the left-side menu, click Alerts & IRM > Alerting > Notification policies.
From the Choose Alertmanager drop-down menu, select the Prometheus Alertmanager.
By default, the Grafana Alertmanager is selected.
Click +New child policy from the default policy.
In the Matching labels section, add the following labels and values:
Label Operator Value asserts_alert_category=~.+alertname=NOTIFICATION_ALERTSIn the Contact point drop-down, select the contact point to send notifications to.
Select the
Override groupingtoggle.Select or enter the following Group by values:
alertnameasserts_envasserts_notification_rule_namenamespacesource_alertname
Click Save policy.
Note
For notification alerts, the
alertnamelabel is alwaysNOTIFICATION_ALERTS. To get the original/actualalertname, usesource_alertname.
Configure Alertmanager template
When using knowledge graph notifications, you can link back to RCA workbench by modifying an existing Alertmanager template.
Modify Alertmanager template
You can modify your existing Alertmanager template to include a URL that links back to RCA workbench.
The following code snippet shows how to modify a Slack template:
{{- if eq .GroupLabels.alertname "NOTIFICATION_ALERTS" }}
{{- $url := "INSTANCE_URL/a/grafana-asserts-app/alert-affected-entity?" }}
{{- range $key, $value := (index .Alerts 0).Labels }}
{{- $url = printf "%s%s=%s&" $url ($key | urlquery) ($value | urlquery) }}
{{- end }}
{{- $start := (index .Alerts 0).StartsAt.Unix}}
{{- $url = printf "%salert_start_time=%d000-30m&alert_end_time=%d000%%2B30m" $url $start $start }}
:fire: *<{{ $url }}|Asserts RCA Workbench>*
{{- end }}Where INSTANCE_URL is the URL of the instance the knowledge graph is running, for example:
https://acme.grafana.netManage notification alerts using Terraform
You can also manage notification alerts configurations using Terraform for infrastructure as code workflows. This enables version control, automated deployments, and consistent configuration across environments.
For information about managing notification alerts with Terraform, refer to Configure notification alerts using Terraform.



