-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update grafana dashboards and add backup instructions
Resolves #3 by removing severity filters from Grafana dashboards. Changes made: - Added backing up instructions under `docs/DASHBOARD_EXPORT_GUIDE.md` - Updated submodules to latest version. - Updated dashboards in provisioning to align with production state. - Adapted Grafana version in Dockerfile for consistent local testing. - Use aliased index in datasource provisioning (see SRGSSR/pillarbox-monitoring-transfer#16)
- Loading branch information
Showing
12 changed files
with
539 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Grafana Dashboard Export Guide | ||
|
||
This guide provides a method to export all dashboards within a specified folder in Grafana into a | ||
single zip file, containing individual JSON files for each dashboard. | ||
|
||
## Steps | ||
|
||
### 1. Open the Browser Console | ||
|
||
- Open your Grafana instance and log in if prompted by SSO. | ||
- Press **F12** (or right-click and select **Inspect**) to open Developer Tools. | ||
- Navigate to the **Console** tab. | ||
|
||
### 2. Load JSZip Library | ||
|
||
- To manage multiple files in a zip, we’ll use the [JSZip library](https://stuk.github.io/jszip/). | ||
Copy and paste the following code into the console and press **Enter**: | ||
|
||
```javascript | ||
var script = document.createElement('script'); | ||
script.src = 'https://cdn.jsdelivr.net/npm/[email protected]/dist/jszip.min.js'; | ||
document.head.appendChild(script); | ||
``` | ||
|
||
- Verify that JSZip is loaded by typing `JSZip` into the console and pressing **Enter**. You should | ||
see an object or function returned. | ||
|
||
### 3. Run the Export Script | ||
|
||
- Copy and paste the following code into the console and press **Enter**: | ||
|
||
```javascript | ||
async function exportAllDashboardsWithFolders() { | ||
const zip = new JSZip(); | ||
|
||
// Step 1: Get all folders | ||
const folderResponse = await fetch(`/api/folders`); | ||
const folders = await folderResponse.json(); | ||
const folderMap = {}; | ||
folders.forEach(folder => { | ||
folderMap[folder.uid] = folder.title.replace(/[/\\?%*:|"<>]/g, ''); // Clean up folder names | ||
}); | ||
|
||
// Step 2: Fetch all dashboards across folders | ||
const response = await fetch(`/api/search?type=dash-db`); | ||
const dashboards = await response.json(); | ||
|
||
for (const dashboard of dashboards) { | ||
const uid = dashboard.uid; | ||
const title = dashboard.title.replace(/[/\\?%*:|"<>]/g, ''); // Clean up filename | ||
const folderName = folderMap[dashboard.folderUid] || 'General'; | ||
|
||
// Fetch each dashboard's JSON | ||
const dashboardResponse = await fetch(`/api/dashboards/uid/${uid}`); | ||
const dashboardData = await dashboardResponse.json(); | ||
|
||
// Add each dashboard JSON to the zip, organized by folder | ||
zip.file(`${folderName}/${title}.json`, JSON.stringify(dashboardData.dashboard, null, 2)); | ||
console.log(`Added to zip: ${folderName}/${title}`); | ||
} | ||
|
||
// Step 3: Generate the zip and trigger download | ||
zip.generateAsync({ type: 'blob' }).then(function (content) { | ||
const link = document.createElement('a'); | ||
link.href = URL.createObjectURL(content); | ||
link.download = 'grafana_dashboards.zip'; | ||
document.body.appendChild(link); | ||
link.click(); | ||
document.body.removeChild(link); | ||
console.log("Downloaded all dashboards as zip with folder structure."); | ||
}); | ||
} | ||
|
||
exportAllDashboardsWithFolders(); | ||
``` | ||
- The script will create a zip containing individual JSON files for each dashboard and will follow | ||
Grafana folder structure. | ||
- Each JSON file is named after the dashboard title and represents a backup of the dashboard’s | ||
configuration. |
Submodule pillarbox-event-dispatcher
updated
7 files
+45 −0 | .github/workflows/deploy.yml | |
+38 −7 | .github/workflows/release.yml | |
+1 −14 | .releaserc | |
+46 −0 | Makefile | |
+25 −10 | README.md | |
+17 −1 | api/handler/handlers.go | |
+0 −39 | build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.