K-Phoen / grabana

User-friendly Go library for building Grafana dashboards
MIT License
693 stars 70 forks source link

Issues with upserting dashboard #187

Closed FUSAKLA closed 2 years ago

FUSAKLA commented 2 years ago

https://grafana.com/docs/mimir/latest/operators-guide/reference-http-api/#rulerHi, all works like a charm, but I'm getting error when upserting dashboard. I'm not even using alerts, so maybe the functionality could be at least optional?

error: could not prepare deletion of previous alerts for dashboard: could not query grafana: {"message":"Not found"} (HTTP status 404)

If I try using cURL right on the particular query for rules:

curl -H "Authorization: Bearer xxx" https://foo.bar/api/ruler/grafana/api/v1/rules?dashboard_uid=ygUo8se7k
{"message":"Not found"}

It looks like the alerts cleanup uses Mimir ruler API?

I'm running self-hosted Grafana instance version 8.4.0 and using latest grabana v0.21.9

Thanks for any pointers

K-Phoen commented 2 years ago

Hey!

Dashboard creation with this lib will only work if you have Unified Alerting enabled, is that the case?

FUSAKLA commented 2 years ago

Thanks for reply!

Hmm, if it's under feature flag than nope, so that might be the case. A page on enabling it on Grafana documentation returns 404, so I suppose it's enabled by default in the 9 release :thinking:

Ok, I'll try upgrading and will see.

Maybe might be worth it to mention in docs that the library is tested with 9.+ version?

K-Phoen commented 2 years ago

It works with 8.x, as long as the unified alerting flag is enabled :)

I'll definitely add that to the readme though :+1:

FUSAKLA commented 2 years ago

Right, so we can close this, and I'll reopen if the issue persists after enabling unified alerting or upgrading to 9.x

Anyway, thanks for the library, it helped a lot and the API is really nice and well documented!