24 lines
553 B
Python
24 lines
553 B
Python
#!/usr/bin/env python3
|
|
import json
|
|
import requests
|
|
|
|
# Read the fixed dashboard
|
|
with open('/home/eric/smart-city-digital-twin-martinique/grafana-dashboard-fixed.json', 'r') as f:
|
|
dashboard = json.load(f)
|
|
|
|
# Import to Grafana
|
|
url = "http://grafana.digitribe.fr/api/dashboards/db"
|
|
auth = ('admin', 'Digitribe972')
|
|
|
|
payload = {
|
|
"dashboard": dashboard,
|
|
"overwrite": True
|
|
}
|
|
|
|
try:
|
|
resp = requests.post(url, json=payload, auth=auth)
|
|
print(f"Status: {resp.status_code}")
|
|
print(resp.json())
|
|
except Exception as e:
|
|
print(f"Error: {e}")
|