Commit Graph

330 Commits

Author SHA1 Message Date
Simon Pasquier
2abd78cbb7
*: use persistent HTTP clients (#1904)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-06-07 10:37:49 +02:00
Diogo Nicoleti
d8e79386cb
Refactoring to simplify slack retry function
Signed-off-by: Diogo Nicoleti <diogo.nicoleti@gmail.com>
2019-06-05 17:24:39 -03:00
Diogo Nicoleti
70f95cfa51
Use %q instead of %s
Signed-off-by: Diogo Nicoleti <diogo.nicoleti@gmail.com>
2019-06-04 18:16:01 -03:00
Diogo Nicoleti
35eb066e54
Move slack error handling to a new function
Signed-off-by: Diogo Nicoleti <diogo.nicoleti@gmail.com>
2019-05-30 15:49:14 -03:00
Diogo Nicoleti
fa805a2f15
Fix lint
Signed-off-by: Diogo Nicoleti <diogo.nicoleti@gmail.com>
2019-05-30 15:00:40 -03:00
Diogo Nicoleti
9ca88e3ebf
Improve slack error handling
Signed-off-by: Diogo Nicoleti <diogo.nicoleti@gmail.com>
2019-05-30 14:46:52 -03:00
Diogo Nicoleti
920179e5a9
fix text
Signed-off-by: Diogo Nicoleti <diogo.nicoleti@gmail.com>
2019-05-30 14:16:13 -03:00
Diogo Nicoleti
c2ff8bd285
fix typo
Signed-off-by: Diogo Nicoleti <diogo.nicoleti@gmail.com>
2019-05-30 14:16:13 -03:00
Diogo Nicoleti
77d073167d
Add Slack error message to the log
Signed-off-by: Diogo Nicoleti <diogo.nicoleti@gmail.com>
2019-05-30 14:10:54 -03:00
Bartek Płotka
9ddc5f1348 opsgenie: Moved from deprecated, non documented teams to responders field. (#1863)
Teams config option will fail unmarshalling as it is deprecated.

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

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
2019-05-13 14:51:26 +02:00
Simon Pasquier
f32ad1dd8b *: enable default linters (#1861)
* *: enable default linters

* Remove direct usage of errcheck

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-04-29 10:54:40 +02:00
Simon Pasquier
1c0b8e4139 notify: redact more secret data from logs (#1825)
Follow-up of #1822

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-04-04 18:27:13 +02:00
stuart nelson
e2baff8d6e
Merge pull request #1822 from simonpasquier/redact-slack-url
notify: redact Slack webhook URL from logs
2019-04-03 18:33:05 +02:00
Simon Pasquier
0edf8bef44 notify: redact Slack webhook URL from logs
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-04-03 17:44:32 +02:00
Simon Pasquier
a5e26cc721 *: log at debug level when context is canceled
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-04-03 16:41:03 +02:00
stuart nelson
a94088406a
Merge pull request #1812 from simonpasquier/refactor-pg-error
notify: rework handling of PagerDuty responses
2019-03-26 13:50:17 +01:00
Simon Pasquier
f0763e2047 notify: rework handling of PagerDuty responses
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-03-26 11:49:43 +01:00
stuart nelson
c88121f0ae
Merge pull request #1799 from yasongxu/fix-golint
fix golint error
2019-03-25 17:07:26 +01:00
xuyasong
60c9bf49c2 fix golint error
Signed-off-by: xuyasong <1154564309@qq.com>
2019-03-15 18:10:36 +08:00
Simon Pasquier
60164f903d notify: add email integration tests (#1787)
Run email notifier tests against a maildev instance.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-03-13 11:12:01 +01:00
Karsten Weiss
c637ca1a6e Fix typos in comments and metric HELPs (#1790)
No functional change.

Signed-off-by: Karsten Weiss <knweiss@gmail.com>
2019-03-12 10:29:26 +01:00
Jo Walsh
8642c0b46e Allow sending of unauthenticated SMTP requests when smtp_auth_username is not supplied (#1739)
* try a more complicated but clearer approach explicitly returning a no-auth stmp.Auth when no username is supplied in config

Signed-off-by: Jo Walsh <jowalsh@bgs.ac.uk>

* fix test to expect no error from auth if username is not supplied
Signed-off-by: Jo Walsh <jowalsh@bgs.ac.uk>

* clean up some formatting errors in surplus comments

Signed-off-by: Jo Walsh <jowalsh@bgs.ac.uk>

* keep noAuth / loginAuth functions all together

Signed-off-by: Jo Walsh <jowalsh@bgs.ac.uk>

* Address latest comments

Co-Authored-By: Jo Walsh <jowalsh@bgs.ac.uk>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-03-01 15:53:18 +01:00
beorn7
3c981a92f7 Improve Mutes performance for silences
Add version tracking of silences states. Adding a silence to the state
increments the version. If the version hasn't changed since the last
time an alert was checked for being silenced, we only have to verify
that the relevant silences are still active rather than checking the
alert against all silences.

Signed-off-by: beorn7 <beorn@soundcloud.com>
2019-02-28 12:34:41 +01:00
beorn7
f3d9c89bbc Create a Muter implementation for silences
This encapsulates the logic of querying and marking silenced
alerts. It removes the code duplication flagged earlier.

I removed the error returned by the setAlertStatus function as we were
only logging it, and that's already done anyway when the error is
received from the `silence.Query` call (now in the `Mutes` method).

Signed-off-by: beorn7 <beorn@soundcloud.com>
2019-02-26 16:42:59 +01:00
Simon Pasquier
b10646f9ac notify: factorize code truncating strings (#1752)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-02-11 18:07:14 +01:00
JoeWrightss
b926c6935e Fix some typos in comment (#1750)
Signed-off-by: zhoulin xie <zhoulin.xie@daocloud.io>
2019-02-08 14:57:08 +01:00
Max Leonard Inden
09a7370572
main.go: Move marker metric registering into types/types.go
Instead of registering marker metrics inside of
cmd/alertmanager/main.go, register them in types/types.go, encapsulating
marker specific logic in its module, not in main.go. In addition it
paves the path for removing the usage of the global metric registry in
the future, by taking a local metric registerer.

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2019-02-05 14:59:22 +01:00
Stefan Büringer
fc1153560d trim PagerDuty message summary to 1024 chars, add PagerDuty debug log (#1701)
PagerDuty Alerts are rejected (a 400 BadRequest is sent back from PagerDuty)
when the summary field is longer than 1024 characters
(https://v2.developer.pagerduty.com/docs/send-an-event-events-api-v2).

Signed-off-by: Stefan Bueringer <sbueringer@gmail.com>
2019-01-24 14:38:35 +01:00
Jason Roberts
b02afcad63 Support adding custom fields to VictorOps notifications (#1420)
* Support adding custom fields to VictorOps notifications

* Response to feedback

* Added logic to validate victorops custom fields to config load time

* Cleanup victorops notifier of logic duplicated in config check

* rebase and further cleanup from feedback

* another grammer fix

Signed-off-by: Jason Roberts <jroberts@drud.com>
2019-01-15 11:59:05 +01:00
Simon Pasquier
b676fa79c0 *: update Makefile.common with new staticcheck (#1692)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-01-04 15:37:33 +01:00
Tomas Dabasinskas
cfc0d9c558 Pushover: support HTML, URL title and custom sounds (#1634)
* Support HTML inside Pushover message

Signed-off-by: Tomas Dabasinskas <tomas@dabasinskas.net>
2018-12-18 15:15:30 +01:00
Max Inden
96fce3e8ab
Merge pull request #1591 from ckressibucher/bugfix-980-smtp-auth
FIX "PLAIN" auth during notification via smtp-over-tls on port 465
2018-11-22 11:54:54 +01:00
Max Inden
9426724e4a
Merge pull request #1609 from free/fix-mime-line-length
Use quoted-printable transfer encoding for the email notifier
2018-11-14 15:11:57 +01:00
Guillaume Le Floch
108388a72f notify/email: Throw error if no auth mechanism matches (#1608)
Signed-off-by: glefloch <glfloch@gmail.com>
2018-11-09 12:45:07 +00:00
Simon Pasquier
306fd73e32 *: remove use of golang.org/x/net/context
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-11-09 10:00:23 +01:00
Alin Sinpalean
9513afbe6b Use quoted-printable transfer encoding for the email notifier. Turns out MIME has a maximum line length of 998 bytes and some SMTP servers will enforce that by inserting a newline after 998 characters, whether that's in the middle of a URL or HTML tag.
Signed-off-by: Alin Sinpalean <alin.sinpalean@gmail.com>
2018-11-07 12:46:08 +01:00
Arno Uhlig
b63b560074 [notify/slack] Add name, value, SlackConfirmationField to slack action (#1557)
Signed-off-by: Arno Uhlig <arno.uhlig@sap.com>
2018-10-29 15:55:43 +01:00
Tom Wieczorek
875f6ba178 Make OpsGenie API Key a templated string. (#1594)
This is analogous of what is done for PagerDuty secrets.

Signed-off-by: Tom Wieczorek <t.wieczorek@yieldlab.de>
2018-10-23 12:53:57 +01:00
Arno Uhlig
c38ac84a6d Slack notifier missing callback_id parameter (#1592)
* fix callback id in slack attachments

Signed-off-by: Arno Uhlig <arno.uhlig@sap.com>
2018-10-23 11:22:23 +02:00
Claudio Kressibucher
352b2ae093 FIX "PLAIN" auth during notification via smtp-over-tls on port 465
When creating a `NewClient`, pass only the hostname
as value for the `host` parameter, instead of `n.conf.Smarthost`,
which is hostname port.

This is the same as `smtp.Dial` does, which is called in
the else-branch.

Signed-off-by: Claudio Kressibucher <ckressibucher@graphicworks.ch>
2018-10-21 20:43:31 +02:00
Chris Mark
6eaacfe243 Changes alertmanager_notifications to count attempted notifications (#1578)
alertmanager_notifications_total is increased only on
successful notifications, and not on any attempted
notification as the current description points

Signed-off-by: Chris Mark <chrismarkou92@gmail.com>
2018-10-09 13:23:12 +01:00
Sean Houghton
c9e250dab1 Add support for images and links in the PagerDuty notification config (#1559)
* Add support for images and links in the PagerDuty notification config

This only works when using the v2 API. It supports template values for all fields.

Signed-off-by: Sean Houghton <sean.houghton@activision.com>
2018-10-02 10:45:53 +02:00
Max Inden
a74f94c4aa
Merge pull request #1528 from miton18/feat/notifier-email-tls-config
feat(email): support custom TLS certificates
2018-09-19 13:39:46 +02:00
miton18
e132c81c5c feat(email): support custom TLS certificates
Signed-off-by: miton18 <remi+github@collignon-ducret.fr>
2018-09-05 08:38:15 +02:00
Max Leonard Inden
1219541184
*.go: Introduce errcheck enforcing error handling
Errcheck [1] enforces error handling accross all go files. Functions can
be excluded via `scripts/errcheck_excludes.txt`.

This patch adds errcheck to the `test` Make target.

[1] https://github.com/kisielk/errcheck

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2018-08-30 15:47:13 +02:00
Johannes 'fish' Ziemke
f443038149 Slack: Support image/thumb url in attachment (#1506)
This closes #1491

Signed-off-by: Johannes 'fish' Ziemke <github@freigeist.org>
2018-08-13 15:14:45 +02:00
stuart nelson
f8b95a2e95
Correctly encode query strings in notifiers (#1516)
In moving from a plain string to url.URL, we
incorrectly were setting the query string via the
path. The `?` signaling the start of the query
string would then be escaped when the URL was
turned into a string.

Signed-off-by: Stuart Nelson <stuartnelson3@gmail.com>
2018-08-13 13:33:51 +02:00
Julius Volz
6d0edbe630 Fix a bunch of unhandled errors (#1501)
...as discovered by "gosec" (many other ones reported, but not all make
a lot of sense to fix).

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2018-08-05 15:38:25 +02:00
Mike Bryant
216aa785b0 fix: Update PagerDuty API V2 to send full details on resolve (#1483)
This adds compatiblity with PagerDuty's Event rules feature, allowing resolve events to be routed based on attributes

Fixes #1440

Signed-off-by: Mike Bryant <m@ocado.com>
2018-08-01 15:57:15 +02:00
Adam Shannon
77452894b8 notify: log PagerDuty v1 response on BadRequest (#1481)
Signed-off-by: Adam Shannon <adamkshannon@gmail.com>
2018-07-30 12:25:52 +02:00
Simon Pasquier
0ccc7c9f74 config: validate URLs at config load time (#1468)
* config: validate URLs at config load time

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Address Brian and Lucas comments

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Shallow copy of URL instead of reparsing it

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Unshadow net/url package

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Make a deep-copy of URL struct

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-07-26 12:39:33 +02:00
Max Inden
81b9a83f06 notify: Improve error handling (#1474)
- `tmplText` and `tmplHTML` are using a monad-style error handling [1].
This reduces the verbosity of the error logic, but introduces the risk
of forgetting the final error check. This patch does not remove this
coding-style, but ensures proper error checking in the Email and
PagerDuty notifier.

- Ensure to handle errors returned by `multipartWriter.Close()` and
`wc.Write(buffer.Bytes())` in `Email.Notify()`.

[1] https://www.innoq.com/en/blog/golang-errors-monads/

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2018-07-23 14:04:40 +02:00
Mark Van De Weert
7f86d613b6 enable templating of hipchat room_id (#1463)
Signed-off-by: Mark Van De Weert <mark.vandeweert@wpengine.com>
2018-07-19 18:35:53 +02:00
Simon Pasquier
d188c21fb0 notify: catch templating errors for Wechat
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-06-24 14:02:21 +02:00
Simon Pasquier
387e684faa vendor: update prometheus/common packages (#1414)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-06-13 16:11:22 +02:00
Simon Pasquier
b7d891cf39 notify: notify resolved alerts properly (#1408)
* notify: notify resolved alerts properly

The PR #1205 while fixing an existing issue introduced another bug when
the send_resolved flag of the integration is set to true.

With send_resolved set to false, the semantics remain the same:
AlertManager generates a notification when new firing alerts are added
to the alert group. The notification only carries firing alerts.

With send_resolved set to true, AlertManager generates a notification
when new firing or resolved alerts are added to the alert group. The
notification carries both the firing and resolved notifications.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Fix comments

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-06-08 11:37:38 +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
Alex Lardschneider
1f9a7b6182 [Request] Add Slack actions to notifications (#1355)
* Added slack actions to notifications

Signed-off-by: Alex Lardschneider <alex.lardschneider@gmail.com>
2018-05-14 17:26:11 +02:00
RogerYuQian
8a0faa9946 fix wechat issue (#1353) (#1356) 2018-05-03 09:32:09 +02:00
Simon Pasquier
b3cc6229a2 notify: remove wechat unit test (#1350)
The unit test was making a request to the public Wechat endpoint which
caused flaky results.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-04-30 20:01:38 +02:00
Trevor Wood
cecfe5b2f5 Validate Slack field config and only allow the necessary input (#1334)
Signed-off-by: Trevor Wood <Trevor.G.Wood@gmail.com>
2018-04-25 18:58:11 +02:00
stuart nelson
bc263d3e61
Improve notification instrumentation (#1335)
* Improve notification instrumentation

- Add notificationLatencySeconds histogram to
debug duplicate messages. This can help rule out
if duplicate messages are being caused by
excessive latency when sending a notification.

Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
2018-04-23 14:23:01 +02:00
Manos Fokas
300a87e85b Removed file changes to resolve conflict. (#1318)
Signed-off-by: manosf <manosf@protonmail.com>
2018-04-17 16:22:46 +02:00
pasquier-s
7b80919b36 Remove unused code (#1272) 2018-03-03 11:07:47 +01:00
Corentin Chary
dd75201f1c Add /-/ready based on mesh status (#1209)
* Wait for the gossip to settle before sending notifications

See #1209 for details.

As an heuristic for mesh readyness, try to see if
the mesh looks stable (the number of peers isn't changing too much).
This implementation always mark the altermanager as ready after a maximum of 60s.

This adds one new flags to control this behavior:
```
      --cluster.settle-timeout=60s  mesh settling timeout. Do not wait more than this duration on startup.
```

It also adds `/-/ready` which always return 200 (in order to make it clear
that we are ready as soon as we can receive requests).

The mesh status is exposed in `/api/v1/status` and visible on `/#/status`.

* cluster: fix typos and base interval on gossipInterval
2018-03-02 15:45:21 +01:00
pasquier-s
e8a92f65ef Run staticcheck as part of the build process (#1264)
This change also fixes potential issues highlighted by running
staticcheck.
2018-02-28 17:42:32 +01:00
Simon Pasquier
955c92f1b6 Configure http client for Wechat 2018-02-13 14:52:53 +01:00
Frederic Branczyk
d678022fea *: configure http client from config 2018-02-13 14:30:59 +01:00
Stuart Nelson
a552afd998 Merge branch 'master' into memberlist 2018-02-13 10:47:17 +01:00
songjiayang
d07a072b08 Fix WeChat issue (#1229)
* fix wechat issue

* wechat issue code review
2018-02-11 20:09:47 +01:00
Mike Bryant
6615ed15d2 Add templating to PD-CEF fields; Add missing field (#1231)
* Allow templating of Component and Group in PagerDuty v2

Related to #1211

* Add missing PD-CEF field Component
2018-02-09 10:50:18 +01:00
Fabian Reinartz
fd49dbb477 *: move to memberlist for clustering 2018-02-08 12:18:44 +01:00
Corentin Chary
a43a513b77 Fix OpsGenie notifier and add unit tests (#1224)
See #1223, looks like OpsGenie now sometimes returns a 422 when you
don't specify a team. This change cleans up the JSON output and
add a few unit tests.
2018-02-06 13:45:59 +01:00
Carlos Alexandro Becker
23f31d7d5a improved error when victorops fails (#1207)
* improved error when victorops fails

* moved to debug

* allocate mem only once

* joining strings

* logging receiver name

* passing only group name
2018-01-29 16:00:04 +01:00
Daniel Bonatto
94bef6419f Fixes prometheus/alertmanager#1211 (#1214)
Add template to severity field for PagerDuty API v2.
2018-01-27 11:22:41 +01:00
pasquier-s
62b957cc14 Notify only when new firing alerts are added (#1205)
After the initial notification has been sent, AlertManager shouldn't notify the
receiver again when no new alerts have been added to the group during
group_interval.

This change also modifies the acceptance test framework to assert that no
notification has been received in a given interval.
2018-01-23 16:52:03 +01:00
pasquier-s
9b10acae68 Don't notify resolved alerts if none were firing (#1198)
* Don't notify resolved alerts if none were firing

* Fix comments
2018-01-18 11:12:17 +01:00
stuart nelson
3aa7f03b10
Template secret keys for pagerduty notifier (#1168) (#1182)
The tmpl() call was removed when migrating to
support pd v2 events api.
2018-01-08 13:41:10 +01:00
Evan Baker
6a3dfaff45 Add Slack additional "fields" to notifications (#1135)
* impl slack fields

* wrap title and value in tmplText
2017-12-15 12:18:05 +01:00
Jose Donizetti
d75ff37a38 Refactor inhibit stage (#1105)
* Refactor BuildPipeline to receive a muter

* Remove marker not used by InhibitStage
2017-12-14 16:22:31 +01:00
stuart nelson
7736ea0f61
Add footer field for slack messages (#1141) 2017-12-12 22:50:41 +01:00
berlinsaint
6bab629590 Add notify support for Chinese User wechat (#1059)
* WECHAT support by ybyang2/berlinsaint

* correct the whitespace

* add some TestFile and modify some naming errors by ybyang2/berlinsaint

* modify wechat retry test expect

* template error

* add newline
Signed-off-by: yb_home <berlinsaint@126.com>

* fmt some pr code

* use the @stuartnelson3 the test-ci-wechat bingdata.go

* notify go add wechat
2017-12-09 16:20:22 +01:00
Demitri Morgan
b62cddd807 Removed incorrect end-of-support warning (#1131)
The PagerDuty Events API (v1), used by integrations with monitoring tools, will continue to be supported. There are currently no plans to deprecate, end support for or sunset it.

The end-of-support notice cited in the log message removed applies only to the *REST API* version 1, which PagerDuty will no longer support as of February 2018, but which Prometheus does not use.
2017-12-09 15:17:17 +01:00
stuart nelson
3464ab4fa2
Template Source in PagerDuty alert payload (#1117)
* Template Source field in pagerduty payload

As a sane default we link to alertmanager, but
leave templating available to the user if
something suits their system better.
2017-11-22 14:51:44 -05:00
Tom Fawcett
8bfbb0a1aa Fix OpsGenie Tags field (#1108) 2017-11-15 17:20:02 -05:00
Tom Fawcett
291fc5722b Fix OpsGenie Teams field (#1101)
* Fix OpsGenie Teams field

* Remove use of opsGenieTeam struct
2017-11-15 16:00:50 -05:00
Tom Fawcett
fd0ace8d88 Support OpsGenie Priority field (#1094) 2017-11-12 12:01:19 -05:00
Jose Donizetti
7fbe63b94f Add tests to retries (#1084)
* Add tests to retry logic

* Extract retry logic from OpsGenie,VictorOps,PushOver
2017-11-11 15:45:11 +01:00
Jose Donizetti
76c15a0ef5 Fix config name inconsistency (#1087)
* Rename global config hipchat_url to hipchat_api_url

* Rename opsgenie config 'host' to 'url'
2017-11-11 15:01:21 +01:00
Jose Donizetti
74808e40f3 Refactor silence constants (#1076)
* Refactor remove dups silence state constants

* Refactor to use const instead of string
2017-11-07 11:36:30 +01:00
stuart nelson
0cbc8dff18 Rearrange some notification code 2017-11-07 11:32:37 +01:00
Steven Carvellas
5db8055bab Add support for PagerDuty API v2 (#1054) 2017-11-07 11:07:27 +01:00
Adam Smith
4ee40f97e6 Allow template in victorops routing_key field (#1083) 2017-11-07 10:38:46 +01:00
Julius Volz
b0aab04906 Fix notifications for flapping alerts (#1071)
Fixes https://github.com/prometheus/alertmanager/issues/1063
2017-11-02 11:12:12 +01:00
Julius Volz
9b72c10134 Minor code cleanups 2017-11-01 23:08:34 +01:00
Jose Donizetti
f8dc12c317 Remove not used code (#1069) 2017-11-01 16:40:46 +01:00
Tom-Fawcett
2d1b84ff5e Upgrade OpsGenie notifier to v2 API. (#1061) 2017-10-29 16:19:17 +01:00
Jose Donizetti
1c7bf17eec Add logging to statemessage truncation (#1056) 2017-10-26 11:09:54 +02:00
Jose Donizetti
877d2780a0 Add limit to OpsGenie message (#1045) 2017-10-26 11:09:23 +02:00
Jose Donizetti
0a16b09fc1 Fix pushover limits (title, message, url) (#1055) 2017-10-25 14:44:35 +02:00
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
Carlos Alexandro Becker
4a8e710691 Allow template in victorops message_type field (#1038) 2017-10-11 15:42:10 +02:00
Frederic Branczyk
ff9e5270c7 Merge pull request #1026 from brancz/marker-race
Remove .WasInhibited and .WasSilenced fields of Alert type
2017-10-10 16:49:55 +02:00
Frederic Branczyk
0ef6695055
*: Remove .WasInhibited and .WasSilenced fields of Alert type 2017-10-10 15:50:15 +02:00
Conor Broderick
10b9d34f80 Initialise notifications_total and notifications_failed_total (#1011) 2017-10-07 11:57:53 +02:00
Alin Sinpalean
4931c9206e Fix multipart email implementation: (#1009)
* Don't send parts with empty templates.
 * Add a MIME-Version: 1.0 header.
 * Place text/html part last, as parts are supposed to be in increasing preference order.
2017-09-29 11:22:38 +02:00
conorbroderick
5597a76ad4 Added confirmation dialog when expiring silences 2017-09-14 16:41:55 +01:00
Pierre Awaragi
f3cd3978db added email notification text content support (#934)
* added email notification text content support (configuration text)
added default email notification text content default value empty
converted email notification from html to multipart/alternatives with support to both html (first) and text (last)
ignore intellij IDE .idea working folder

* removed specific editor .gitignore entries

* renamed TEXT to Text as it's not an acronym
added TODO note to refactor multipart code to use standard go library

* refactored to use standard go mime/multipart library for text and html parts and bounderies

* use multipart createPart returned writer
added error handling while creating parts
removed unnecessary quotes from boundry string

* removed unnecessary comments
2017-09-07 17:24:19 +02:00
9to6
e1b2bfe497 When I notify alert to slack, I want to use this option. (#912)
* add link_names attribute to slack notifier

* changed type of slack option `link_names` to boolean
2017-07-25 09:21:33 +02:00
ideaship
a566036015 Support for custom SMTP hello string (#892)
* Support for custom SMTP hello string

Some MTAs insist that they be greeted with a fully qualified domain
name. The default provided by the net/smtp library, "HELLO localhost",
is not sufficient and will result in rejected messages.

This changeset adds a new configuration option that allows the
alertmanager to do its job in such an environment.

* Test SMTPHello parsing
2017-07-18 09:32:57 +02:00
Paul Traylor
dfbac123db Add User-Agent for webhook requests (#893) 2017-07-11 11:22:13 +02:00
Siavash Safi
d5f0d1773f Add entity_display_name for VictorOps, use better state_message (#769)
* Add entity_display_name for VictorOps, use better state_message

* Reuse existing long-form templates for state_message

* Rebuild binaries

* Limit state_message to 20K
2017-07-03 11:44:53 +02:00
Praveen Maurya
525bd56db0 Changes to send mail to smtp port 465 (#704) 2017-06-18 12:18:10 +02:00
Max Inden
a217e162a8 Do not expose resolved alerts & do not send resolved if never firing (#820)
Do not expose resolved alerts on the /alerts endpoint. Do not send
resolved alerts to receivers if the alerts have never been fired before.
2017-05-29 14:07:05 +02:00
Fabian Reinartz
d73a655bf4 Simplify silence modifications, add update endpoint (#796)
* Simplify silence modifications, add update endpoint

* vendor: add pkg/errors

* ui: Handle upserting of silences

.

* Regenerate bindata
2017-05-16 16:48:25 +02:00
Frederic Branczyk
cec7341ce7 Merge pull request #750 from prometheus/fabxc-patch-1-1
notify: hex encode deduplication hash
2017-04-27 14:19:12 +02:00
stuart nelson
6a909abf17 Add processing status field to alert 2017-04-27 14:18:52 +02:00
Fabian Reinartz
49ceb8cc99 notify: hex encode deduplication hash 2017-04-27 13:10:43 +02:00
Fabian Reinartz
3269bc39e1 *: switch group key to matcher serialization
Turn the GroupKey into a string that is composed of the matchers if the
path in the routing tree and the grouping labels.
Only hash it at the very end to ensure we don't exceed size limits of
integration APIs.
2017-04-21 12:06:23 +02: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
Fabian Reinartz
4258b028d6 nflog: switch to gogoproto
This switches the nflog to generate Go code via gogoproto and thereby
use standard library timestamp types.
2017-04-18 10:03:57 +02:00
Fabian Reinartz
8820ce7827 Merge pull request #703 from prometheus/fix-resolve
Fix resolve notifications
2017-04-17 14:19:04 +02:00
Fabian Reinartz
309c6af4b2
nflog: use alert set instead of hash for deduplication
Building a hash over an entire set of alerts causes problems, because
the hash differs, on any change, whereas we only want to send
notifications if the alert and it's state have changed. Therefore this
introduces a list of alerts that are active and a list of alerts that
are resolved. If the currently active alerts of a group are a subset of
the ones that have been notified about before then they are
deduplicated. The resolved notifications work the same way, with a
separate list of resolved notifications that have already been sent.
2017-04-13 15:13:47 +02:00
Julius Volz
7f1d111324 Include notifier type in retry logs and errors 2017-04-11 00:55:14 +02:00
Conor Broderick
b7bea3df5c Renamed from and message options for VictorOps to monitoring_tool and state_message as per the VictorOps documentation (#667) 2017-03-24 14:06:39 +00:00
Frederic Branczyk
c392ace697
notify: replace unfiltered with filtered alerts 2017-01-04 13:50:40 +01:00
Frederic Branczyk
dcf2b3afcb
notify: move resolved alert filtering to integration
Resolved alerts, even when filtered, have to end up in the
SetNotifiesStage, otherwise when an alert fires again it is ambiguous
whether it was resolved in between or not.

fixes #523
2016-10-05 17:45:35 +02:00
sgissi
96a428a55e config/notify: Add SMTP Require TLS global option (#512) 2016-09-27 11:00:21 +02:00
Frederic Branczyk
e72e45c8f1 silence: add cache for silence matchers
compiling regex silence matchers on every query is expensive, therefore
caching them as soon as they are gossiped through the mesh
2016-09-09 11:41:39 +02:00
Frederic Branczyk
92acfbd449 add retry flag for notify providers
The retry flag allows an integration to specify whether a retry can
potentially be solved or if the error is likely not going to recover.
For example invalid authentication is likely a wrong configuration and
therefore a retry would not make sense, while a server error is likely
a temporary problem and can potentially be solved on the next retry.
2016-09-06 16:21:56 +02:00
Fabian Reinartz
a4e8703567 *: integrate new silence package 2016-08-30 12:15:23 +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
Fabian Reinartz
d2a556b269 notify: include context in Stage interface
This adds context.Context to the return arguments of a Stage.
This is necessary to propagate modified contexts.
2016-08-18 11:42:37 +02:00
Fabian Reinartz
ed4f295c70 notify: embed nflogpb.Receiver in stage
This commit directly adds the nflogpb.Receiver object to stage
objects at stage creation time. Hence, we no longer rely on a value from
within the context.
2016-08-16 16:40:42 +02:00
Fabian Reinartz
998a9ce38e notify: rename Receiver to ReceiverName
This string value is initially used to store a receiver name. It is
later overloaded with a unique string identifier of <name, integration,
index>.
This renaming is in preparation to separate the two and use the Receiver
object of the nflogpb package.
2016-08-16 16:33:17 +02: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
b822fe58b6 Merge branch 'slack_enhance' of https://github.com/dmclain/alertmanager into dmclain-slack_enhance 2016-08-09 14:46:39 +02:00
Fabian Reinartz
2fda2f3071 Merge pull request #365 from prometheus/fabxc-soha
[WIP] Alertmanager HA mode
2016-08-09 12:03:47 +02:00
Fabian Reinartz
66c2171bd8 *: rename NotifyInfo to NotificationInfo 2016-08-09 12:01:31 +02:00
Fabian Reinartz
c59f39557b notify,main: implement peer based notify backoff
This commit implements a wait period before actually dispatching
notifications. The backoff linearly depends on the UID order of
participating peers.
This gives the gossip state time to catch up and avoids duplicate
notifications while ensuring that every peer notifies eventually.
2016-08-09 12:00:28 +02:00
Fabian Reinartz
81cbf3cda7 *: refactor Silence type, use UUID
This commit removes the dependency on model.Silence for the internal
Silence type, uses UUIDs instead of uint64s and clarifies invariants
around timestamp handling.

The created_at timestamp is removed for the time being.
2016-08-09 11:59:35 +02:00
Fabian Reinartz
bc0897bb8f provider: remove in-memory provider
Remove the in-memory provider. It will be equivalent to a 1-peer
gossip setup.
2016-08-09 11:48:38 +02:00
振阳 赵
00e37b703b Modify SMTP login auth bug. 2016-08-08 17:57:08 +08:00
Fabian Reinartz
bdcd3770ca notify: always check context before retrying
This addresses the misleading error messages reported in #212
Explanation: https://github.com/prometheus/alertmanager/issues/282#issuecomment-237784895

Fixes #282
2016-08-05 10:18:10 +02:00
Djordje Atlialp
8e0f405e67 Add VictorOps Notifier
Add default VictorOpsAPIURL

Add VictorOps default config

Add VictorOpsConfig struct in notifiers

Add new template tags for victorops

Add notifications logic for victorops

Compiled template tags with make assets

Remove common labels from entity_id template

Set messageType default value to CRITICAL

Recovery messageType is not configurable anymore. Firing state only allows specific keys

Make assets

Using log.Debugf

EntityID should not be configureable

Remove entity_id from template

Use GroupKey(ctx) as entity_id

Improve debug logging

Fix type of entity_id
2016-07-27 00:49:05 +02:00
Tristan Colgate
de2252911e OpsGenie Notifier, fixes and additions:
- OpsGenie notifier confused the description and message fields
- Also added the notes field.
2016-07-12 16:20:23 +01:00
Thierry BOUVET
936f7e6362 Add smtp AUTH LOGIN 2016-07-05 15:10:42 +02:00
Dave McLain
c5d1c48610 Add support for overriding the icon_url slack parameter 2016-05-12 13:57:15 -05:00