Learn about Grafana the monitoring solution for every database. Open Source is at the heart of what we do at Grafana Labs.
The identifier id of a dashboard is an auto-incrementing numeric value and is only unique per Grafana install. The unique identifier uid of a dashboard can be used for uniquely identify a dashboard between multiple Grafana installs. The uid allows having consistent URLs for accessing dashboards and when syncing dashboards between multiple Grafana installs, see dashboard provisioning for more information. This means that changing the title of a dashboard will not break any bookmarked links to that dashboard.
The status code is used for explaining that you cannot create the dashboard and why. There can be different reasons for this:. In case of title already exists the status property will be name-exists.
Deprecated starting from Grafana v5. Please update to use the new Get dashboard by uid resource instead. Will return the dashboard given the dashboard slug. Slug is the URL friendly version of the dashboard title. If there exists multiple dashboards with the same slug, one of them will be returned in the response. Please update to use the Delete dashboard by uid resource instead. Will delete the dashboard given the specified slug. The status code is used when there exists multiple dashboards with the same slug.
Within the container the grafana user is always going to bewhen you pass the --user parameter that just means that grafana-server will be run as that user id, which is why the database file is created with the uid.
The reason for specifying the user that grafana-server should run as is so that it can use the same uid that you want the mounted files to be owned as. What I mean is, support the host persistent directory has been set to then using the --user option sets the database accordingly, but the plugins dir remains de default uid This gives errors while creating or modifying it.
DanCechcurrently I am not at home to try it out, but when I do I will do some tests regarding persistence. Before I faced issues regarding permissions. Maybe they are solved knowing a little more about uid and how grafana deals with it. Skip to content. This repository has been archived by the owner.
It is now read-only. Dismiss Join GitHub today GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. Sign up. Copy link Quote reply. This comment has been minimized. Sign in to view. That is how it's supposed to work. Or do I miss something here, please suggest which steps to take. RaymondMouthaan closed this May 1, Sign up for free to subscribe to this conversation on GitHub.
Already have an account? Sign in. Linked pull requests. You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window.GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community. Already on GitHub? Sign in to your account. There seems to be a issue with getting the Dashboards into the right folders, if the folder exists and is the same id it will work fine.
This makes it difficult to make sure that dashboards being imported go in the correct folder. There is a uid field on the folder, why not link it like that? If possible I would suggest you to use the provisioning feature which has support for placing dashboards in correct folder between environment.
On a second thought the folder id is not part of the dashboard json model today. Not sure what you're feature request actually is - to be able to import to a certain folder? In the 'meta' of a exported dashboard json, there is the folderId, You can also add folderId outside of the. The problem is that when importing a folder via the http API, it doesn't retain it's id, and therefore becomes out of sync and requires manual intervention Fails to actually import the dashboard.
The proposed solution would be to change the way dashboards are linked to folders to use the folders uid which is already present as this folder would be a direct import from another grafana, thus allowing persistent imports without manual intervention to reFolder dashboards. Nothing stopping you from looking up the folder by id when exporting a dashboard and saving a temporary reference, then when creating the folder in new environment add mapping of the temporary reference and change the folder id before importing a dashboard to put in the correct folder.
I would recommend the provisioning feature if you want to do as little manual intervention as possible. I would keep this open for a while and see if it gets upvotes, then maybe we consider this feature. Hi, I have the same need I'm using Terraform with the Grafana provider to import my dashboards.
I would also like to specify the UID for the folder when provisioning dashboards. I feel this would help, as when Grafana is deployed as a stateless service, links to individual folders will still be preserved, ie:. As when redeploying Grafana, even though the UID's of the Dashboards remain, the UID of the folder is always dynamically created, so breaks any existing links used. PaulW could you please open a separate feature request for that.
Subscribe to RSS
Parking my name here. Might take a look at this once all of my other pull requests have been resolved Dealing with the same issue, is there any intention to add this feature? Seems like a serious design flaw in the API, or a detail that must have been overlooked. Why on earth would you decide NOT to use the UID to specify a folder, and instead bind folder mapping to an ID that can't be user-modified or supplied?
Provisioning the dashboards is not a blanket solution; it simply won't work in our use case as we use provisioned dashboards for a specific use case. I spent a few days writing a tool for this and now my work is wasted because I overlooked the folder UID issue. I've checked and there's not a single tool available to manage this process.Learn about Grafana the monitoring solution for every database.
Open Source is at the heart of what we do at Grafana Labs. Dashboard metadata includes dashboard properties, metadata from panels, template variables, panel queries, etc.
When a user creates a new dashboard, a new dashboard JSON object is initialized with the following fields:. Note: In the following JSON, id is shown as null which is the default value assigned to it until a dashboard is saved. Once a dashboard is saved, an integer value is assigned to the id field. Panels are the building blocks of a dashboard. It consists of data source queries, type of graphs, aliases, etc.
Most of the fields are common for all panels but some fields depend on the panel type. Following is an example of panel JSON of a text panel. The templating field contains an array of template variables with their saved values along with some other metadata, for example:. Grafana Cloud. Terms of Service. Trademark Policy. Grafana Features Contribute Dashboards Plugins.
In v5. This will make GitOps more natural as data sources and dashboards can be defined via files that can be version controlled. We hope to extend this system to later add support for users, orgs and alerts as well.
Dashboard Permissions API
Check out the configuration page for more information on what you can configure in grafana. This path is specified in the Grafana init. It is possible to use environment variable interpolation in all 3 provisioning config types. It is not available in the dashboards definition files just the dashboard provisioning configuration. Therefore, we heavily relay on the expertise of the community. Each config file can contain a list of datasources that will be added or updated during start up.
If the datasource already exists, Grafana will update it to match the configuration file. The config file can also contain a list of datasources that should be deleted. That list is called deleteDatasources. If you are running multiple instances of Grafana you might run into problems if they have different versions of the datasource.
The best way to solve this problem is to add a version number to each datasource in the configuration and increase it when you update the config. Grafana will only update datasources with the same or lower version number than specified in the config. That way, old configs cannot overwrite newer configs if they restart at the same time.
I need to create a dev dashboard very similar to an existing prod one, and was wondering if there was an easy way of copying the existing dashboard. Any help would be greatly appreciated! Yes you can duplicate a dashboard. Just save it with a different name.
Click on the save icon change the name and it will be saved with a new name the old one will still exist. I ended up doing this by exporting the existing dashboard, re-importing it, making my changes, and then saving it with a different title. Learn more. Is it possible to duplicate a dashboard in grafana? Ask Question. Asked 5 years, 5 months ago. Active 11 months ago. Viewed 39k times. Active Oldest Votes.Install and Configure Grafana
New versions got a "Save As Julien Roncaglia Julien Roncaglia Click the Dashboard name, click the gear, and do a save as. Careful, it seems like the original dashboard is overwritten, if you import an already existing dashboard. You have to change the uid in the json to avoid this. Such a bad design from Grafana imo. Torkel Torkel 3, 16 16 silver badges 16 16 bronze badges. It works! Stores a new identical dashboard under new name. Santiago Nov 17 '18 at Settings view:.
This works fine for me. Prior dashboard still exists, new one is saved with new name. Nks Nks 31 1 1 bronze badge. This should be a comment, not an answer. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Featured on Meta.GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community. Already on GitHub? Sign in to your account. Which issue s this PR fixes : Fixes With this draft request I guess I'm looking for 1 confirmation that I'm headed in the right direction and 2 suggestions on anything I have not thought of. Thanks for the PR swtch1 I have some comments and on some things I will need another opinion so bear with us a little longer :.
I think it would be better to just return the error here. There is high chance there will also be some other issue if the version is not right so better to fail early rather than later. Changed logging from warn to error and return the error. I will need to fix broken tests because of this. Looking at the code more closely I see that this was my mistake. Version 0 of the config does not specify it explicitly so it will always error.
That is why it was ignored before, not having a version means it was default version 0. Returning the error breaks it for all old configs. I will add a comment there why the handling is as it is. Seems like this will mean the Uid will not be updatable. This is bit different to how other dashboards work, where you can update them. Basically if anybody wanted to start using it they would have to delete the old folders and reprovision or change the title to seem like a new folder.
Otherwise it seems it would need a bit of refactoring of how we handle the folders as that is how folders work so far. Ah I see it is also mentioned in the description. I assume it is ok now and will need to remember that and maybe refactor later. Especially considering which adds reloading API for the config files. I wanted to add this originally, but I agree some refactoring is necessary since changing many of the other fields break the DB.
This decision is up to you guys, but I agree, perhaps belongs in a separate refactoring change since this is not explicitly changing that behavior.
In this function we have sanityChecker code that checks for duplicate UIDs in dashboards. I think it would be good idea to have that also for folders. It needs to be lifted though probably into configReader.
Also it seems it would be a bit more work to add those as we do not store information about provisioning with folders in the same way as with dashboards. So for now I assume it is ok at the moment and we will have to think about some refactoring later on to align the functionality a bit.
I dont think it should be possible to update the UID of a folder or a dashboard. If it's possible that's a bug. We could track missing folder UID's in provisioning and there for support removing folders with the missing and add with the current which would behave like an update.
But I think we can do that in another PR if it becomes a problem. Or do we think updating folder uid's is a common use case? For dashboards through the raw json edit for folders probably just through direct API call as there does not seem to be UI for that. So if we want to disable this it will be a bit of work and other PR from this as you say. For my use case, I will be using the local DB in a container and hydrating everything with configs, which is why I need to be able to define folder UID.
I don't personally see a use case for updating if you can define it at creation time or in a file, and even if you did want that I don't think it would make sense to update UIDs which are defined in a file.