Can alerts be added to a Grafana Panel on a dashboard using API?

838 Views Asked by At

There is a Grafana dashboard with a panel inside it. Is it possible to add (or define) an API?

1

There are 1 best solutions below

0
On

To create new alerts or modify them you need to update the dashboard json that contains the alerts. Use dashboard API and edit particular panel alert section. You need to define an alert there. For example:

  "alert": {
    "conditions": [
      {
        "type": "query",
        "query": {
          "params": [
            "A",
            "5m",
            "now"
          ]
        },
        "reducer": {
          "type": "avg",
          "params": []
        },
        "evaluator": {
          "type": "gt",
          "params": [
            null
          ]
        },
        "operator": {
          "type": "and"
        }
      }
    ],