JSON API alert support

Hi,
I’m using grafana in version 8.3.3 and the JSON API plugin in version 1.3.0 (https://grafana.com/grafana/plugins/marcusolsson-json-datasource/) to build dashboards, and now I wanted to add alerts based on the defined thresholds, but from what I’ve seen, this plugin doesn’t support alerts, so I’d like to know if there is any prediction to add this functionality to the JSON API plugin. If not, is there any alternative to get alerts, given that the data is obtained through a rest api?

Thanks

Hi, I’m the author of the JSON API plugin :wave:

I’d love to get around to this, but it’s unfortunately a rather big change that will most likely introduce regressions to the current behavior. I think it’s still worth it and while it’s going to happen at some point, I can’t promise when.

2 Likes

Thanks for the reply, so it’s not possible to trigger an action based on the defined thresholds right? Like, for example, triggering a webhook.

Unfortunately not.

Right now, all requests are made from your browser directly to the REST API. To support alerting, queries need to run on the server so that Grafana can keep running the queries even after you close your browser tab.

Ok thanks a lot for the answers. I will look for an alternative

1 Like

hi @nunorolo, we have the same use case did you by chance find an alternative?

hi @marcusolsson :slight_smile: did you by chance got time to implement this?

The best option for json based alerts is to add the alert code to the API framework that Grafana calls. I use Python code to run Grafana API and injest the alert rules from an external API call. The data is then used to compile a special metric when the rule is fired programmatically. If you still want to use the traditional Grafana Alerting mechanisms, you could send an alert record to Prometheus data source, then have Grafana pick up the alert from there.