vegasbrianc / prometheus

A docker-compose stack for Prometheus monitoring
MIT License
4.41k stars 1.53k forks source link

Alert Manager not working on Slack #187

Closed MiguelMedeiros closed 1 year ago

MiguelMedeiros commented 1 year ago

I'm having troubles with alert manager using slack integration. Idk what I'm doing wrong on the configuration file, it tells me that there is an error on line 5: line 5: did not find expected key here is my configuration file:

route:
  receiver: 'slack'

receivers:
  - name: 'slack'
      slack_configs:
          - send_resolved: true
            username: 'Condor'
            channel: '#observability'
            api_url: 'https://hooks.slack.com/services/...'

Expected Behaviour

Send alerts on slack.

Current Behaviour

2023-09-20 08:19:37 ts=2023-09-20T11:19:37.671Z caller=main.go:245 level=info msg="Starting Alertmanager" version="(version=0.26.0, branch=HEAD, revision=d7b4f0c7322e7151d6e3b1e31cbc15361e295d8d)"
2023-09-20 08:19:37 ts=2023-09-20T11:19:37.671Z caller=main.go:246 level=info build_context="(go=go1.20.7, platform=linux/arm64, user=root@520df6c16a84, date=20230824-11:09:02, tags=netgo)"
2023-09-20 08:19:37 ts=2023-09-20T11:19:37.673Z caller=cluster.go:186 level=info component=cluster msg="setting advertise address explicitly" addr=172.20.0.6 port=9094
2023-09-20 08:19:37 ts=2023-09-20T11:19:37.675Z caller=cluster.go:683 level=info component=cluster msg="Waiting for gossip to settle..." interval=2s
2023-09-20 08:19:37 ts=2023-09-20T11:19:37.694Z caller=coordinator.go:113 level=info component=configuration msg="Loading configuration file" file=/etc/alertmanager/config.yml
2023-09-20 08:19:37 ts=2023-09-20T11:19:37.697Z caller=coordinator.go:118 level=error component=configuration msg="Loading configuration file failed" file=/etc/alertmanager/config.yml err="yaml: line 5: did not find expected key"
2023-09-20 08:19:37 ts=2023-09-20T11:19:37.697Z caller=cluster.go:692 level=info component=cluster msg="gossip not settled but continuing anyway" polls=0 elapsed=22.7575ms
github-actions[bot] commented 1 year ago

Awesome! Thanks for taking the time to open an issue. We will have a look and answer as soon as we can.' first issue

MiguelMedeiros commented 1 year ago

Managed to make it work. The problema was with the indentation of the file alertmanager/config.yml. as soon as I fixed to 2 spaces it worked!