33 lines
679 B
Bash
Executable File
33 lines
679 B
Bash
Executable File
#!/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!"
|