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?
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.
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.
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.