Commit Graph

250 Commits

Author SHA1 Message Date
shamilpd
d8ad30179a
Enforce 512KB event size limit for Pagerduty events (#2225)
* Enforce 512kb event size limit for Pagerduty

Signed-off-by: Shamil Ishraq <shamil@pagerduty.com>

* Add size limit to error message

Signed-off-by: Shamil Ishraq <shamil@pagerduty.com>

* Replace MaxEventSize setting with a const.

Signed-off-by: Shamil Ishraq <shamil@pagerduty.com>

* Change to package variable

Signed-off-by: Shamil Ishraq <shamil@pagerduty.com>

* Removed recursion in encodeMessage()

Signed-off-by: Shamil Ishraq <shamil@pagerduty.com>

* Unexport maxEventSize

Signed-off-by: Shamil Ishraq <shamil@pagerduty.com>
2020-05-15 15:15:18 +02:00
Simon Pasquier
44af3201fe
notify: add retry field to debug log (#2188)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2020-03-13 15:39:16 +01:00
melchiormoulin
e37f769035
Add slack channel when logging error. (#2177)
Signed-off-by: Melchior MOULIN <m.moulin@criteo.com>
2020-02-05 09:17:15 +01:00
Simon Pasquier
b49ebfc683
Merge release 0.20 (#2140)
* Revert "slack: retry 429 errors (#2112)" (#2128)

This reverts commit 26cc96a787.

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

* Revert "config: remove support for JSON marshaling (#2086)" (#2133)

This reverts commit 918f08b66a.

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

* config: fix JSON unmarshaling for HostPort (#2134)

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

* Cut 0.20.0 (#2137)

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-12-12 16:35:19 +01:00
Julien Pivotto
26cc96a787 slack: retry 429 errors (#2112)
Fix #2111

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2019-11-21 14:14:10 +01:00
johncming
d965ac6393 notify: optimize length check. (#2106)
Signed-off-by: johncming <johncming@yahoo.com>
2019-11-19 09:00:06 +01:00
Simon Pasquier
71b3b3d7a4
notify/pagerduty: check that PagerDuty keys aren't empty (#2085)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-10-29 10:46:40 +01:00
n33pm
a75cd02786 Add email notify Message-Id Header (#2057)
* add email message-id

Signed-off-by: PM <wugyresearcher@gmail.com>

* check if message-id already exists

Signed-off-by: PM <wugyresearcher@gmail.com>

* simplify mail message-id procedure

Signed-off-by: PM <wugyresearcher@gmail.com>

* Add unit test

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-10-23 15:49:30 +02:00
johncming
7d21f5a5a9 notify/wechat: adjust result check sequence. (#2044)
Signed-off-by: johncming <johncming@yahoo.com>
2019-09-23 09:31:57 +02:00
Simon Pasquier
5fe5ea77a3
*: check Smarthost validity at config loading (#1957)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-08-28 15:04:40 +02:00
Simon Pasquier
9f7f4ead46
notify: don't use the global metrics registry (#1977)
* notify: don't use the global metrics registry

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

* Address Max's comment

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-08-26 16:37:13 +02:00
Simon Pasquier
94d875f122
Bump prometheus/client_golang to v1.1.0 (#1989)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-08-08 14:36:10 +02:00
Simon Pasquier
655947d7e0
notify: refactor code to retry requests (#1974)
* notify: refactor code to retry requests

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

* s/Process/Check/

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-08-02 16:17:40 +02:00
Asher Foa
f45f870d2c Add the ability to configure slack markdown field (#1967)
* slack markdown field config

Signed-off-by: Asher Foa <asher@asherfoa.com>

* Add Test

Signed-off-by: Asher Foa <asher@asherfoa.com>

* remove empty lines

Signed-off-by: Asher Foa <asher@asherfoa.com>

* add empty line

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-07-31 12:04:59 +02:00
Simon Pasquier
bdd91d2639
notify/opsgenie: log error from OpsGenie API (#1965)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-07-23 09:49:15 +02:00
Simon Pasquier
9b0ecaa0fe
notify/email: wrap all errors for easier debugging (#1953)
* notify/email: wrap all errors for easier debugging

In addition, this commit passes the current context to the TCP dialer
and it doesn't log any QUIT errors if the email delivery wasn't
successful.

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

* Fix typo

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-07-10 11:24:51 +02:00
Simon Pasquier
02c9bb05bf
notify/pagerduty: fix images (#1931)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-06-24 12:19:06 +02:00
Simon Pasquier
0c3120efac *: split notify package
Instead of keeping all notifiers in the notify package, it splits them
into individual sub-packages. This improves readability and
maintainability of the code.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-06-18 15:36:19 +02:00
Simon Pasquier
f1664ac870
notify: truncate description for PagerDuty v1 (#1922)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-06-14 14:41:36 +02:00
Diogo Nicoleti
7ab700a6c2
Merge branch 'master' into slack 2019-06-07 15:12:55 -03:00
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