oncall icon indicating copy to clipboard operation
oncall copied to clipboard

Ability to create an Alert Groups via the public API

Open njohnstone2 opened this issue 2 years ago • 3 comments

What would you like to see!

According to the docs only get and delete are supported for alert groups. It would be really useful to be able to create an ad hoc alert group via the API. This functionality is currently supported in the UI and slack slash commands.

My use case is that I have application code that runs in response to events in my cloud account. I'd like the ability to trigger oncall alerts when these events occur.

example payload being used by the UI (internal API)

{
  "team": "<TEAM_ID>",
  "title": "my test alert",
  "message": "testing manually created alerts",
  "users": [],
  "schedules": [
    {
      "important": false,
      "id": "<SCHEDULE_ID>"
    }
  ]
}

Product Area

Alert Flow & Configuration

Anything else to add?

Workaround

My current work around is to publish these events as a metric which can be used in an alerting rule. This works for triggering the alert but due to the nature of events (firing then shortly after returning to 0) the alert will quickly return to a healthy state without necessarily being acknowledged by the person oncall.

njohnstone2 avatar Aug 07 '23 22:08 njohnstone2

The current version of Grafana OnCall, at the time this issue was opened, is v1.3.22. If your issue pertains to an older version of Grafana OnCall, please be sure to list it in the PR description. Thank you :smile:!

github-actions[bot] avatar Aug 07 '23 22:08 github-actions[bot]

This turned out to be user error. In this case, alerts should be created using the inbound webhook/formatted webhook integrations.

Is it worth mentioning this integration on the HTTP API docs? As i was clearly looking in the wrong place.

njohnstone2 avatar Aug 13 '23 21:08 njohnstone2

It might still be nice to be able to create alert groups via the API. As noted in #3912, submitting via an inbound webhook has some limitations.

mjs avatar Feb 19 '24 01:02 mjs