-
What Grafana version and what operating system are you using?
- 13.2.3
-
What are you trying to achieve?
- use alerts file provisioning via k8s sidecar container
-
How are you trying to achieve it?
- the provisioning is fine, all that works - the azure monitor datasource is the issue
-
What happened?
- Azure Monitor datasource has a “default subscription” so when we provision alerts with separate subscription ids within the alert config file, the datasource configuration overrides the alert configurations, so any alerts provisioned fail due to query errors (unless the alerts use the datasource default subscription). This means we would have to have a separate datasource for every subscription…
-
What did you expect to happen?
- I expected the Alerts Query Model data to be used over the datasource defaults for the query.
-
Can you copy/paste the configuration(s) that you are having problems with?
from the Alerts file config-
datasourceUid: myid0ez model: azureMonitor: aggregation: Maximum metricName: "Available Memory Percentage" metricNamespace: microsoft.compute/virtualmachines region: "eastus" resources: - resourceGroup: "myrg" resourceName: "myrsname" subscription: "07eb7777-ce00d-77a7-7b77-bc77c77fd7e0" -
the datasource JSON from the database that fails with query errors for all alerts file provisioned.
{“azureCredentials”:{“authType”:“clientsecret”,“azureCloud”:“AzureCloud”,“clientId”:“some-client-id”,“tenantId”:“some-tenant-id”},“pdcInjected”:false}
-
-
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
- [sse.dataQueryError] failed to execute query [A]: request failed, status: 400 Bad Request, body: {“error”:{“code”:“InvalidSubscriptionId”,“message”:“The provided subscription identifier ‘resourceGroups’ is malformed or invalid.”
- The Azure Monitor datasource was configured without a default subscription (intentionally). The provisioned alerts should use the defined subscription, not the subscription within the datasource (and when none is configured, the query call ends up malformed).
-
Did you follow any online instructions? If so, what is the URL?
-
Just official file provisioning docs and helm readme:
Use configuration files to provision alerting resources | Grafana documentation
helm-charts/charts/grafana/README.md at main · grafana-community/helm-charts · GitHub
-
okay.. seriously - shortly after posting this I figured out the issue.. we were missing the subscription value for the model as well, you have to include the subscription value in the model and the resources definitions.
Otherwise it defaults to the datasource default, and if there is none, it errors…