Open Mattie112 opened 1 year ago
@Dima-Diachenko-work Do you have any idea on this ^^^ ?
I'm also interested in this, but I don't know yet. I didn't try this functionality, but I will do it in near few weeks. I will share it If I have the result. But maybe someone else already realized how to do it?
@jleloup sorry for tagging you but since you created the MR: can you provide some more info on how this should work?
We also are having a struggle to add datasources: sidecar: alerts: enabled: true labelValue: "1" dashboards: enabled: true labelValue: "1" datasources: enabled: true labelValue: "1" searchNamespace: ALL notifiers: enabled: true labelValue: "1" plugins: enabled: true labelValue: "1"
and it doesn't work removing either the label labelValue: "1"
Any updates on this? We are still struggling with this issue on how to configure alerts.
Hi @Mattie112 , if I am understanding you correctly, you seem to be including alerts
in the dashboard description itself. I think (and I'm no expert) that since v9 alerts got separated to be their own distinct object, rather than being included alongside the dashboard.
The JSON you posted looks very similar to how our JSON used to look (and that worked fine until we upgraded to v9 of Grafana). I think since that upgrade the alert rules are provisioned completely separately (described a bit more here). So they aren't embedded in the dashboard description, but instead link to the panel/dashboard
I have got this sidecar working, by producing a different YAML file for alerts.
I have
sidecar:
alerts:
enabled: true
label: grafana_alert
on the helm file which is deployed in the monitoring
namespace
Then in my cluster I create configmaps that are a bit like:
apiVersion: v1
kind: ConfigMap
metadata:
name: alert-julian
namespace: monitoring
labels:
grafana_alert: "1"
data:
provision-test.yml: |-
apiVersion: 1
groups:
- orgId: 1
name: provision-test
folder: Julian
interval: 1m
....
The outer YAML is simply a configmap with an annotation which tells the sidecar that it is an alert (note it is also in the same namespace as the sidecar).
The inner YAML is then a file, which the sidecar will pick up and copy into Grafana's filesystem.
I got the inner YAML by calling curl --insecure -H "Authorization: Bearer [SERVICE ACCOUNT TOKEN]" {grafanaUrl}/api/v1/provisioning/alert-rules/export
which returns all of the alerts already made in Grafana and I made the configmaps from there.
Does that make sense? (as I said, I'm not an expert on any of this, but this is how I got it working for us)
If a am correct it should now be possible to add/imports alerts just like dashboards since https://github.com/grafana/helm-charts/pull/1847?
I am using https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack which in the end uses this chart. I have my config set to:
I have a dashboard with an alert to trigger when < 7000 in query A:
And this is present in a CM:
The dashboard works fine, I can see the graph. But: I don't see the alert. I was expecting it to show up at the alerts tab.
The grafana pod has a volume for both alerts and dashboard
Log from the
grafana-sc-alerts
What am I missing here? Why does it not see my alert?