New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Making dashboards compatible with grafana-API #834
Comments
@florianmulatz We are working on this area and plan to simplify grafana import for upcoming release. There is a PR open #831 . I don't see the screenshot in your comment above. Could you provide more information about your usecase. We are planning to support below commands. Let us know if your use case is covered. Import: bin/grafana import --addr my.grafana.server:3000 Export: bin/grafana export --addr my.grafana.server:3000 --serverfolder [grafanafoldername] --directory [path] |
@florianmulatz Above mentioned PR is now merged into main. You can give it a try with harvest nightly builds https://github.com/NetApp/harvest/releases/tag/nightly |
Hi @rahulguptajss, first of all the missing screenshots I've created a own label on that within the prometheus configuration for example
|
I'll set up a test-machine where I can try nightly-builds and releases before rolling-out in production - thx for that! |
Latest changes in nightly do not overwrite dashboards if uploaded to a different grafana folder. We are using grafana api's only inside harvest grafana import. Thanks for the screenshot but it is not clear to me the problem statement here. If you could elaborate. |
Hi @rahulguptajss - screenshot does not figure a problem - just wanted to visualize our own changes (I guess it's useless for this thread 😆 ) Thx for your answer regarding the importer - that's what I wanted to have. I'll try this within my testmachine today and give a update if it works (at least for me) |
Hey, unfortunately import does not work
Anyhow I tried to set the uid in the source-json file to "null" as stated in the Grafana-API documentation for importing but - still the same message. BR |
PS: It looks like it has todo with my Grafana-Folder Name which contains a WhiteSpace
I tried renaming my "real" folder to something without white-space and "." - and this worked. Anyhow It does exactly what I was afraid of - on Importing the new-dashboard it overwrites all our own modifications (region variable) and just replace it with the new one. Maybe this is "works as desgined" - I don't know - that's what my first question was targetet on |
Thanks @florianmulatz for the test. Can you try uploading to a different folder to avoid overwriting if that helps? Inside same folder, we want to avoid multiple dashboards with same name. I'll handle white-space or special chars for folder name |
hi @florianmulatz we'll take a look and see how we can improve this. In the case that the dashboard was overwritten, do you see the version tab and can you restore the previous version? |
yes - that works |
hi @florianmulatz here's what we've determined about the Grafana import API - there are lots of permutations :) A combination of a dashboard's uid, dashboard title, folder name and Given the logic described here, and our desire to not overwrite customer dashboard changes when importing, we're going to change Harvest's import logic. When importing, by default, Harvest will use the Grafana API
Does this work for you? |
Of course this will work - but this does not address the main problem (for us) that our own modifications has to be re-done in the replaced / new created dashboard. Maybe there is any chance to diff the files (maybe just for variable adoptions) or something like that? To be honest, I have no reasonable idea myself at the moment how to address this cleanly 😕 |
@florianmulatz yes I wish I had a better answer about diffing. That's something we run into also. Grafana does provide a json diff across different versions of the same dashboard. Not directly applicable to your usecase, but perhaps something we can use in the future. |
I've updated the harvester to 22.02.0 on our test-machine and imported some dashboards for test. Unfortunately, it still overwrites our own changes. |
Example command: Could you provide the commands you have tried for us to take a look. |
Hi @rahulguptajss - I'm confused. The changelog from 22.02.0 states clearly -- bin/grafana cli should not overwrite dashboard changes, .... how is this to understand then? |
yes, that means by default, overwrite will not happen and cli will fail like below. To overwrite
|
hi @florianmulatz with 22.02 your dashboards shouldn't be overwritten. When Harvest calls the Grafana API here it sets Let's see if we can figure out what's different in your environment. When you get a chance, can you paste the Global Flags returned when running?
|
We want to import grafana-dashboards with Grafana own API. Since we make some specific modification on our dashboard (own variables for region like in the screenshot for example) it would be nice to support the own Grafana-API as well.
From my current perspective it should be only needed to add some specific identifiers to get them compatible (importable):
URL
Expected behavior
Grafana Dashboard should be importable via grafana-API
Actual behavior
own modifications to json-files are needed - afterwards dashboard is empty (not sure if this is maybe a self-made error)
The text was updated successfully, but these errors were encountered: