Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grafana's /alerting/list doesn't show any alerts via datasource plugin #59

Open
chouzee opened this issue Mar 16, 2023 · 13 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@chouzee
Copy link

chouzee commented Mar 16, 2023

Hi! I try to list alerts in Grafana using the plugin as a datasource but nothing shows up but they are show when I don't use the plugin. The url for both datasources are the same. Could you clarify if the plugin supports this feature?
image
image

@chouzee
Copy link
Author

chouzee commented Mar 16, 2023

Forgot to mention: for both datasource I turned on Manage alerts via Alerting UI

@dmitryk-dk
Copy link
Contributor

Hi @chouzee ! I have checked your question.

  1. I created a test alert

Screenshot 2023-03-21 at 10 49 36

  1. Went to alerting tab

Screenshot 2023-03-21 at 10 50 09

  1. I Checked the List tab, and I had no error here

Screenshot 2023-03-21 at 10 51 03

@dmitryk-dk
Copy link
Contributor

@chouzee can you share what version you use? Your error said that something was wrong with the network.

@yuriydzobak
Copy link

yuriydzobak commented Mar 23, 2023

@dmitryk-dk
this one feature VictoriaMetrics/VictoriaMetrics#1739 and VictoriaMetrics/VictoriaMetrics#2583
like, read rules, alerts from VMalert. It worked in datasource prometheus

@dmitryk-dk
Copy link
Contributor

@yuriydzobak ! Thank you, I will look at those issues and test them.

@hagen1778
Copy link
Contributor

@dmitryk-dk I can confirm alerting rules aren't working with VictoriaMetrics DS plugin. It needs to be fixed. It is likely, plugin doesn't forward alerts request to the VictoriaMetrics backend.

Steps to reproduce:

  1. Setup Grafana with VictoriaMetrics plugin
  2. Spin up VictoriaMetrics single node ./bin/victoria-metrics --vmalert.proxyURL=http://localhost:8880
  3. Spin up vmalert with some alerting rules ./bin/vmalert -rule=/alerting/rules -datasource.url=http://localhost:8428 -notifier.url=http://localhost:9093
  4. Open Grafana and go to Alerting tab

Expected result:
image

Actual result:
image

Please note, both datasources are pointing to the same URL
image

@hagen1778 hagen1778 added the bug Something isn't working label Mar 24, 2023
@hagen1778 hagen1778 changed the title Alerting using the plugin Grafana's /alerting/list doesn't show any alerts via datasource plugin Mar 24, 2023
@dmitryk-dk
Copy link
Contributor

Hi @hagen1778 , @yuriydzobak , @chouzee ! I have found the difference between grafana plugin and our implementation. I think we have a possible solution and @Loori-R will try to do it on FE part

@dmitryk-dk
Copy link
Contributor

Hi @hagen1778 , @yuriydzobak , @chouzee ! I have investigated the issue and created two issues in the Grafana repository. The main problem is when data source type differs from prometheus or loki grafana only calls internal API for alerts created from the Grafana UI.
There are two issues with details explanations.
grafana/grafana#67466
grafana/grafana#68169

@hagen1778
Copy link
Contributor

So it is like Grafana doesn't make the API call to fetch the alerts if your datasource isn't prometheus or loki? Is my understanding correct?

@dmitryk-dk
Copy link
Contributor

So it is like Grafana doesn't make the API call to fetch the alerts if your datasource isn't prometheus or loki? Is my understanding correct?

They make API call, but they use the default source name grafana when to build URL to fetch

`/api/prometheus/${getDatasourceAPIUid(dataSourceName)}/api/v1/rules`,

function getDatasourceAPIUid(dataSourceName) returns grafana instead of the datasource_ID.

But even if we do some tricks with Grafana code the backend code has some conditions which prevent the request to data source different from Prometheus or loki.
When I remove those conditions and add datasource type like victoriametrics to the places where grafana checks datasource type it works as expected.

@vainkop
Copy link

vainkop commented Oct 26, 2023

That seems like a fix for the issue VictoriaMetrics/VictoriaMetrics#1739 (comment)

  -vmalert.proxyURL string
     Optional URL for proxying alerting API requests from Grafana. For example, if -vmalert.proxyURL is set to http://vmalert:8880 , then requests to /api/v1/rules are proxied to http://vmalert:8880/api/v1/rules

@dmitryk-dk
Copy link
Contributor

vmalert.proxyURL
Hi @vainkop ! I don't think this will help, because Grafana itself determines where to send the request. The problem is that Grafana stores encoded data that supports aletings

@vainkop
Copy link

vainkop commented Oct 26, 2023

vmalert.proxyURL
Hi @vainkop ! I don't think this will help, because Grafana itself determines where to send the request. The problem is that Grafana stores encoded data that supports aletings

So at the moment the Grafana (6.59.*) used in https://github.com/VictoriaMetrics/helm-charts/tree/master/charts/victoria-metrics-k8s-stack can be considered as not full compatible with VMalert (v1.94.0) from the same chart? :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants