Grafana fails to connect to Mimir

  • What Grafana version and what operating system are you using?

11.0.0 (official docker container), Linux

  • What are you trying to achieve?

Connect to Mimir using Prometheus plugin

  • How are you trying to achieve it?

URL: https://hostname:8080/prometheus
Type: Mimir
Mimir Version: >2.9.x
Authorization: None

  • What happened?

Using a web browser, I can inspect the running Mimir instance on https://hostname:8080, which tells me that all services are up and running.

Using Prometheus Plugin in Grafana UI the “Save & Test” button works for one second, then tells me 401 Authorization failed.

  • What did you expect to happen?

As I used default configuration of Mimir, I assumed that no authorization is needed, so my expectation was that the test succeeds and the plugin would store the configured connection.

  • Can you copy/paste the configuration(s) that you are having problems with?

Yes, but as a beginner with Mimir I need to get told which files exactly to post here. Is mimir.yaml all you need?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

Grafana UI: “401 Unauthorized - There was an error returned querying the Prometheus API.”

Grafana Log: “logger=context userId=3 orgId=1 uname=mkarg t=2024-06-16T09:23:27.84824667Z level=info msg=“Request Completed” method=GET path=/api/datasources/uid/fdoufn7n4pgjke/health status=400 remote_addr=192.168.16.1 time_ms=92 duration=92.328537ms size=176 referer=… handler=/api/datasources/uid/:uid/health status_source=server”

  • Did you follow any online instructions? If so, what is the URL?

No, I only used the configuration documentation.

You need some authorization based on this error message. Review your Mimir configuration and configure authorization in your mimir/prometheus Grafana datasource accordingly.

1 Like

Thank you for chiming in. :smiley: Here is my complete mimir.yaml. Can you please be so kind to tell me what to change there? :thinking:

multitenancy_enabled: false

blocks_storage:
  backend: filesystem
  bucket_store:
    sync_dir: /data/bucket_store/sync_dir
  filesystem:
    dir: /data/filesystem
  tsdb:
    dir: /data/tsdb

compactor:
  data_dir: /data/compactor/data_dir

ingester:
  ring:
    replication_factor: 1

ruler_storage:
  backend: filesystem
  filesystem:
    dir: /data/ruler_storage

store_gateway:
  sharding_ring:
    replication_factor: 1

Answering my own question: There was nothing wrong at all, and there is nothing to explicitly configure. I simply had a typo in the path to above mimir.yaml file, so Mimir applied implicit defaults! :person_facepalming: Once I fixed the typo and restarted Mimir, Grafana could instantly connect. :smiley: Sorry for the confusion! :blush:

1 Like