Creating an alert for Json data format

Hi,

I have an API and returning JSON data format. Currently, I can display all data in a table on the Grafana panel.

But, I can not create an alert for JSON data format. Is this possible?
I read from somewhere and the article was saying, we can create alerts only for Time-series panels. If its true, then what is the data format for the Time-series. My API should return what kind of data.

Thanks for any help.

Does your data include a timestamp? Can you share a sample of your JSON? Then the community might have more specific tips :+1:

1 Like

Yes, it has timestamp. I am sharing the table view

Also, this is the API response.

When I try to create an alert, I am receiving the below error

Is this case been resolved? I’m now working with the same to create an alert from Infinity data source (JSON).

Use latest version of infinity with backend parser. For the alerts to work, it needed backend support

Hi @yesoreyeram

Is it possible for one to use Backend Parser to create an alert where the JSON looks like as shown below, and we can alert on status being down? I tried the usual Value Mappings features of Grafana which works fine for converting up to 1 and down to 0, but only dashboards, not for alerts.

In other words, if we use Backend Parser for alerting (which we must), and we must alert on numerical data, what’s the trick to converting Up to 1 and Down to 0?

{
"app_name": "orange-backend-production",
"githash": "194ed36fa16b7b7f843a5ff3cde55cd9",
"released_at": "2024-04-22T02:12:36Z",
"version": "v30102",
"status": "up"
}
1 Like

You can use the backend parser and jsonata

when you have array of data you can use something like below

$map($, function($v){
  return { 
     "app_name"   : $v.app_name , 
     "up"         : $v.status = 'up' ? 1 : 0
  }
})
1 Like

Hi @yesoreyeram,

In this case, is it possible to find a solution or a trick for setting up an alert, which detects a version change as an update? For example, v30102 → v30103

No. Tracking the values / comparing with previous values is not possible. The data is stateless and it will be fresh set of data on refresh.