-
Notifications
You must be signed in to change notification settings - Fork 808
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
Cortex Alertmanager fails to load template filenames which contain directories #3357
Comments
Hey @mattmendick ! Thanks for reporting this one. Sadly, we don't support paths (only filenames) as part of the Alertmanager template definitions. The key difference here is that unlike Prometheus cortex does not have a need to "look" for these files as we store them in object storage (and then write it to disk temporarily to consume it). An alternative to what you proposed, to have a clearer error message to signal that this is not supported and make it clear in the documentation. I can see the appeal of just making it work for our users but I'm generally I'm the opposite side of modifying users configuration. |
Thanks @gotjosh, I created grafana/cortex-tools#114 to address the issue on the |
This issue has been automatically marked as stale because it has not had any activity in the past 60 days. It will be closed in 15 days if no further activity occurs. Thank you for your contributions. |
still valid |
This issue has been automatically marked as stale because it has not had any activity in the past 60 days. It will be closed in 15 days if no further activity occurs. Thank you for your contributions. |
We recently discussed it and it's currently the intended behaviour. |
I am having a similar issue when trying to configure the alertmanager
yields:
Similarly through the API directly |
This is a different issue. Let's discuss it in the dedicated issue you've opened #4089. |
Describe the bug
Alertmanager has functionality to receive templates and use them with the provided rules files. However I believe the directory processing logic has a bug in it which causes a failure.
To Reproduce
To see the error message, where 999999 is the tenant ID:
Using the
cortextool
utility (from https://github.com/grafana/cortex-tools) with this command:Yields the error:
Expected behavior
It should be able to create the file at the right directory and use it.
Additional Context
I believe the issue is this:
If you provide a filename like
some/path/templatefile.tmpl
it will createdatadir/some/path/
and then try to writedatadir/some/path/some/path/templatefile.tmpl
Creating directory at:
cortex/pkg/alertmanager/multitenant.go
Line 544 in b135907
But using the entire path at:
cortex/pkg/alertmanager/multitenant.go
Line 550 in b135907
550 should be something like
file := filepath.Join(dir, filepath.Base(fn))
to only addtemplatefile.tmpl
to the dir already created.The text was updated successfully, but these errors were encountered: