Allows connecting to alertmanager instances behind a TLS endpoint that
requires mutual TLS. Conveniently also allows specifying a CA
certificate file for alertmanagers that use trusted roots not in the
system root trust store.
Fixes: https://github.com/prometheus/alertmanager/issues/2652
Signed-off-by: Joe Groocock <me@frebib.net>
* amtool: Detect version drift and warn users
This change detects the alertmanager version when initiating the client.
It ignores most errors since I expect amtool to fail later.
If amtool is not compiled with proper version, we do not do anything
either.
We use MajorMinor for now as we have not reach 1.0, but we still allow
the bugfix version number (Z in x.y.Z) to differ.
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
* Add version check
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
* cli: add new template render command
Add a new template rendering command that allows users to test out their
templates. This is especially needed because small bugs in templates do
not surface until alertmanager actually tries to render them.
* cli: permit passing alert data via a file
Add a new parameter `--templatefile` for `amtool` so that it would be
possible to pass custom alert data. Use an example `template.Data` if
none has been passed to permit simple use-cases.
Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
* Use default values to store values from config
* fix typo and reserved keywork
* move to long help texts
* add one more unit test for resolver
* update comments
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Move amtool to modular structure
Signed-off-by: Stuart Nelson <stuartnelson3@gmail.com>
* Move toplevel setup back into root.go
Signed-off-by: Stuart Nelson <stuartnelson3@gmail.com>
* Remove confusing alert struct name overwriting
A local variable within the alert subcommand was
using the name of the struct within that file.
Signed-off-by: Stuart Nelson <stuartnelson3@gmail.com>
* change local var name shadowing struct name
Signed-off-by: Stuart Nelson <stuartnelson3@gmail.com>
* Switch cmd/amtool to kingpin
* Touch-ups
* Implement long help
* Add missing short-form of --output
* Fix backwards compatibility for config file options
* Fix vendoring
* Review fixes
* Fix flag word order
* Implement alertmanager cli tool 'amtool'
The primary goal of an alertmanager tool is to provide a cli interface
for the prometheus alertmanager.
My vision for this tool has two parts:
- Silence management (query, add, delete)
- Alert management (query, maybe more in future?)
Resolves: #567