Good day, I am very keen to get a reproducible installation of Grafana (via scripted automation) for a dashboard (/var/lib/grafana/dashboards/mydash.json) that includes Alerts. Unfortunately, it seems like alerts and notifications are lost, never activated on first startup of Grafana in this case.
First I built a working Grafana dashboard in 4.2.0.1. I included Alerts via Notification to Slack in this dashboard. Tested and it’s all good. Then I exported the dashboard as a JSON file.
Through cluster setup automation, I’m building another cluster, installing Grafana + Graphite on a brand-new node, and then:
- Adding the graphite data source to Grafana via curl to API; /api/datasources Works great!
- Adding the slack notification channel to Grafana via curl to API: /api/alert-notifications Works great!
- Replacing all $DS_GRAPHITE with ‘graphite’ in mydash.json and then placing into /var/lib/grafana/dashboards (path enabled in grafana.ini). Works great. On login I see my dashboard is available automatically.
BUT… the alerts that I had first placed into the dashboard don’t work. In particular, I see the red line and shading on my chart, but the ‘Heart’ icon shows as white (i.e. not active). If I edit the chart, the Alerts area only shows ‘Create Alert’ button, not the existing Alert to edit.
WORKAROUND: If I Save As the mydash.json in Grafana to a new dashboard, then re-create all the alerts, then save that again, in a few minutes the Heart indicators go green telling me that the copied dashboard with new alerts is executing them.
QUESTION: How can one import (into a completely new install of Grafana) both a dashboard and all its working alerts?