Closed techuser12345 closed 2 months ago
Library panels are just weird in Grafana. I went down the rabbit hole when I was working on the feature, but let me see if I can remember.
The main thing is that you can't import a dashboard into Grafana prior to the library component existing. So once you have a library components in your staging ENV, you pull it down, pull the associated dashboards and then export them out to production.
You just can't upload a dashboard while the library component doesn't exist, and you can't delete a library component while a dashboard references it.
I have a test for that, so my first step is:
gdg b libraryelements upload
out:
2024-08-15 18:43:33 INF Reading files from folder folder=test/data/org_main-org/libraryelements
┌────────────────────────────────────────────────────────────────┐
│ NAME │
├────────────────────────────────────────────────────────────────┤
│ Dashboard Makeover - Extra Cleaning Duty Assignment Today │
│ Dashboard Makeover - Lighting Status │
│ Dashboard Makeover - Side Dish Prep Times, past 7 days │
│ Dashboard Makeover - Time since we purchased these spices │
│ Extreme Dashboard Makeover - Grill │
│ Extreme Dashboard Makeover - Mac Oven │
│ Extreme Dashboard Makeover - Refrigerator Temperature (F) │
│ Extreme Dashboard Makeover - Room Temperature (F) │
│ Extreme Dashboard Makeover - Salmon Cooking Times, past 7 days │
└────────────────────────────────────────────────────────────────┘
Then you can List the dashboards that have a connection with the given panel ID: (Latest release has a bug with this though I can push a small patch soon ).
./bin/gdg b libraryelements list-connections T47RSwQnz
The T47...etc is the library panel ID.
2024-08-15 18:52:09 INF Running Sanity Check of Organization Membership
2024-08-15 18:52:09 INF Listing library connections for context context=testing
┌────┬───────────┬──────────────────────────────┬──────────────────────────────┬────────┐
│ ID │ UID │ SLUG │ TITLE │ FOLDER │
├────┼───────────┼──────────────────────────────┼──────────────────────────────┼────────┤
│ 12 │ F3eInwQ7z │ dashboard-makeover-challenge │ Dashboard Makeover Challenge │ Other │
└────┴───────────┴──────────────────────────────┴──────────────────────────────┴────────┘
If you look at the JSON for the dashboard you'll see that the UID for the libarary panel matches:
"libraryPanel": {
"description": "",
"meta": {
"connectedDashboards": 3,
"created": "2022-04-27T21:27:23Z",
"createdBy": {
"avatarUrl": "/avatar/579fc54abdc9ab34fb4865322f2870a1",
"id": 13,
"name": "mike.johnson@grafana.com"
},
"folderName": "mj",
"folderUid": "R0bMCcW7z",
"updated": "2022-04-27T21:29:50Z",
"updatedBy": {
"avatarUrl": "/avatar/579fc54abdc9ab34fb4865322f2870a1",
"id": 13,
"name": "mike.johnson@grafana.com"
}
},
"name": "Dashboard Makeover - Extra Cleaning Duty Assignment Today",
"type": "table",
"uid": "T47RSwQnz",
"version": 2
},
To create this in production, you just need to.
https://github.com/esnet/gdg/pull/283 Fixes the listing issue.
Describe the bug I use GDG to export the dashboard and push dashboard .json files to stash under: grafana/dashboards/folders/.json I put those *.json files in prod as grafana provisioning. I also have datasource.yml I notice "Panel plugin not found: Unable to load library panel: XXXXXX-XXXXXX-XXXXX" error in prod.
I went through this document https://software.es.net/gdg/docs/tutorials/working-with-library-panels/ You have listed rules. But the solution is not clear. Are you suggesting this is the workaround/solution we should use 'The only way I can see to move a lib element is to unlink the panel, delete the panel and re-create it in a different folder, then re-link it.' If so the steps mentioned below or the order do not match the statement.
I would like to know how to make library panel work in prod environment using provisioning and gdg is there a way where we can make it available please?
To Reproduce Steps to reproduce the behavior:
Expected behavior Step-by-step instruction how to export library panels from UAT and make them available in prod - achievable via automation (bash script) not manual GUI steps ,as there will be several library panels linked to different dashboards (one to many relationships).
Desktop (please complete the following information):
Additional context