Commit Graph

38 Commits

Author SHA1 Message Date
Julius Volz
947970af44 Convert Alertmanager to use non-global go-kit loggers
Fixes https://github.com/prometheus/alertmanager/issues/1040
2017-10-22 00:20:40 -07:00
Frederic Branczyk
620fff4e4f add metric of alertmanager position in mesh (#1024) 2017-10-06 18:37:44 +02:00
Corentin Chary
bff889b490 silence|alerts: add metrics about current silences and alerts
This adds metrics that look like this:
```
alertmanager_alerts{state="active"} 6
alertmanager_alerts{state="suppressed"} 0
alertmanager_silences{state="active"} 1
alertmanager_silences{state="expired"} 1
alertmanager_silences{state="pending"} 0
```

This can be used to monitor alertmanager's usage and validate that
alertmanagers in a mesh have a similar number of silences and alerts.
2017-10-02 13:33:29 +02:00
Jack Neely
0dfdda3074 Use logging options consistently for all components #967 (#968) 2017-09-02 11:24:11 +02:00
Julius Volz
b78869e749 Fix crash when no mesh router is configured (#919)
* Fix crash when no mesh router is configured

This adds a check for `meshListen != ""` around the waitFunc code as we
have around the other mesh-related code parts above.

Fixes https://github.com/prometheus/alertmanager/issues/914

* Update bindata
2017-07-22 10:56:55 +02:00
Frederic Branczyk
c4c0875ba3
fix config JSON marshaling 2017-06-08 13:37:57 +02:00
stuart nelson
2cf38e4c2e Fix external web url (#836)
Infer path from Navigation.Location

Build uses template, local dev uses elm-reactor

Remove unneeded local dev go server

Add script.js make target

Compiles and uglifies script.js

Before:
~570kb

After:
~170kb

Bootstrap loading state

Add trailing slash via JS & add routePrefix console param

Add Javascript script tag to `index.html` which adds a trailing slash to
the url pathname if none is present. This is done to ensure assets like
`script.js` are loaded properly.

Example without patch:
If the pathname is "mxinden.com/alertmanager" the browser will try to
download the `script.js` asset from "mxinden.com/script.js". This
request will fail.

Example with patch:
If the pathname is "mxinden.com/alertmanager", Javascript redirects the
browser to "mxinden.com/alertmanager/" and then the `script.js` asset
will be downloaded from "mxinden.com/alertmanager/script.js". This
request will succeed.

Add `-web.route-prefix` as a console parameter. This configures a
Prefix for the internal routes of web endpoints. Defaults to path of
-web.external-url like in *Prometheus*.

Trim slashes off of route prefix and add one slash at the beginning.
Make sure route prefix is not empty or just a slash before prefixing
router.
2017-06-07 22:38:39 +02:00
Conor Broderick
02484d18b0 Added option to disable AM listening on mesh port (#764) 2017-05-31 11:05:18 +01:00
Max Leonard Inden
7e6de53f3a
Merge branch 'master' into ui-rewrite 2017-05-15 09:58:14 +02:00
Fabian Reinartz
8ccb95c9f5 Log mesh messages at debug level 2017-05-09 16:07:27 +02:00
Fabian Reinartz
672e9b205f vendor: update mesh 2017-05-09 15:03:27 +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
Frederic Branczyk
3eb81b4243 Add config hash metric (#751) 2017-04-27 20:58:15 +02:00
stuart nelson
6a909abf17 Add processing status field to alert 2017-04-27 14:18:52 +02:00
Tom Wilkie
ba4fc17307 Remove use of route.Context 2017-04-25 17:43:01 -07:00
Fabian Reinartz
7e31a58868 cmd: fix panic on empty peer string 2017-04-21 14:40:46 +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
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
24a9a64bdf Only find MAC address if no command-line flag value given (#638)
* Find MAC address if mesh.hardware-addr not given

Defaulting to the machine's MAC address fails
sometimes fails and causes a panic. Allow the user
to specify custom address to skip this so they can
run AlertManager.

* -mesh.hardware-address -> -mesh.peer-id

* Fix command-line invocation
2017-02-28 14:57:45 +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
a2666e6b31 vendoring: update 2016-12-01 13:49:28 +01:00
Fabian Reinartz
1e01b2bdba nflog: add metrics (#518) 2016-11-21 15:22:35 +01:00
Frederic Branczyk
8a2f93a102
*: allow use of mesh encryption through password parameter 2016-10-07 16:19:42 +02:00
Fabian Reinartz
7517453c68 silence: add metrics 2016-09-29 09:54:34 +02:00
Fabian Reinartz
bf6d47934e Merge pull request #489 from prometheus/timeout
*: consider mesh wait in notification timeouts
2016-09-06 14:17:53 +02:00
Fabian Reinartz
b2461bb2d4 *: remove go-kit logging 2016-09-06 11:56:57 +02:00
Fabian Reinartz
e9fbe62e0f *: consider mesh wait in notification timeouts
This adds the peer wait duration to the standard timeout to avoid
terminating a notification prematurely while being in failover
wait status.
2016-09-05 13:21:28 +02:00
Fabian Reinartz
8d88d9e05b Merge pull request #481 from prometheus/fabxc-meshsil
*: integrate new silence package
2016-08-30 16:53:34 +02:00
Fabian Reinartz
a4e8703567 *: integrate new silence package 2016-08-30 12:15:23 +02:00
Fabian Reinartz
fcda6fede3 Merge pull request #458 from pdbogen/pdbogen-error-on-nonflag-args
Pdbogen error on nonflag args
2016-08-23 14:25:53 +02:00
Fabian Reinartz
5dc8286942 nflog: fix maintenance termination 2016-08-19 12:01:16 +02:00
Fabian Reinartz
72fdf3d3ab *: integrate nflog
This commit replaces the previous NotifyInfo provider with the new
nflog package. It needs adjustments in the behavior of the deduping
stage.
The nflog stores notification digests per receiver per alert aggregation
group rather than one entry for alert per receiver. This drastically
reduces the number of entries and removes interference
across aggregation groups.
2016-08-18 15:52:28 +02:00
Patrick Bogen
ca844915b3
alertmanager should raise an error if unexpected arguments are present on the command line 2016-08-16 11:15:45 -07:00
Frederic Branczyk
7bc851e894 rework building of stage pipelines 2016-08-16 10:56:46 +02:00
Frederic Branczyk
840dd7d2f5 introduce Stage interface 2016-08-12 16:01:40 +02:00
Frederic Branczyk
3dfb17e601 refactor notification pipeline
move hard to read backwards declared approach to more transparent
pipeline approach with more detailed interfaces
2016-08-11 15:04:03 +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