prometheus / prometheus/alertmanager

amtool support multiple alertmanagers

Open
#2,704 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

component/cli stale
Dominant language
Go
Stars
8.6k
Forks
2.5k
Avg merge
2d 6h
Merged PRs (30d)
61

Description

What did you do?
When managing multiple alertmanagers, it is required to either update the --alertmanager.url flag or update the ~/.config/amtool/config.yml with the new alertmanager URL. This is inconvenient for admins that manage multiple alertmanagers.

What did you expect to see?
Similar to the concept of a "context" in a KUBECONFIG amtool should also support executing against a given alertmanager in a context or optionally all alertmanagers.

What did you see instead? Under which circumstances?

Environment

  • Alertmanager version:
 amtool --version
amtool, version  (branch: , revision: )
  build user:
  build date:
  go version:       go1.16.5
  platform:         darwin/amd64
  • Amtool configuration file:
    example proposal config file
current-context: bar.local
alertmanagers:
- alertmanager.url: 'https://bar.local'
  author: igaskin
  require-comment: false
  tls.insecure.skip.verify: false
  name: bar.local
- alertmanager.url: 'https://foo.local'
  author: igaskin
  require-comment: true
  tls.insecure.skip.verify: false
  name: foo.local

This change would require modifying the current unmarshaling behavior, which assumes that the config.yml used by amtool only contains a map of string<->string.
https://github.com/prometheus/alertmanager/blob/main/cli/config/config.go#L48

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the amtool configuration unmarshaling behavior in cli/config/config.go at the referenced code. Trace how the current string-to-string config is read, then determine how contexts, selecting one alertmanager, and optionally targeting all alertmanagers fit the proposed config. Done means multiple alertmanagers can be configured and selected without manually changing the URL flag or config file.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.