I see two alert managers when creating a Contact point on Grafana Cloud:
and when I create a Slack contact point with grafanacloud-company-ngalertmanager, I receive the alerts (through default integration rules) as follows:
However, when I create a copy of the rule with Grafana alert manager, the alert is as follows:
Is there a way to display the Slack notifications from predefined rules similar to the ones I create myself, so that I don’t need to create every rule again?
The notification templates in Grafana Alerting were mostly derived from the previous version of alerting and they are different than the default templates in cloud Alertmanager. We are working on unifying those formats.
However, currently this is hard or even not possible to make the notification look the same way it is sent from Alertmanager.
You can use
grafanacloud-company-ngalertmanager for Grafana Alerts.
To do so, you first need to add a new Alertmanager data source (because existing one is provisioned and cannot be changed), and enable the switch “Receive Grafana Alerts”. You can get credentials from your Grafana.com account.
Then you need to go to Admin page in Alerting module and switch to “External only”. After that Grafana will start sending alerts to the external alertmanager where you can manage templates.
Thanks. I am confused about two things:
- What would the URL be for the external Alertmanager?
- Do I send the API Key in Authorization: Bearer xxx header?
If you create API key from this page
then you need to use basic authentication and use user ID to as username.
As for URL, use URL provided in settings page, besides the user\password. In my case this is https://alertmanager-us-central.grafana.net but in your case it could be different.
Thanks, I made it work, added Slack to the newly created Alert Manager as the Contact Point, however, I receive a very similar alert to the one with grafanacloud-company-ngalertmanager. Not like the one I receive with Grafana Alert manager:
Oh, I did not understand which format you wanted to keep. To replicate Grafana’s format in the notification you can use template defined in Grafana alerting https://github.com/grafana/alerting/blob/bd8ae70f074acfc7c7cb47741b0aeaeb697007a4/templates/default_template.go#L37 the default message template for slack is
default.message. You can copy it to Cloud alertmanager and add it as custom template file and then update slack integration to use this template in the message format field.