Commit Graph

430 Commits

Author SHA1 Message Date
Danny Kopping 9c711fc6d1
fix: close SMTP submission correctly to handle errors (#4006)
* fix: close SMTP submission correctly to handle errors

Signed-off-by: Danny Kopping <dannykopping@gmail.com>

* lint

Signed-off-by: Danny Kopping <dannykopping@gmail.com>

* comments

Signed-off-by: Danny Kopping <dannykopping@gmail.com>

---------

Signed-off-by: Danny Kopping <dannykopping@gmail.com>
2024-08-30 15:17:15 +01:00
Simon Pasquier acebbedd10
chore: refactor the JIRA notifier
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2024-08-01 15:35:12 +02:00
Jan-Otto Kröpke a509c14b10
jira integration (#3590)
* Initial jira integration

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
Signed-off-by: Jan-Otto Kröpke <github@jkroepke.de>
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Ben Kochie <superq@gmail.com>
2024-07-31 17:15:26 +02:00
Simon Pasquier 1e6ca4f66d
Merge pull request #3732 from sathieu/default_smtp_tls_config
Support default SMTP TLS config
2024-06-21 16:32:14 +02:00
George Robinson cc6de9c666 Remove Id return from silences.Set(*pb.Silence)
This commit removes the Id from the method silences.Set(*pb.Silence)
as it is redundant. The Id is still set even when creating a silence
fails. This will be fixed in a later change.

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-06-20 15:47:49 +01:00
Emmanuel Lodovice 730bd752d1
Return error when TmplText errors in sns notifier (#3879)
* Return error when TmplText errors in sns notifier

Signed-off-by: Emmanuel Lodovice <lodovice@amazon.com>

* Use fmt.Errorf instead of errors.Wrap

Signed-off-by: Emmanuel Lodovice <lodovice@amazon.com>

---------

Signed-off-by: Emmanuel Lodovice <lodovice@amazon.com>
2024-06-17 09:44:11 +01:00
gotjosh 7e2cd80c2d
Revert "Return error when TmplText errors in sns notifier (#3531)" (#3876)
This reverts commit 603a72800e.
2024-06-14 10:27:32 +01:00
Emmanuel Lodovice 603a72800e
Return error when TmplText errors in sns notifier (#3531)
Signed-off-by: Emmanuel Lodovice <lodovice@amazon.com>
2024-06-13 08:21:49 +01:00
Marc Brugger 06b389bfec
allow webex roomID from template (#3801)
Signed-off-by: bakito <github@bakito.ch>
2024-05-30 14:20:38 +01:00
George Robinson c4a763c401
#3513: Mark muted alerts (#3793)
* Mark muted groups

This commit updates TimeMuteStage and TimeActiveStage to mark groups
as muted when its alerts are muted by an active or mute time interval,
and remove any existing markers when outside all active and mute
time intervals.

Signed-off-by: George Robinson <george.robinson@grafana.com>

* Remove unlock to defer

Signed-off-by: George Robinson <george.robinson@grafana.com>

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-05-13 11:16:26 +01:00
George Robinson dacbf0050b
#3513: TimeMuter returns the names of time intervals (#3791)
* TimeMuter returns the names of time intervals

This commit updates the TimeMuter interface to also return the names
of the time intervals that muted the alerts.

Signed-off-by: George Robinson <george.robinson@grafana.com>

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-04-30 12:47:00 +01:00
Gokhan a9b5cb4351
Enable setting ThreadId for Telegram notifications (#3638)
* Enable setting ThreadId for telegram notifications

Signed-off-by: Gokhan Sari <gokhan@sari.m

---------
Signed-off-by: gotjosh <josue.abreu@gmail.com>
2024-04-30 11:12:58 +01:00
Holger Freyther cb9724db47
notify/webhook: Fix crash on errors when url_file is used (#3798) (#3800) 2024-04-12 11:28:59 +02:00
George Robinson fc8c7d146f
#3513: Rewrite TestTimeMuteStage tests (#3794) 2024-04-11 13:53:50 +02:00
George Robinson 2dc23c90c9
Rewrite TestTimeActiveStage tests (#3795)
This commit rewrites the existing TestTimeActiveStage unit tests
to have complete isolation between test cases. Before this change,
each test case affected the state of its subsequent tests.

The motivation behind this change is to make it easier to assert
that alerts have been marked as muted.

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-04-11 11:42:16 +02:00
George Robinson 342f6a599c
Add godot linter (#3613)
* Add godot linter

Signed-off-by: George Robinson <george.robinson@grafana.com>

* Remove extra line from LICENSE

Signed-off-by: George Robinson <george.robinson@grafana.com>

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-03-21 11:26:46 +00:00
George Krajcsovits d85bef20d9
feature: add native histogram support to latency metrics (#3737)
Note that this does not stop showing classic metrics, for now
it is up to the scrape config to decide whether to keep those instead or
both.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-02-29 14:53:47 +00:00
Mathieu Parent ef5e903418 Support default SMTP TLS config
Fixes: #3709

Signed-off-by: Mathieu Parent <math.parent@gmail.com>
2024-02-22 16:02:19 +01:00
gotjosh 80b3cb072f
Notify: Several improvements around the `suppressed_total` metric and logs for muting. (#3723) 2024-02-15 11:12:58 +00:00
TJ Hoplock f00025d037
feat: add counter to track alerts dropped outside of time_intervals (#3565)
* feat: add counter to track alerts dropped outside of time_intervals

Addresses: #3512

This adds a new counter metric `alertmanager_alerts_supressed_total`
that is incremented by `len(alerts)` when an alert is suppressed for
being outside of a time_interval, ie inside of a mute_time_intervals or
outside of an active_time_intervals.

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>

* test: add time interval suppression metric checks for notify

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>

* test: fix failure message log values in notifier

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>

* ref: address PR feedback for #3565

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>

* fix: track suppressed notifications metric for inhibit/silence

Based on PR feedback:

https://github.com/prometheus/alertmanager/pull/3565/files#r1393068026

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>

* fix: broken notifier tests

- fixed metric count check to properly check the diff between
  input/output notifications from the suppression to compare to suppression
metric, was previously inverted to compare to how many notifications it
suppressed.
- stopped using `Reset()` to compare collection counts between the
  multiple stages that are executed in `TestMuteStageWithSilences()`.
the intent was to compare a clean metric collection after each stage
execution, but the final stage where all silences are lifted results in
no metric being created in the test, causing `prom_testutil.ToFloat64()`
to panic. changed to separate vars to check counts between each stage,
with care to consider prior counts.

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>

* rename metric and add constants

Signed-off-by: gotjosh <josue.abreu@gmail.com>

---------

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
Signed-off-by: gotjosh <josue.abreu@gmail.com>
Co-authored-by: gotjosh <josue.abreu@gmail.com>
2024-02-13 11:17:24 +00:00
Philipp B 3d49ff83c7
feat: implement webhook_url_file for discord and msteams (#3555)
* feat: implement webhook_url_file for discord

implements #3482

Signed-off-by: Philipp Born <git@pborn.eu>

* feat: implement webhook_url_file for msteams

implements #3536

Signed-off-by: Philipp Born <git@pborn.eu>

---------

Signed-off-by: Philipp Born <git@pborn.eu>
2024-02-07 10:33:46 +00:00
Giorgio Gallo 4271a77bd0
Newlines in smtp password file are now ignored 2024-01-22 21:26:18 +01:00
Matthieu MOREL b9e347b9d1 golangci-lint: enable testifylint linter
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-12-10 08:50:03 +00:00
Matthieu MOREL b81bad8711 use Go standard errors
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-12-08 16:44:13 +01:00
Walther Lee 3416d5a4f5
Add context reasons to notifications failed counter (#3631)
---------

Signed-off-by: Walther Lee <walther.lee@reddit.com>
Co-authored-by: Walther Lee <walther.lee@reddit.com>
Co-authored-by: Ben Kochie <superq@gmail.com>
2023-12-08 15:30:43 +01:00
romankubu 4f0bdf4940
Add summary to msteams notification (#3616)
* Add summary to msteams notification

Signed-off-by: Roman Kubu <Roman.Kubu@airbank.cz>
---------

Signed-off-by: Roman Kubu <Roman.Kubu@airbank.cz>
Signed-off-by: romankubu <112698283+romankubu@users.noreply.github.com>
Co-authored-by: Jack <jack4zhang@gmail.com>
2023-11-24 08:58:57 +00:00
Tomas Kozak d2b6692f2c
Reflect Discord's max length message limits (#3597)
* Reflect Discord's max length message limits

Signed-off-by: Tomas Kozak <kozak@talko.cz>

* Fix log key name

Signed-off-by: Tomas Kozak <kozak@talko.cz>

---------

Signed-off-by: Tomas Kozak <kozak@talko.cz>
2023-11-15 07:37:47 +00:00
George Robinson d2501323d2
Add debug logs for muted alerts (#3558)
This commit adds debug logs to MuteStage that logs when an alert
is muted. This can help operators root cause missing notifications
when alerts are silenced by mistake or purpose but then forgotten
about.

Signed-off-by: George Robinson <george.robinson@grafana.com>
2023-10-24 18:00:38 +01:00
George Robinson 98290c3349
Add duration to the notify success message (#3559)
This commit updates Alertmanager to add a duration to the notify
success message. It complements the existing histogram to offer
fine-grained information about notification attempts. This can be
useful when debuggin duplicate notifications, for example, when
the duration exceeds peer_timeout.

Signed-off-by: George Robinson <george.robinson@grafana.com>
2023-10-17 09:50:33 +01:00
gotjosh acb58400fd
Refactor: Move `inTimeIntervals` from `notify` to `timeinterval` (#3556)
* Refactor: Move `inTimeIntervals` from `notify` to `timeinterval`

There's absolutely no change of functionality here and I've expanded coverage for similar logic in both places.
---------

Signed-off-by: gotjosh <josue.abreu@gmail.com>
2023-10-13 14:15:05 +01:00
gotjosh eef3708925
Remove duplicate integration from metrics
This is harmless as the vector won't be duplicated but let's remove it anyways.

Signed-off-by: gotjosh <josue.abreu@gmail.com>
2023-09-08 15:26:36 +01:00
Colin Douch cfe4411deb
Add the receiver name to notification metrics (#3045)
* Add receiver name as a label to notify metrics

This commit adds in a second label to the notify family of metrics
(e.g. numTotalFailedNotifications) - the receiver name. This allows
disambiguating which receiver is failing when one has many receivers
with the same integration type

Signed-off-by: sinkingpoint <colin@quirl.co.nz>

* Gate receiver names behind a feature flag

Signed-off-by: sinkingpoint <colin@quirl.co.nz>

---------

Signed-off-by: sinkingpoint <colin@quirl.co.nz>
Signed-off-by: gotjosh <josue.abreu@gmail.com>
Co-authored-by: gotjosh <josue.abreu@gmail.com>
2023-09-06 13:42:55 +01:00
Hélia Barroso ba303644e6
Add missing ttl in pushhover (#3474)
---------

Signed-off-by: Hélia Barroso <helia.barroso@farfetch.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
2023-08-31 17:35:04 +02:00
Rita Canavarro 9063957924
[FEAT] Add missing integrations to notify metrics (#3480)
Signed-off-by: rita.canavarro <rita.canavarro@farfetch.com>
2023-08-24 21:20:42 +01:00
Anton Tolchanov 94625df2b2
Treat error response payloads from Slack as errors (#3121)
As described in the "More error types" section below, Slack API can return
errors with a 200 response code:
https://slack.dev/node-slack-sdk/web-api#handle-errors

This change adds parsing of API response to extract error messages.

Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2023-08-10 10:59:13 +01:00
George Robinson 638f41c215
Log the GroupKey and alerts in retry (#3438)
This commit updates notify.go to log the GroupKey and fingerprints
of an alert at the debug level, and just the GroupKey at the
warning level should the notify attempt fail.

Signed-off-by: George Robinson <george.robinson@grafana.com>
2023-08-07 11:31:28 +01:00
Jack d10f21f38c
Add msteams (#3324)
* Add msteams

Signed-off-by: Jack Zhang <jack4zhang@gmail.com>
---------
Signed-off-by: Jack Zhang <jack4zhang@gmail.com>
Signed-off-by: Jack <jack4zhang@gmail.com>
2023-06-08 11:27:56 -04:00
Davide Bizzarri 140c3d683f notify/webhook: trim space from url_file content
Signed-off-by: Davide Bizzarri <davide.bizzarri@neoom.com>
2023-05-16 13:30:06 +02:00
Alec 3b9cd0408e
Add support for pushover devices (#3318)
* Add support for pushover devices

Signed-off-by: Alec Pinson <30310787+alec-pinson@users.noreply.github.com>

* update docs

Signed-off-by: Alec Pinson <30310787+alec-pinson@users.noreply.github.com>

---------

Signed-off-by: Alec Pinson <30310787+alec-pinson@users.noreply.github.com>
2023-05-05 13:04:47 +01:00
gotjosh 0f3ab929fa
Slack Notifier: Only return an error when it actually occurs (#3350) 2023-05-02 17:59:37 +01:00
gotjosh 4dc20154f6
add reason code to slack notifier (#3252)
* add reason code to slack notifier
this uses the new error with reason to determine based on status code what the reason is for the slack integration

partial #3231

Signed-off-by: gotjosh <josue.abreu@gmail.com>

* Add some tests

Signed-off-by: gotjosh <josue.abreu@gmail.com>

* Handle the error

Signed-off-by: gotjosh <josue.abreu@gmail.com>

---------

Signed-off-by: gotjosh <josue.abreu@gmail.com>
2023-04-28 14:05:56 +01:00
r0nn f040f089aa
fix wechat notifier response field name (#3330)
Signed-off-by: gotjosh <josue.abreu@gmail.com>
2023-04-28 12:40:49 +01:00
Yijie Qin 9a8d1f976e
add reason code to notifiers (#3307)
* add reason code to notifiers

Signed-off-by: Yijie Qin <qinyijie@amazon.com>
2023-04-07 17:05:17 +02:00
Simon Pasquier bb1c123b7f
Merge pull request #3226 from an5t/telegram-token-file
Support loading Telegram bot token from file
2023-04-06 17:15:17 +02:00
Simon Rozet 41eb1213bb
support loading webhook URL from a file (#3223)
* support loading webhook URL from a file

/cc #2498

Signed-off-by: Simon Rozet <me@simonrozet.com>

* notify/webhook: add test for reading url from file

Signed-off-by: Simon Rozet <me@simonrozet.com>

* notify/pushover: add tests for reading secrets from files

Signed-off-by: Simon Rozet <me@simonrozet.com>

---------

Signed-off-by: Simon Rozet <me@simonrozet.com>
2023-03-03 15:31:14 +01:00
Yijie Qin 7923bc5f8e
add status code label to the numTotalFailedNotifications metric (#3094)
* add reason label to the numTotalFailedNotifications metric

Signed-off-by: Yijie Qin <qinyijie@amazon.com>
2023-02-03 12:09:21 +00:00
Simon Rozet 8f559aad34
mark webhook URL as a secret (#3228)
Signed-off-by: Simon Rozet <me@simonrozet.com>
2023-02-02 16:23:51 +00:00
Andrey Mishakin 6c9c58015e Support loading Telegram bot token from file
Signed-off-by: Andrey Mishakin <stieroglif@gmail.com>
2023-01-22 16:35:01 +03:00
Simon Rozet a8e4c166a8
support loading pushover secrets from files (#3200)
* support loading pushover secrets from files

Add the user_key_file and token_file keys to the pushover config.

/cc https://github.com/prometheus/alertmanager/issues/2498

Signed-off-by: Simon Rozet <me@simonrozet.com>
2023-01-18 23:33:42 +01:00
Simon Pasquier ebcea59acc
Merge pull request #3190 from prometheus/release-0.25
Release 0.25
2023-01-05 14:35:35 +01:00