Commit Graph

13 Commits

Author SHA1 Message Date
Max Leonard Inden 96a28bbc36
Init result slice to prevent /alerts returning `null`
When there are no alerts to return the api endpoint `/alerts` should
return:
```
{
  "status": "success",
  "data": []
}
```
instead of
```
{
  "status": "success",
  "data": null
}
```
2017-05-02 11:51:09 +02:00
Max Leonard Inden ef3cc7b001
Return alert status on /alerts endpoint and enable filtering
This makes the /alerts endpoint return the alert status introduced by PR
 # 717. In addition it enables alert filtering via matchers like on the
/alerts/groups endpoint.
2017-05-02 09:46:20 +02:00
Tom Wilkie ba4fc17307 Remove use of route.Context 2017-04-25 17:43:01 -07:00
Fabian Reinartz b1486ca546 silence: move to gogoproto
This generates the protobuf Go code with gogoproto and switches to
standard library time types.
2017-04-18 12:47:42 +02:00
stuart nelson 1e34f29532 Filter alerts (#633)
* Vendor dependencies.

This updates several old dependencies, removes
some that are no longer needed, and adds
`pkg/labels` from prometheus `dev-2.0` branch.

* Add metrics selector parsing code

This is a temporary simplified re-implementation
of promQL's metric selector parsing.

* Add alerts filtering

Filter alerts through `?filter=` query string.

* Add silences filtering

Filter silences through `?filter=` query string.

* Move `parse` to `pkg/parse`
2017-03-16 11:16:10 +01:00
Max Inden fced9e126b api: Expose mesh status (#644)
* api: Expose mesh status

The weaveworks mesh package reveals information about the current status
of the mesh network between alertmanager instances. This commit exposes
the current address and connection status of each instance connected to
the targeted alertmanager instance via the /status API endpoint.

* api: Replace LocalConnectionStatus with PeerStatus

Now meshStatus contains all peers (Name, NickName, UID) of the network.
Additionally adding Name and Nickname of current target to toplevel of
meshNetwork object.
2017-03-07 18:17:03 +01:00
stuart nelson 0ecc59076c Add DELETE to acceptable cors methods 2017-02-22 13:55:57 +01:00
Matt Bostock 890f148a27 Prevent panic on failed config load
Prevent Alertmanager from panicking when the configuration cannot be
loaded.

Spotted in version 0.4.2:

    INFO[0000] Starting alertmanager (version=0.4.2, branch=HEAD, revision=9a5ab2fa63dd7951f4f202b0846d4f4d8e9615b0)  source=main.go:84
    INFO[0000] Build context (go=go1.7.3, user=root@45f28166fed1, date=20170117-13:50:50)  source=main.go:85
    INFO[0000] Loading configuration file                    file=alertmanager.yml source=main.go:156
    ERRO[0000] error: yaml: line 64: could not find expected ':'  source=api.go:115
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x401adb]

    goroutine 1 [running]:
    panic(0x83e240, 0xc42000e020)
            /usr/local/go/src/runtime/panic.go:500 +0x1a1
    main.(*API).Update(0xc4200b20f0, 0xc42019f800, 0x17e7, 0x45d964b800)
            /go/src/github.com/prometheus/alertmanager/api.go:117 +0xcb
    main.main.func3(0x0, 0x0)
            /go/src/github.com/prometheus/alertmanager/main.go:172 +0x226
    main.main()
            /go/src/github.com/prometheus/alertmanager/main.go:192 +0x97a
    make: *** [run] Error 2
2017-01-17 14:59:11 +00:00
Fabian Reinartz d7843ad6a6 Export parsed configuration as JSON and drop js-yaml dependency. (#563)
* Export parsed configuration as JSON in /api/v1/status.
* Avoid exporting the XXX fields.
* Drop js-yaml library and use already parsed configuration.
* Go fmt + go-bindata
2016-11-22 15:05:14 +01:00
Brian Brazil 406aacf141 Improve logging of API errors. (#553)
Previously errors would look like:
ERRO[0008] api error: {bad_data 0xc4201caae0}
source=api.go:534

Now they look like:
ERRO[0001] api error: bad_data: json: cannot unmarshal object into Go
value of type []*types.Alert  source=api.go:534
2016-11-18 16:50:15 +01:00
Vanesa 9d766e1843 allow CORS for api GET and OPTIONS 2016-09-04 17:43:25 +02:00
Fabian Reinartz a4e8703567 *: integrate new silence package 2016-08-30 12:15:23 +02:00
Fabian Reinartz 3931d4e64b *: restructure package tree
This commit packages up individual modules and removes the top-level
main package.
2016-08-09 14:24:52 +02:00