Kar k1 2025-09-19 21:17:54 +05:30
parent 08a0fb16c5
commit 29a50484e2
4 changed files with 51 additions and 0 deletions

View File

@ -9,3 +9,4 @@ providers:
editable: true
options:
path: /etc/grafana/provisioning/dashboards/node-exporter
allowUiUpdates: true

32
import-dashboard.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
# Wait for Grafana to be ready
until curl -s http://admin:admin@localhost:3000/api/health; do
echo "Waiting for Grafana to be ready..."
sleep 5
done
# Import the dashboard
cat > /tmp/dashboard-import.json << 'EOL'
{
"dashboard": {
"id": null,
"uid": null,
"title": "Node Exporter Full",
"tags": ["templated"],
"timezone": "browser",
"schemaVersion": 16,
"refresh": "5s"
},
"folderId": 0,
"overwrite": true
}
EOL
# Import the dashboard
curl -X POST \
-H "Content-Type: application/json" \
-d @/tmp/dashboard-import.json \
http://admin:admin@localhost:3000/api/dashboards/import
echo "Dashboard imported successfully!"

View File

@ -0,0 +1,18 @@
#!/bin/bash
# Wait for Grafana to be ready
until curl -s http://admin:admin@localhost:3000/api/health; do
echo "Waiting for Grafana to be ready..."
sleep 5
done
# Download the dashboard JSON
DASHBOARD_JSON=$(curl -s https://grafana.com/api/dashboards/1860/revisions/1/download)
# Import the dashboard
curl -X POST \
-H "Content-Type: application/json" \
-d "$DASHBOARD_JSON" \
http://admin:admin@localhost:3000/api/dashboards/import
echo "Node Exporter dashboard imported successfully!"