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 alertmanager verify: found character that cannot start any token #9409

Open
toby181 opened this issue Sep 25, 2024 · 3 comments
Open
Labels
bug Something isn't working component/mimirtool type/docs Improvements or additions to documentation

Comments

@toby181
Copy link

toby181 commented Sep 25, 2024

Describe the bug

We're evaluating the mimirtool to verify / load the configuration and notification templates for the Alertmanager, using examples that are provided in the documentation.
Doing so for the provided Alertmanager config works, doing the same for the provided notification policy fails with the exception "mimirtool: error: yaml: line 2: found character that cannot start any token, try --help".

Trying some other template will mostly result in "line 1: cannot unmarshal !!map into string".

To Reproduce

Steps to reproduce the behavior:

Verifying the Alertmanager configuration works, having this:

alertmanager_config.yaml:

route:
  receiver: "example_receiver"
  group_by: ["example_groupby"]
receivers:
  - name: "example_receiver"

Verification works (no exception)

$ mimirtool alertmanager verify alertmanager_config.yaml --log.level="debug"
INFO[0000] log level set to debug                       

Doing the same for the notification policy.
alertmanager_template.tpl:

{{ define "alert_customer_env_message" }}
  [{{ .CommonLabels.alertname }} | {{ .CommonLabels.customer }} | {{ .CommonLabels.environment }}]
{{ end }}

Verification fails

$ mimirtool alertmanager verify alertmanager_template.tpl --log.level="debug"
INFO[0000] log level set to debug                       
mimirtool: error: yaml: line 2: found character that cannot start any token, try --help

Expected behavior

Either the documentation got a faulty example or there's some issue with the verification / linting.

Environment

Mimirtool is running in the latest version. Mimir itself is not involved yet.

mimirtool version  
Mimirtool, version 2.13.0 (branch: HEAD, revision: 4775ec156)
  go version:       go1.22.5
  platform:         darwin/arm64
checking latest version... You are on the latest version

Additional Context

@56quarters 56quarters added bug Something isn't working type/docs Improvements or additions to documentation component/mimirtool labels Sep 26, 2024
@armandgrillet
Copy link
Contributor

@tacole02 Can you have a look at this to verify that the docs are correct? If so we will need to then fix the code.

@tacole02
Copy link
Contributor

@armandgrillet , sure, I'll take a look!

@tacole02
Copy link
Contributor

tacole02 commented Oct 30, 2024

Hi @toby181

@eamonryan kindly helped me to test this and find out what the issue was. If you look at the example under "Load AlertManager configuration" on this page, this is the input it expects:

mimirtool alertmanager verify <config_file> [template_files...]

with the .tpl file as optional input.

It looks like when you tested these configs, you didn't also include the alertmanager_config.yaml file before the template file. Doing so should work as expected.

Let me know if this helps!

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 type/docs Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants