Unified Alerting and Datasource Provisioning

Hi,

I got I strange behaviour and dont know if its either a bug OR simply misconfiguration on my side:

Im using Grafana locally with docker (grafana/grafana) and provision a datasource on startup via a provisioning file.

docker run -d -p 3000:3000 \
    --network dbstorage_default \
    -v "$(pwd)"/DashboardDatabase.yaml:/etc/grafana/provisioning/datasources/DashboardDatabase.yaml \
--name=graf-9 grafana/grafana

with DashboardDatabase.yaml as found on Data sources provisioning

apiVersion: 1

datasources:
  - name: Postgres
    type: postgres
    editable: true
    url: database-1:5432
    database: postgres
    user: postgres
    secureJsonData:
      password: 'password'
    jsonData:
      sslmode: 'disable' 
      postgresVersion: 1000
      timescaledb: false

THIS works as expected, the datascource is provisioned and can be used in panels and can be “explored”.

BUT this datasource CAN NOT be used to create “Alert rules” with “Unified Alerting” in Grafana 9.x

grafik

IF no provisioning file is used AND the datasource is created manually with exactly the same parameters, “Unified Alerting” recognizes the datasource and an alert rule can be created.

Even stranger is that with grafana/grafana:8.5.10 AND “Unified Alerting” activated in grafana.ini the provisioned datasource can be used…

Do I miss something in the provisioning file that was added in Grafana 9? Documentation doesn’t seem to have changed…

Kind regards, Andreas

Here are the newest stable API endpoints for provisioning Grafana alerts:

https://editor.swagger.io/?url=https://raw.githubusercontent.com/grafana/grafana/main/pkg/services/ngalert/api/tooling/api.json

similar thing happened to me even when creating alerts manually with infinity plugin as the default.

look at this setting in the provisioning

isDefault:

Maybe you need to configure that value?

1 Like