* 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.
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.
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.
* 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