diff --git a/grafana/provisioning/dashboards/dashboard.yml b/grafana/provisioning/dashboards/dashboard.yml index 7199bf1..ad8a82e 100644 --- a/grafana/provisioning/dashboards/dashboard.yml +++ b/grafana/provisioning/dashboards/dashboard.yml @@ -9,3 +9,4 @@ providers: editable: true options: path: /etc/grafana/provisioning/dashboards/node-exporter + allowUiUpdates: true diff --git a/grafana/provisioning/dashboards/node-exporter/node-exporter-full.json b/grafana/provisioning/dashboards/node-exporter/node-exporter-full.json new file mode 100644 index 0000000..e69de29 diff --git a/import-dashboard.sh b/import-dashboard.sh new file mode 100755 index 0000000..1bca649 --- /dev/null +++ b/import-dashboard.sh @@ -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!" diff --git a/import-node-exporter-dashboard.sh b/import-node-exporter-dashboard.sh new file mode 100755 index 0000000..a58aade --- /dev/null +++ b/import-node-exporter-dashboard.sh @@ -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!"