Every time we add a new producer to our system we manually need to add a new query for the associated panels in our Grafana dashboard to make the panel display a separate graph for the data coming from the new producer. With the number of producers growing this is tedious. Therefore the question whether there is some way in the Grafana API to add a query to an existing panel programmatically.
Asked
Active
Viewed 705 times
1
-
I would write generic query, which will return data aggregated per producer. Check used TSDB how to do that. – Jan Garaj Jul 12 '22 at 16:32
-
Did you manage to find a solution? – Andrew Paul Dec 19 '22 at 17:23
1 Answers
2
One way (and maybe the only way) to do this is by creating/changing the dashboard JSON programmatically and updating the dashboard using the Dashboard HTTP API.
Basically you define a base dashboard and figure out how that JSON has to be modified every time a new producer is added (like changing a query, adding a panel, ...). Then you perform that action every time a new producer is added. Then you overwrite the existing dashboard with the new version via the API.

dnnshssm
- 1,057
- 6
- 17