Commit Graph

274 Commits

Author SHA1 Message Date
TJ Hoplock f6b942cf9b
chore!: adopt log/slog, drop go-kit/log (#4089)
* chore!: adopt log/slog, drop go-kit/log

The bulk of this change set was automated by the following script which
is being used to aid in converting the various exporters/projects to use
slog:

https://gist.github.com/tjhop/49f96fb7ebbe55b12deee0b0312d8434

This commit includes several changes:
- bump exporter-tookit to v0.13.1 for log/slog support
- updates golangci-lint deprecated configs
- enables sloglint linter
- removes old go-kit/log linter configs
- introduce some `if logger == nil { $newLogger }` additions to prevent
  nil references
- converts cluster membership config to use a stdlib compatible slog
  adapter, rather than creating a custom io.Writer for use as the
membership `logOutput` config

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

* chore: address PR feedback

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

---------

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
2024-11-06 09:09:57 +00:00
Jeff Wong 95655dccb8
Discord notifier: Add username and avatar_url (#4081)
* Feat(discord):

Allow for custom username and avatar URLs to be set in discord notifications.

Add `username` and `avatar_url` to discord configuration, default empty string.

Re-implement #3821

Signed-off-by: Jeff Wong <awole20@gmail.com>

* Test the new fields

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

* These are not templeatable strings

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

---------

Signed-off-by: Jeff Wong <awole20@gmail.com>
Signed-off-by: gotjosh <josue.abreu@gmail.com>
Co-authored-by: gotjosh <josue.abreu@gmail.com>
2024-10-24 21:12:05 +01:00
Hottochelli 6b77acd166
Extend discord messages with content (#4007)
* Extend discord messages with content
Signed-off-by: Yevhen Sydorenko <mogoll92@gmail.com>

Signed-off-by: Yevhen Sydorenko <mogoll92@gmail.com>

* Updated configuration.md
Updated assets_vfsdata.go

Signed-off-by: Yevhen Sydorenko <mogoll92@gmail.com>

* Fix grammar

Signed-off-by: Yevhen Sydorenko <mogoll92@gmail.com>

* Updated vfsdata

Signed-off-by: Yevhen Sydorenko <mogoll92@gmail.com>

---------

Signed-off-by: Yevhen Sydorenko <mogoll92@gmail.com>
2024-10-23 19:27:01 +01:00
Christoph Maser 8572fe849c
feat: add rocketchat notifier (#3600)
* feat: add rocketchat notifier

Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
Co-authored-by: George Robinson <george.robinson@grafana.com>

* Update notify/rocketchat/rocketchat.go

Co-authored-by: George Robinson <george.robinson@grafana.com>
Signed-off-by: gotjosh <josue.abreu@gmail.com>

---------

Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
Signed-off-by: gotjosh <josue.abreu@gmail.com>
Co-authored-by: George Robinson <george.robinson@grafana.com>
Co-authored-by: gotjosh <josue.abreu@gmail.com>
2024-10-23 15:38:22 +01:00
Simon Schneider d4009f5e93
feat(3920): add msteamsv2 receiver (#4024)
* feat(3920): add msteamsv2 receiver

Signed-off-by: Simon Schneider <github@simon-schneider.eu>

* Don't use `fmt.Errorf` when there's no formatting required on `config/config.go`

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

* Don't use `fmt.Errorf` when there's no formatting required on `config/notifiers.go`

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

* Remove additional documentation steps

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

* add more info to the documentation

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

* Change documentation links to convey the message better

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

---------

Signed-off-by: Simon Schneider <github@simon-schneider.eu>
Signed-off-by: gotjosh <josue.abreu@gmail.com>
Co-authored-by: gotjosh <josue.abreu@gmail.com>
2024-10-23 11:31:27 +01: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
Kapil Ramwani 25def02a7f
Fix: Hide config.SecretURL when the URL is incorrect. (#3887)
* fix: Hide config.SecretURL when the URL is incorrect.

    Updated the config.go to redact the URL.
    Added test cases to check URL stays hidden.
Signed-off-by: Kapil Ramwani(kanishkramwani6@gmail.com)

---------

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
2024-06-21 16:19:06 +02:00
George Robinson 52eb1fc4aa
Rename matchers package to matcher singular (#3777)
* Rename matchers package to matcher singular

I realized that we had named the package plural "matchers" when
its idiomatic in Go to use singular package names.

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-06-21 16:17:27 +02: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
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
Christoph Maser f82574a376
docs: better descibe `email_config.to` fromat (#3760)
Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
2024-03-14 12:56:31 +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
Luca Kröger efa801faf7
fix discord & msteams webhook url configuration (#3728)
Signed-off-by: Luca Kröger <l.kroeger01@gmail.com>
2024-02-19 16:53:59 +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
George Robinson 848e2191d9
Support UTF-8 label matchers: Add metrics to matchers compat package (#3658)
* Add metrics to matchers compat package

This commit adds the following metrics to the compat package:

  alertmanager_matchers_parse
  alertmanager_matchers_disagree
  alertmanager_matchers_incompatible
  alertmanager_matchers_invalid

With a label called origin to differentiate the different sources
of inputs: the configuration file, the API, and amtool.

The disagree_total metric is incremented when an input is invalid
in both parsers, but results in different parsed representations,
then there is disagreement. This should not happen, and suggests
their is either a bug in one of the parsers or a mistake in the
backwards compatible guarantees of the matchers/parse parser.

The incompatible_total metric is incremented when an input is valid
in pkg/labels, but not the UTF-8 parser in matchers/parse. In such
case, the matcher should be updated to be compatible. This often
means adding double quotes around the right hand side of the matcher.
For example, foo="bar".

The invalid_total metric is incremented when an input is invalid
in both parsers. This was never a valid input.

The tests have been updated to check the metrics are incremented
as expected.

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

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-01-05 10:21:20 +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
George Robinson 4494abfce4
Fix UTF-8 not supported in group_by (#3619)
* Fix UTF-8 not supported in group_by

This commit fixes missing UTF-8 support in the group_by for routes.

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

Signed-off-by: George Robinson <george.robinson@grafana.com>
2023-11-24 11:26:39 +00:00
George Robinson 70bd5dad98
Support UTF-8 label matchers: Use compat package in Alertmanager server (#3567)
* Support UTF-8 label matchers: Use compat package in Alertmanager server

This pull request adds use of the compat package in Alertmanager server that will allow users to switch between the new matchers/parse parser and the old pkg/labels parser. The new matchers/parse parser uses a fallback mechanism where if the input cannot be parsed in the new parser it then attempts to use the old parser. If an input is parsed in the old parser but not the new parser then a warning log is emitted.

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

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2023-11-24 10:01:40 +00: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
Alexander Weaver 412f06255a
Separate and export BuildReceiverIntegrations (#3553)
* Move and export BuildReceiverIntegrations

Signed-off-by: Alex Weaver <weaver.alex.d@gmail.com>

---------

Signed-off-by: Alex Weaver <weaver.alex.d@gmail.com>
2023-10-17 14:45:44 +01:00
George Robinson 6ce841ca22
Fix scheme required for webhook url in amtool (#3509)
* Fix scheme required for webhook url in amtool

This commit fixes issue #3505 where amtool would fail with
"error: scheme required for webhook url" when using amtool
with --alertmanager.url.

The issue here is that UnmarshalYaml for WebhookConfig checks
if the scheme is present when c.URL is non-nil. However,
UnmarshalYaml for SecretURL returns a non-nil, default value
url.URL{} if the response from api/v2/status contains <secret>
as the webhook URL.

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

* Add test for config routes test

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

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2023-09-05 17:53:24 +01:00
Jack 2a83643cdf
update msteams configs (#3495)
Signed-off-by: Jack Zhang <jack4zhang@gmail.com>
2023-09-01 15:03:47 +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
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
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
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
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 Pasquier 0f7d21fd9c
Merge pull request #3209 from rohang98/pointer-to-value-fix
Changes receiver and inhibition rules arrays to slices of value items instead of pointer items
2023-01-19 17:35:29 +01: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
Rohan Gupta df1dc0d359 Changes receiver and inhibition rules arrays to slices of value items
Signed-off-by: Rohan Gupta <rohangupta.0927@gmail.com>
2023-01-18 10:21:51 -05:00
gotjosh 907f7d3e80
Merge pull request #3132 from prometheus/webex-notifier
Notifier: Webex
2022-12-15 13:57:12 -04:00
gotjosh 572de996b7
Remove the `bot_token`
Signed-off-by: gotjosh <josue.abreu@gmail.com>
2022-12-15 11:48:01 -04:00
Erki Esken 9ae611329a
Add check for templated Opsgenie receiver config (#3060)
* Add check for templated Opsgenie receiver config

Solves #2887, where Opsgenie responder type can be templated according
to docs, but configuration logic checked for specific list of values only.

Signed-off-by: Erki Esken <erki@esken.net>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
2022-12-07 22:13:03 +01:00
gotjosh 2c9eb9858e
Change duplicated tags
Signed-off-by: gotjosh <josue.abreu@gmail.com>
2022-11-14 11:24:34 +00:00
gotjosh 7f94b16470
Validate that either bot_token or http_configs.authorization must be present
Signed-off-by: gotjosh <josue.abreu@gmail.com>
2022-11-09 20:07:54 +00:00
gotjosh ac0dc96127
A few changes to better align with what I know think it's the best setup in Webex Teams
- Move away from Webhook to APIRUL
- Make the Room ID a require field
- Set Authorization Credentails via Headers

Signed-off-by: gotjosh <josue.abreu@gmail.com>
2022-11-09 20:07:54 +00:00
gotjosh 9e2608ebff
Notifier: Webex
Cisco's Webex has been one of the most requested notifiers on Grafana for a while now, please see: https://github.com/grafana/grafana/issues/11750#issue-318358659

Given it's straightforward implementation, low maintance overhead and request demand, I think it's worth including this directly in the Alertmanager.

Signed-off-by: gotjosh <josue.abreu@gmail.com>
2022-11-09 20:07:54 +00:00
Matthias Loibl 28c3df0173
Merge pull request #2948 from metalmatze/discord
notify/discord: Create Discord integration
2022-10-25 18:24:19 +02:00
Oktarian T-B dd7214e51f
Add support for reading VictorOps API key from file (#3111)
* Read VictorOps API key from file

* Update documentation

* Improve tests

Signed-off-by: Oktarian T-B <oktariantilneybassett@improbable.io>
2022-10-25 15:40:17 +02:00
Oktarian T-B 1045dc0f21
Add support for reading PagerDuty secrets from files (#3107)
* Add support for reading PagerDuty secrets from files

* Update documentation

Signed-off-by: Oktarian Tilney-Bassett <oktariantilneybassett@improbable.io>
2022-10-14 14:55:59 +02:00
Oktarian T-B d034f116d5
Add PagerDuty source field (PD-CEF) (#3106)
* Add new source field to PD config
* Update documentation

Signed-off-by: Oktarian Tilney-Bassett <oktariantilneybassett@improbable.io>
2022-10-13 14:01:46 +02:00
Joe Blubaugh dc0913b252
EmailConfig: Use CanonicalMIMEHeaderKey instead of TitleCasing for headers (#3080)
* EmailConfig: Use CanonicalMIMEHeaderKey instead of TitleCasing for headers

Fixes #3064.

Signed-off-by: Joe Blubaugh <joe.blubaugh@grafana.com>

* Remove an unused field.

Signed-off-by: Joe Blubaugh <joe.blubaugh@grafana.com>

Signed-off-by: Joe Blubaugh <joe.blubaugh@grafana.com>
2022-09-22 14:41:25 +02:00
Eric R. Rath efc956c7f7
SMTP config: add global and local password file fields (#3038)
* SMTP config: add global and local password file fields

Add config fields (for both global email config and route-specific email
config) that specify path to file containing SMTP password.  We don't
want the password in the config file itself, and reading the password
from a k8s-secret-backed file keeps the password itself "encrypted at
rest" in etcd, and cleanly separated from the rest of the AM config.

I used the same approach as pull request #2534 "Add support to set the
Slack URL in the file"
<https://github.com/prometheus/alertmanager/pull/2534/files> in the
upstream repo.

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* changed *AuthPasswordFile field types to string per review feedback

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* added error to getPassword() retval per review feedback

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* simplified conf.smtp-* files

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* update docs to reflect field type change

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* don't treat username-without-password as invalid

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* test cleanup

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* Apply suggestions from code review

Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Eric R. Rath <4080262+ericrrath@users.noreply.github.com>

* Updated per review feedback

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* added sub-test per review feedback

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* added test on Email.getPassword() per feedback

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* only inherit global SMTP passwords if neither local password field is set

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* removed blank line caught by gofumpt

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
Signed-off-by: Eric R. Rath <4080262+ericrrath@users.noreply.github.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
2022-09-16 14:36:57 +02:00
SuperQ 7b8a5145cd
Update config test to match new prometheus common.
Signed-off-by: SuperQ <superq@gmail.com>
2022-07-25 20:58:24 +02:00
Ben Kochie b55097f490
Merge pull request #3009 from inosato/remove-ioutil
Remove ioutil
2022-07-25 15:58:55 +02:00
SuperQ b0c2f27319
Update build
* Update Go to 1.18
* Update circleci machine image.
* Switch maildev to new upstream image location.
* Update Go modules to 1.17 format.
* Make dependabot monthly to match prometheus/prometheus.

Signed-off-by: SuperQ <superq@gmail.com>
2022-07-23 17:41:36 +02:00
inosato 791e542100 Remove ioutil
Signed-off-by: inosato <si17_21@yahoo.co.jp>
2022-07-18 22:01:02 +09:00