How to Check if a Particular Panel Has Data Using HTTP API and Handle Dependent Variables?

Hi All,

I have a requirement where I need to determine if a particular panel has data using an HTTP API request. Here’s the scenario:

  1. Panel Query Setup:
  • The backend query for the panel uses multiple global variables.
  • I can provide the value of the main variable as input, but the remaining variables are dependent on the value of the main variable or other variables.
  1. Challenges:
  • I need to find and resolve the values of all the dependent variables dynamically.
  • Once I have the resolved query with all the variables substituted, I need to execute it (using an HTTP API) to check if the query returns data.
  1. Questions:
  • How can I programmatically fetch the values of all the dependent variables from Grafana using the HTTP API?
  • If I pass the main variables in an HTTP request, is it possible to get the panel JSON file with the variables replaced by their resolved values?
  • What’s the best way to execute the panel query with resolved variables via the API to check if data exists?

Any suggestions, best practices, or examples for handling this use case would be greatly appreciated.

Thanks in advance for your help!

Hello @asuwini

Are you comfortable with JavaScript

Yes @yosiasz

Look at Business Text and Business Chart plugins.

You can do all the vetting you need in js before making the final call to fetch your data via http

@yosiasz

Understood, But I am looking for the existing dashboards that have timeseries, tables and stats visualization plugins and multiple variables which are dependent on each other.

Is that possible to check the Data using HTTP API request from out of grafana?

What is the fun of using existing dashboard which you will have to customize anyways as your unique environment is totally different than others when you can build it yourself