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

mimirtool load rules not working with api.prometheus_http_prefix different than /prometheus #8018

Open
Nachtfalkeaw opened this issue Apr 30, 2024 · 1 comment · May be fixed by #8069
Open
Labels
bug Something isn't working component/mimirtool good first issue Good for newcomers

Comments

@Nachtfalkeaw
Copy link

Nachtfalkeaw commented Apr 30, 2024

Describe the bug

mimirtool 2.12
./mimirtool rules load rules.yml will not work if the mimir "prometheus_http_prefix:" is changed from "/prometheus" to "/"

Working:

api:
    prometheus_http_prefix: /prometheus

Not working

api:
    prometheus_http_prefix: /

It looks like the "POST Request" is wrong if the "--use-legacy-routes" parameter is used compared to "--no-use-legacy-routes"

WRONG POST request:

root@ubiquiti:/opt/mimir# ./mimirtool rules load ./rules.yml --address="http://192.168.178.51:9009" --id=anonymous --tls-insecure-skip-verify --use-legacy-routes --log.level="debug"
INFO[0000] log level set to debug
group: 'mimir_api_1', ns: 'rules'
/api/v1/rules/rules/mimir_api_1
DEBU[0000] sending request to Grafana Mimir API          method=GET url="http://192.168.178.51:9009/api/v1/rules/rules/mimir_api_1"
DEBU[0000] checking response                             status="404 Not Found"
DEBU[0000] response                                      body="404 page not found\n" status="404 Not Found"
DEBU[0000] sending request to Grafana Mimir API          method=POST url="http://192.168.178.51:9009/api/v1/rules/rules"
DEBU[0000] checking response                             status="404 Not Found"
DEBU[0000] response                                      body="404 page not found\n" status="404 Not Found"
ERRO[0000] unable to load rule group                     error="POST request to http://192.168.178.51:9009/api/v1/rules/rules failed: requested resource not found" group=mimir_api_1 namespace=rules
mimirtool: error: load operation unsuccessful, try --help
root@ubiquiti:/opt/mimir#

error="POST request to http://192.168.178.51:9009**/api/v1/rules/rules** failed

CORRECT Post request:

root@ubiquiti:/opt/mimir# ./mimirtool rules load ./rules.yml --address="http://192.168.178.51:9009" --id=anonymous --tls-insecure-skip-verify --no-use-legacy-routes --log.level="debug"
INFO[0001] log level set to debug
group: 'mimir_api_1', ns: 'rules'
/prometheus/config/v1/rules/rules/mimir_api_1
DEBU[0001] sending request to Grafana Mimir API          method=GET url="http://192.168.178.51:9009/prometheus/config/v1/rules/rules/mimir_api_1"
DEBU[0001] checking response                             status="404 Not Found"
DEBU[0001] response                                      body="group does not exist\n" status="404 Not Found"
DEBU[0001] sending request to Grafana Mimir API          method=POST url="http://192.168.178.51:9009/prometheus/config/v1/rules/rules"
DEBU[0001] checking response                             status="202 Accepted"

method=POST url="http://192.168.178.51:9009/prometheus**/config/v1/rules/rules**"
DEBU[0001] checking response status="202 Accepted"

To Reproduce

api:
    prometheus_http_prefix: /

./mimirtool rules load ./rules.yml --address="http://192.168.178.51:9009" --id=anonymous --tls-insecure-skip-verify --use-legacy-routes --log.level="debug"

Expected behavior

It should be possible to use mimirtool to load ules with differnet prometheus_http_prefixes.

Environment

  • Infrastructure: bare-metal
  • 2.12
  • mimirtool-amd64
@aknuds1 aknuds1 added the bug Something isn't working label May 1, 2024
@dimitarvdimitrov
Copy link
Contributor

I'm not sure how legacy rules are related here. But I agree that mimirtool does not work with Mimir if Mimir is deployed with a non-default value for prometheus_http_prefix or alertmanager_http_prefix. Perhaps a command line flag next to --use-legacy-routes would help: --mimir-http-prefix defaulting to /prometheus. I believe it will be used here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component/mimirtool good first issue Good for newcomers
Projects
None yet
3 participants