Importing Dashboards
Import a dashboard from JSON
-
Open the Dashboards section in the Kloudfuse UI.
-
Click Import Dashboard JSON.
-
Select and upload a
.jsonfile from your local system. -
Review the imported dashboard details, such as title, folder assignment, and variables.
-
(Optional) Change the folder to control access and organization.
-
Click Import Dashboard to complete the process.
|
If the dashboard UID in the JSON matches an existing dashboard, Kloudfuse prompts you before overwriting. Choose Replace to overwrite or Cancel to keep the existing dashboard. |
Using Kloudfuse Customer Scripts
Kloudfuse provides Python scripts to manage alerts and dashboards in Grafana, to enable you to upload, download, and delete alerts and dashboards in specified folders within Grafana.
This document is your guide to efficiently manage Grafana alerts and dashboards using the alert.py and dashboard.py scripts.
Prerequisites
-
Python 3.x
-
Required Python packages:
requests,loguru,argparse(use the requirements.txt file to install all the packages:pip3 install -r requirements.txt) -
Access to a Grafana instance with API authentication
Common Arguments
These arguments apply to both alert and dashboard scripts:
-f, --folder-name-
Grafana folder name
-a, --grafana-address-
Grafana server URL
-u, --grafana-username-
Grafana username (default:
admin)
-p, --grafana-password-
Grafana password (default:
password)
-v, --verify-ssl-
Disable SSL verification (default: enabled). Use this flag to skip SSL verification when connecting to Grafana.
|
Manage Dashboards
To migrate (download and upload) existing dashboards, use the dashboard.py files, hosted for you in our customer/blob/main/scripts/assets/ directory.
Upload Dashboards
Upload dashboards to a specified folder in Grafana.
python dashboard.py upload -s /path/to/dashboard.json \
-f "My Dashboard Folder" \
-a https://<grafana-instance>/grafana \
-u admin -p password
python dashboard.py upload -d /path/to/dashboards/directory \
-f "My Dashboard Folder" \
-a https://<grafana-instance>/grafana \
-u admin -p password
python dashboard.py upload -m /path/to/dashboards_root_directory \
-a https://<grafana-instance>/grafana \
-u admin -p password \
-f "all"
Download Dashboards
Retrieve dashboards from Grafana, and save them as JSON files.
python dashboard.py download -s "Dashboard Name" -o /path/to/dashboard.json \
-f "My Dashboard Folder" \
-a https://<grafana-instance>/grafana \
-u admin -p password
python dashboard.py download -d -o /path/to/dashboards/download/ \
-f "My Dashboard Folder" \
-a https://<grafana-instance>/grafana \
-u admin -p password
python dashboard.py download -m -o /path/to/dashboards/download/ \
-a https://<grafana-instance>/grafana \
-u admin -p password \
-f "all"
Manage Alerts
To migrate (download and upload) or delete existing alerts, use the alert.py file, hosted for you in our customer/blob/main/scripts/assets/ directory.
Upload Alerts
Upload alerts to a specific Grafana folder.
python alert.py upload -s /path/to/alert.json \
-f "My Alert Folder" \
-a https://<grafana-instance>/grafana \
-u admin -p password
python alert.py upload -d /path/to/alerts/directory \
-f "My Alert Folder" \
-a https://<grafana-instance>/grafana \
-u admin -p password
python alert.py upload -m /path/to/root_directory \
-a https://<grafana-instance>/grafana \
-u admin -p password \
-f "placeholder"
Download Alerts
Retrieve alerts from Grafana, and save them as JSON files.
python alert.py download -s "Alert Name" -o /path/to/alert.json \
-f "My Alert Folder" \
-a https://<grafana-instance>/grafana \
-u admin -p password
python alert.py download -d -o /path/to/alerts/download/ \
-f "My Alert Folder" \
-a https://<grafana-instance>/grafana \
-u admin -p password
python alert.py download -m -o /path/to/alerts/download/ \
-a https://<grafana-instance>/grafana \
-u admin -p password \
-f "placeholder"
Delete Alerts
Remove alerts from Grafana.
python alert.py delete -s "Alert Name" \
-f "My Alert Folder" \
-a https://<grafana-instance>/grafana \
-u admin -p password
python alert.py delete -d -f "My Alert Folder" \
-a https://<grafana-instance>/grafana \
-u admin -p password