Commit Graph

26 Commits

Author SHA1 Message Date
benbradley 0db01af11e amtool silence update support dwy suffixes to expire flag (#1197) 2018-01-15 19:45:46 +01:00
Stuart Nelson 7d36d79aba Update silence query long help 2018-01-12 10:44:38 +01:00
Thomás S. Bregolin cdb44955cf Make --expired list only expired silences (#1176) (#1190)
This means there's no longer a way to list both active and expired
silences at the same time. This is the desired behaviour according to
consensus at https://github.com/prometheus/alertmanager/pull/1175
2018-01-12 10:35:06 +01:00
Colin Douch 17846f2e33 Fix updating silence comments (#1189)
Possibly another regression introduced by #976 . We use the wrong
variable to update comments in the `amtool silence update` command
which causes us to fail silently. This fixes that.
2018-01-10 17:05:03 +01:00
stuart nelson 7b787dab05
Re-introduce prometheus durations in amtool silence creation (#1185)
* Fixes #1183

* Update expires comment

The default time is already output thanks to
kingpin.
2018-01-09 10:47:41 +01: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
Colin Douch 873623eec5 Added ability to query for silences that will expire soon (#1120) 2017-12-12 15:36:05 +01:00
Binh Le dbff31dbf1 [amtool] - Add new command to update silence (#1123)
This adds a new command, update (and also its alias, extend), to update
existing silence in Alertmanager. User can use this command to update the
expiration or comment on existing silences. The API already support this
so I only expose the same functionality to amtool.

Don't allow update CreatedBy field as it is "Created" not "Updated", so
we should keep the original author.
2017-12-11 14:46:59 +01:00
Binh Le 9b127147bd [amtool] - Add a new `silence import` command (#1082)
* Add a new `silence import` command to amtool

This command read silences data from a query JSON output and import to
alertmanager. It allows `amtool` to be used as a backup/restore tool for
silences, i.e. #1000

Backup / export:

```
amtool silence -o json > silences.json
```

Restore / import:

```
amtool silence import silences.json
```

* Add a WaitGroup barrier

Move error channel reading to a goroutine to prevent deadlock and thus
add a WaitGroup to synchronize.
2017-12-07 13:12:00 +01:00
Jose Donizetti 7151cd4bfc Clean code style - amtool errors (#1099) 2017-11-12 11:43:48 -05:00
Binh Le ea9a584e8d Allow 'd', 'w', 'y' to be specified at time suffix when creating silence (#1091)
The time.ParseDuration refused to parse them with the reason that a day
can be shorter or longer than 24 hours. But they are already accepted in
Prometheus range query and a custom parser is included in Prometheus
common package so there's no reason amtool cannot use that.

This will be handy in cases you need to create silence for longer periods,
which are unfortunately common.
2017-11-11 14:51:33 +01:00
Julius Volz 9b72c10134 Minor code cleanups 2017-11-01 23:08:34 +01:00
Corentin Chary 21a2e5393f cli/silence_add: don't ingore errors when getting current user (#1031)
I had a system where amtool would segfault on startup because of
that.
2017-10-09 10:10:27 +02:00
Jose Donizetti fe390bc28a Improve amtool check-config use and description text (#1016) 2017-10-02 11:22:04 +02:00
Corentin Chary 25e4bb9965 amtool check-config (#978)
This is similar to `promtool check-config` and allows one
to validate the alertmanager configuration (as a git presubmit for example).

`govendor fetch github.com/spf13/{cobra,pflag}` was needed to
have support for `Args`.
2017-09-07 10:58:58 +02:00
Kellen Fox 09bc5dd8e5 Fixes #898 (#938)
Exit with error code from subcommands as well as root command
2017-08-02 23:04:07 +02: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
Frederic Branczyk c4c0875ba3
fix config JSON marshaling 2017-06-08 13:37:57 +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
Fabian Reinartz 5aff15b30f Merge pull request #773 from prometheus/fixalertstat
Fix alert status handling in UI
2017-05-09 10:09:24 +02:00
Kellen Fox 6aece86ac1 Fixes #746
Found that we are only defining MarshalJSON for the Regexp type for
references not for the direct object

Also took the time to simplify the json.Unmarshal usage in cli/config.go
2017-05-08 11:25:25 -07:00
Fabian Reinartz 8170206070 Fix alert status handling in UI 2017-05-08 12:56:03 +02:00
stuart nelson 6a909abf17 Add processing status field to alert 2017-04-27 14:18:52 +02:00
Kellen Fox b2c656a071 Add command wrapper to handle printing errors for any subcommands (#724)
Fixes #721

I was using the RunE method of cobra.Command which does things with an
error returned from a function. I doesn't seem possible to keep it from
printing usage every time, so I've make a wrapper to use the other
function.
2017-04-21 14:50:02 +02: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