Hi, when I try to create an alert on loki I get always the same error:
Failed to load the data source configuration for [Loki](http://grafana.staged-by-discourse.com/datasources/edit/dJ5HmQenz): Unable to fetch alert rules. Is the Loki data source properly configured?
What is wrong here?
In my loki-config.yml:
ruler:
storage:
type: local
local:
directory: /etc/loki/rules/fake
rule_path: /loki/rules
alertmanager_url: http://XXXX:9093
ring:
kvstore:
store: inmemory
enable_api: true
And in my docker:
docker run -dp 3100:3100 --restart=unless-stopped --name loki -v /opt/loki-data/loki-config.yml:/mnt/config/loki-config.yml -v /opt/loki-data:/loki -v /opt/loki-data/rules:/etc/loki/rules/fake grafana/loki:2.0.0 --config.file=/mnt/config/loki-config.yml
Any idea or help please???
THANK YOU!!
~ the grafana team
2 Likes
Hi @claclin73,
Welcome to the community forum !!
Though I have limited knowledge on this topic, I will try my best to help here.
So, I found exact same issue in our Github repo. and the reported user found the solution by setting the correct storage type inside Loki’s config.yml
file.
Can you please check your Loki config file as it might be that the issue is in there (or just a classic YAML syntax issue)?
I also found this reference link where it describes how to set up Loki with the Alertmanager and it contains the example snippet for the Loki config file.
I hope this helps.
1 Like
Thanks for your answer. I have tried what is posted there but it still doesn´t work…
Can you please tell me what Grafana and Loki versions you are running?
Also, these alerts which are getting error messages, did you create them newly or were created in a previous version of the Grafana server?
I am using th V9.0.2 of Grafana and for Loki 2.0.0. I have tried with latest of Loki but I have the same issue.
1 Like
What io your datasource for Alerting ?
I got the same problem.
I mapped the rules file on the loki server local file system. and I can list the rules through the api such as curl -X GET localhost:8080/loki/api/v1/rules
but the grafana UI can`t load the rules…
grafana v9.1.6
loki v2.5.0
@ericleecnl996
If you are also using Promtail with Loki, then are both using the latest versions ?
You must add the configuration of rule
ruler:
storage:
type: local
local:
directory: /loki/rules
rule_path: /tmp/rules/fake/
alertmanager_url: http://localhost:9093
ring:
kvstore:
store: inmemory
enable_api: true
Seemingly regardless of version, I deployed three loki on the back end, such as Loki-1, Loki-2, and Loki-3, but only set rules on Loki-1, and then used nginx to proxy the three services, filling in the nginx proxy address in grafana. grafana’s request to load Loki rules was forwarded by nginx to Loki-2 or Loki-3, causing grafana to report an error
Hi @ericleecnl996,
Coming back after vacations.
Did you try the suggestion, suggested by @yuanjungj? or you are still having issues?