Commit Graph

123 Commits

Author SHA1 Message Date
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
Simon Pasquier f65137ac2d
Use pinned version of juice for assets generation (#3972)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2024-08-21 16:49:10 +01:00
Simon Pasquier 9fb440d239
Fix assets generation
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2024-08-13 16:57:41 +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
Sergey 33e680a34d
feat: add time helpers (#3863)
Signed-off-by: Sergey <freak12techno@gmail.com>
Co-authored-by: gotjosh <josue.abreu@gmail.com>
2024-06-05 15:23:42 +01:00
George Robinson dc1e1a2b88
Add date and tz functions to templates (#3812)
* Add date and tz functions to templates

This commit adds the date and tz functions to templates. This means
users can now format time in a specified format and also change
the timezone to their specific locale.

An example of how these functions work, and can be composed together,
can be seen here:

	{{ .StartsAt | tz "Europe/Paris" | date "15:04:05 MST" }}

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

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-04-22 16:15:33 +02: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
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
Simon Pasquier 84f8f4e620
Update email assets after #3420 (#3440)
* Add template/email.tmpl to the clean target

The change ensures that all assets can be regenerated from scratch in
the CI.

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

* Update email assets after #3420

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

---------

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2023-08-04 14:42:18 +01:00
Alvin Lin 7411e5436a
Update email.html to use "https://schema.org" instead of "https://schema.org" (#3420)
According to schema.org's faq both https and http are fine, but https is preferred going forward: https://schema.org/docs/faq.html#19

Why am I making this change? To make some security code scanner happy :)

Signed-off-by: Alvin Lin <alvinlin123@gmail.com>
2023-08-03 09:33:32 +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
George Robinson 72b0cb0f40
Fix comments as per Josh's feedback (#3284) 2023-03-07 11:25:20 +00:00
George Robinson 012dbc9d81
Fix corruption in templates that use title function (#3278)
This commit fixes data corruption in templates that use the title
function as it used a shared cases.Title when casers should not
be shared between goroutines. When templates that used the title
function were executed at the same time, data corruption would occur
in the text that was being cased. This is fixed using a separate
caser for each function call.

Add tests to assertDefaultFuncs are thread-safe

Signed-off-by: George Robinson <george.robinson@grafana.com>
2023-03-07 11:37:39 +01:00
Ghazanfar d8bea84adc
Make TrimSpace available for use in the template (#3281)
* Make TrimSpace available for use in the template

Signed-off-by: Ghazanfar <ghazanfar.isc@gmail.com>
2023-03-07 09:38:57 +01:00
Furkan Türkal 57cad0d272
Seperate the template creating functions for as-lib use (#3225)
* Separate the template creating functions for as-lib use

Fixes #3217

Signed-off-by: Furkan <furkan.turkal@trendyol.com>
---------

Signed-off-by: Furkan <furkan.turkal@trendyol.com>
2023-02-24 10:24:00 +00:00
George Robinson 11d0b57c97
Implement Stringer interface for Pairs and KVs (#3256)
This commit implements the Stringer interface for Pairs and KVs.
It changes how Pairs are printed in templates from
map[name1:value1 name2:value2] to name1=value1, name2=value2. KVs
work similar, but are first sorted into pairs before being printed.

Signed-off-by: George Robinson <george.robinson@grafana.com>
2023-02-22 11:38:15 +00:00
Martin Chodur 26cbd6bd86
feat: add template.FromGlobsWithAdditionalFuncs (#3174)
* refactor: add Options to the template.FromGlob function to allow customizing the Template

Signed-off-by: Martin Chodur <m.chodur@seznam.cz>
2022-12-16 10:13:13 -04:00
gotjosh 907f7d3e80
Merge pull request #3132 from prometheus/webex-notifier
Notifier: Webex
2022-12-15 13:57:12 -04:00
Simon Pasquier b29629ff13 Fix email template for resolved notifications
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2022-12-08 16:43:05 +01: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
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
Matthias Loibl 550952eb51
notify/discord: Create Discord integration
Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>
2022-07-04 22:56:48 +02:00
Tim 1138a088f6
Adding telegram support (#2827)
* added telegram config in notifiers

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* added telegram config to config.go

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* added package telegram to notify and initialization in cmd

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* added telegram.default.message

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* added telegram template to notifiers.go

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* added message rendering from template to telegram integration

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* documentation for telegram_configs

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* added tests for telegram

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* fixed config_test.go

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* added valid parse_mode list to the error log

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* made use of httpconfig, moved telegram client creation to New func, changed message truncation to 4096 chars

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* changed supported values for telegram config

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* added mock url for telegram tests to pass

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* added api_url check to telegram config

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* changed bot_token type to secret

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* removed extra emptyline

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* convert bot_token to string in telegram client creation

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* updated configuration.md

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* fixed mixed up errors

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>

* check telegram api url without conversion to string

Signed-off-by: timmilesdw <tuktamyshev.t0308@gmail.com>
2022-02-22 17:51:02 +01:00
Brad Ison c0a7b75c9c
Automate CSS-inlining for default HTML email template (#2798)
* Automate CSS-inlining for default HTML email template

The original HTML email template was added in `template/email.html`.
It looks like the CSS was manually inlined.  Most likely using the
premailer.dialect.ca web form, which is mentioned in the README for
the Mailgun transactional-email-templates project.  The resulting HTML
with inlined CSS was then copied into `template/default.tmpl`.  This
has resulted in `email.html` and `default.tmpl` diverging at times.

This commit adds build automation to inline the CSS automatically
using [juice][1].  The Go template containing the resulting HTML has
been moved into its own file to avoid the script that performs the CSS
inlining having to parse the `default.tmpl` file to insert it there.

Fixes #1939.

[1]: https://www.npmjs.com/package/juice

Signed-off-by: Brad Ison <bison@xvdf.io>

* Update asset/assets_vfsdata.go

Signed-off-by: Brad Ison <bison@xvdf.io>
2022-01-03 17:33:53 +01:00
Tyler Reid b509a5bdbb Add subject template for subject field. Better check for supplied creds, use GetTopicAttributes to check fifo
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-15 17:24:52 -05:00
Tyler Reid 19e74f9ce7 WIP - SNS receiver
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-09 21:14:07 -05:00
Jon Campbell 8e861c646b
Corrected Template Username Casing (#2345)
* Corrected Template Username Casing

Signed-off-by: midnightconman <midnightconman@gmail.com>

* Added assets_vfsdata

Signed-off-by: midnightconman <midnightconman@gmail.com>
2020-08-12 17:53:56 +02:00
Julien Pivotto 1cba0c7a37
Remove HipChat (#2281)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-06-11 15:51:10 +02:00
Vincent Rischmann 66a0ed21bd template: add the default template function stringSlice (#2101)
Since it's impossible to create a string slice in a Go template by
default, add a function to work around this problem.

The use case is to make it easy to call KV.Remove with an arbitrary
slice inside a template.

Signed-off-by: Vincent Rischmann <vincent@rischmann.fr>
2019-11-13 09:32:51 +00:00
Tim Reddehase d517f786ef Allow slashes in receivers (#2011)
* do not split receiver by slash

I'm not sure why this was originally done, because a slash seems to be perfectly
valid in a receiver definition. The only issue i encountered was that linking
from a fired alert was not working, because of the splitting performed here.

Signed-off-by: Tim Reddehase <tim.reddehase@xing.com>

* urlquery escape Receiver by default for URL

If Receiver is allowed to contain slashes and other special characters
we need to percent encode them properly.

Signed-off-by: Tim Reddehase <tim.reddehase@xing.com>

* rerun make asset/assets_vfsdata.go

Signed-off-by: Tim Reddehase <tim.reddehase@xing.com>
2019-08-28 10:01:47 +02:00
stuart nelson f450720213 Add fingerprint to expected template test output (#1968)
This was recently added and the test needs to be updated.

Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
2019-07-23 09:57:24 +02:00
stuart nelson e7275537ff
Merge pull request #1945 from kfdm/webhook-fingerprint
Add Fingerprint to template data
2019-07-22 17:02:29 +02:00
Simon Pasquier bb3df011a3
Move break at the beginning fo the for loop (#1928)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-07-04 15:31:09 +02:00
Paul Traylor 6fbbda75ed Add Fingerprint to template data
Signed-off-by: Paul Traylor <paul.traylor@linecorp.com>
2019-06-28 17:35:32 +09:00
lvjiawei 46a59f12d5 Invalid APISecret error if only set default api_secret for wechat
Signed-off-by: lvjiawei <lvjiawei@cmss.chinamobile.com>
2019-05-15 02:54:03 -07: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
Simon Pasquier 3558e6fd9e Migrate from go-bindata to vfsgen (#1532)
* Migrate from go-bindata to vfsgen

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

* Ensure idempotent generation for vfsgen

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

* asset: update generated files

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

* Fix asset paths for Windows platforms

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

* Regenerate assets

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

* Add vfs wrapper that returns constant mod time

This is identical to what we had with go-bindata and avoids the extra
step of storing the identity of the complete file system in another
location.

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

* Additional cleanup

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-09-24 15:12:40 +02:00
Ben Chess 235944cc5f Email is green if only none firing (#1475)
Signed-off-by: Benjamin Chess <bchess@gmail.com>
2018-07-23 14:06:46 +02:00
Max Inden a736a90dd0
Merge pull request #1436 from simonpasquier/fix-wechat-templ
notify: catch templating errors for Wechat
2018-07-05 14:52:16 +02:00
Max Inden 7d70fd9031
Merge pull request #1421 from palmerabollo/patch-1
fix: email template typo in alert-warning style
2018-07-04 10:00:39 +02:00
Waldemar Biller 4e8a910b9d Lookup parts in strings using regexp.MatchString (#1452)
Signed-off-by: Waldemar Biller <wbiller@gmail.com>
2018-07-03 10:55:47 +01: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
Guido García fd97b969c8 fix: email template typo in alert-warning style
Signed-off-by: Guido García <guido.garciabernardo@telefonica.com>
2018-06-18 17:39:26 +02:00
Simon Pasquier 0c512998ee Use Makefile.common from Prometheus (#1396)
* Include Makefile.common
* Fix the bindata.go files to make the style target happy
* Inline `.PHONY` statements

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-06-13 14:41:52 +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