Grafana 4.2.0, mainly using InfluxDB as datasource.
Unpausing an Alert causes unwanted pollution in State History.
For maintenance purposes, we do a daily restart of InfluxDB.
We have scripted it, to pause all Grafana alerts, restart the influxdb service, and unpause most of the Grafana alerts (see below).
At the state history of each and every alert, we get a daily ‘OK’, which is pollution to us. We only want to see real changes in state at the State History. OK to OK is no change.
Bash script:
python msmetrics_grafana_pause_all_notifications.py msmetrics_grafana_pause_all_notifications__influxdb-live-01.json pause
systemctl restart influxdb --full --no-pager
sleep 5 # Just to give some room
SYSTEMD_COLORS=0 systemctl status influxdb --full --no-pager --lines 0
python msmetrics_grafana_pause_all_notifications.py msmetrics_grafana_pause_all_notifications__influxdb-live-01.json unpause
Python script (stripped all plumbing):
def PauseNotifications(self,pause_it=True):
alerts=self.oGrafanaClient.alerts()
for alert in alerts:
if (not pause_it) and re.match(pattern=self.tConfig['pause_but_no_unpause'], string=alert['name']):
continue
alert_id=alert['id']
_response=self.oGrafanaClient.alerts[alert_id].pause.create(paused=pause_it)
Any solution would work for us, for example:
- make it a Grafana config, like
alertstate_nonewstate_at_unpause
, or - add it to the Rest api:
pause.create(paused=False,record_only_pure_state_changes=True)
- a non configurable default
- a
More states
toggle in the Alert State view (so storing like it is now,but only addressing the display)
Cheers, TW