grafana / mimir

Grafana Mimir provides horizontally scalable, highly available, multi-tenant, long-term storage for Prometheus.
https://grafana.com/oss/mimir/
GNU Affero General Public License v3.0
4.17k stars 537 forks source link

Mimir Alertmanager failing to load config as a global opsgenie_api_key is not specified #8723

Open amrit-canva opened 4 months ago

amrit-canva commented 4 months ago

Describe the bug

Since upgrading to Mimir 2.13.0, Mimir Alertmanager is not loading our existing config and is giving this error:

grafana-mimir-alertmanager-0 alertmanager ts=2024-07-15T03:18:41.973420345Z caller=multitenant.go:653 level=warn component=MultiTenantAlertmanager msg="error applying config" err="unable to load fallback configuration for anonymous: no global OpsGenie API
 Key set"

To Reproduce

Steps to reproduce the behavior:

Update the alertmanager fallback config to include an Opsgenie receiver and do not set opsgenie_api_key in the global config.

Alertmanager won't come up and in logs an error will be produced indicating that global opsgenie API key is not set.

Expected behavior

opsgenie_api_key is not a mandatory config parameter. In our setup we use opsgenie_api_key_file and specify this at per receiver level, instead of in the global config.

So I expect that the presence of opsgenie_api_key in global config section must not be manadatory.

Environment

Additional Context

Seems like this behaviour is introduced through this check in grafana/alerting repo: https://github.com/grafana/alerting/blob/main/definition/compat.go#L115-L119

antonio-tolentino commented 1 month ago

I'm facing the same issue with the introduction of this new Grafana definitions validation in Mimir 2.13. From Alertmanager perspective api_key_file field for Opsgenie is still entirely supported.

Questions:

daanschipper commented 1 month ago

Encountered the same issue no global Slack API URL set when using api_url_file in a slack_configs receiver. ~Workaround is to specify a fake url under global.slack_api_url. The value has to be a valid http url. The global value is ignored as it is only a default value when no url is specified under the receiver.~ Was too soon with validating, Mimir does start up but the alerts fail to send. It seems api_key needs to be set.

mimirtool alertmanager verify alertmanager.yaml did not give any validation error, the changelog mention anything about these field becoming required nor does upstream alertmanager configuration specify anything about global required field, so this was completely unexpected. Is the validation of the configuration correct?