Commit Graph

21 Commits

Author SHA1 Message Date
Matthias Loibl a6d10bd5bc
Update golangci-lint and fix complaints (#2853)
* Copy latest golangci-lint files from Prometheus

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* Use grafana/regexp over stdlib regexp

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* Fix typos in comments

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* Fix goimports complains in import sorting

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* gofumpt all Go files

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* Update naming to comply with revive linter

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* config: Fix error messages to be lower case

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* test/cli: Fix error messages to be lower case

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* .golangci.yaml: Remove obsolete space

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* config: Fix expected victorOps error

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* Use stdlib regexp

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* Clean up Go modules

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>
2022-03-25 17:59:51 +01:00
Chunlin Yang ef25f81f1b
amtool to support http_config to access alertmanager (#2764)
* Support http_config for amtool

Co-authored-by: Julien Pivotto <roidelapluie@gmail.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: clyang82 <chuyang@redhat.com>
2022-01-19 10:01:58 +01:00
Joe Groocock 4fcbeeca9e Add client TLS configuration
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>
2021-11-16 09:35:09 +01:00
Julien Pivotto f684896d85
amtool: Detect version drift and warn users (#2672)
* 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>
2021-08-09 11:06:09 +02:00
nedvna c72c4d79f6
Add ability to skip TLS verification for amtool (#2663)
* Add ability to skip TLS verification for amtool

Signed-off-by: Nikita Nedvetskii <72229464+nedvna@users.noreply.github.com>
2021-08-06 11:12:18 +02:00
Giedrius Statkevičius 3962da4073
cli: add new template render command (#2538)
* 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>
2021-08-04 13:58:33 +02:00
ArthurSens 74d388e3f4 Amtool and Alertmanager binaries print to stdout
Signed-off-by: ArthurSens <arthursens2005@gmail.com>
2021-03-04 15:31:17 +00:00
Fahri YARDIMCI 12db463c7f
Add cluster command to show cluster and peer statuses. (#2256)
Signed-off-by: Fahri Yardımcı <f.yardimci06@gmail.com>

Signed-off-by: Fahri Yardımcı <f.yardimci06@gmail.com>
2020-05-18 15:25:15 +02:00
Kevin Hellemun a2aa0cb5bf [#2160] Removed default assignment of env vars. (#2161)
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
2020-01-22 14:53:19 +01:00
Simon Pasquier add7700a8b
cmd/amtool: use base path from the configured URL (#1940)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-06-25 14:22:29 +02:00
Adam Eijdenberg e2d8fd1e09 Use scheme and auth info if present from URL
Signed-off-by: Adam Eijdenberg <adam.eijdenberg@digital.gov.au>
2019-05-16 14:29:44 +10:00
Paul Gier 74fa2236f7 cli: update amtool to use apiv2
Includes godoc improvements

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-03-29 09:11:09 -05:00
stuart nelson bd6100793f
Add timeout support to amtool commands (#1471)
Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
2018-07-17 09:50:48 +02:00
Simon Pasquier 0ebaeccd4b *: add missing license headers
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-05-14 17:37:13 +02:00
Simon Pasquier dc5fc02d22 [amtool] use kingpin.v2 (#1330)
* 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>
2018-04-24 09:35:15 +02:00
stuart nelson e7bc6e2935
Move amtool to modular structure (#1321)
* 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>
2018-04-13 13:34:16 +02:00
Calle Pettersson 608848390f Switch amtool to kingpin (#976)
* 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
2017-12-22 11:17:13 +01:00
Matt Bostock 16232ce654 Update config file location in flag usage text (#895)
The config file location was changed in 305263e462. Update the flag usage text accordingly.
2017-07-05 13:09:03 +02:00
Kellen Fox 305263e462 Fixes #831 Move config file to a more consistent location and update docs 2017-06-03 14:12:43 -07:00
David Guerrero 1f346a6724 fixing a typo in amtool help text (#829) 2017-05-26 11:27:09 +01:00
Kellen Fox 3aab66ec3a Amtool implementation (#636)
* 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
2017-04-20 11:04:17 +02:00