36 Commits

Author SHA1 Message Date
5795ba34f9 Alerting: Update grafana/alerting from de176b4a0309 to 83b6de6b0a35 (#105157)
* Update grafana alerting from de176b4a0309 to 83b6de6b0a35

Includes:
- https://github.com/grafana/alerting/pull/319
- https://github.com/grafana/alerting/pull/317

* Remove unused SendWebhook method from sender struct

grafana/alerting hasn't used the grafana webhook sender for a while now,
so this method is no longer used anywhere.

- Removed SendWebhook from the sender struct and rename it to emailSender
so that its use is clearer.
- Also, for similar reasons, the Webhook method on Grafana's
webhook sender `sendWebRequestSync` should not call grafana/alerting code for
NewTLSClient. The previous grafana/alerting function is vendored into grafana.

* Use BuildReceiverIntegrations new func signature
2025-05-09 12:26:20 -04:00
03e94e7a3e Alerting: Update grafana/alerting (#101215)
* Update grafana/alerting from 9d7e00921e44 to 2acbeef29642

* Change the package for the TLSClient

* Fix TestContactPointFromContactPointExports test
2025-02-25 11:32:28 +01:00
71d04a326b Alerting: Support tls config for webhook receiver (#93513)
Adds the ability to configure tls settings on the webhook receiver (e.g. to skip server certificate validation)
2024-10-22 12:44:32 +02:00
7c69f3657b Notifications: Redact URL from errors (#85687)
* Remove url logs and redact

* Reinclude redacted URL
2024-06-18 16:02:33 -05:00
Jo
062d255124 Handle ioutil deprecations (#53526)
* replace ioutil.ReadFile -> os.ReadFile

* replace ioutil.ReadAll -> io.ReadAll

* replace ioutil.TempFile -> os.CreateTemp

* replace ioutil.NopCloser -> io.NopCloser

* replace ioutil.WriteFile -> os.WriteFile

* replace ioutil.TempDir -> os.MkdirTemp

* replace ioutil.Discard -> io.Discard
2022-08-10 15:37:51 +02:00
efa0d90093 Alerting: Fix Teams notifier not failing on 200 response with error (#52254)
Team's webhook API does not always use the status code to communicate errors.
There are cases where it returns 200 and an error message in the body.
For example, 429 - Too Many Requests or when the message is too large.
Instead, what we should be looking for is a response body = "1".

https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using?tabs=cURL#send-messages-using-curl-and-powershell
2022-07-14 13:15:18 -04:00
bda3dd24e4 chore: remove golang.org/x/net/context in favor of stdlib (#47532)
This PR removes golang.org context imports under pkg/services/* and replaces them with the stdlib context.

Closes #44178
2022-04-11 08:46:21 -04:00
4b1af6fb06 Fix empty contact point URLs when template parsing fails (#47029)
* fix empty URLs

* leave URL templating, use fallback

* better fix, new tests cases

* fix linting errors
2022-03-31 15:57:48 -03:00
c2cad26ca9 Chore: Disable default golangci-lint filter (#29751)
* Disable default golangci-lint filter

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Chore: Fix linter warnings

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-15 09:32:06 +01:00
ac09baae7d Chore: Use Header.Set method instead of Header.Add (#29804)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-14 15:13:01 +01:00
d796c61946 Security: Fixes minor security issue with alert notification webhooks that allowed GET & DELETE requests #29330 2020-11-24 10:42:54 +01:00
9f82cd4713 Slack: Support use of chat.postMessage (#25818)
* set bearer token if token is provided
* update slack notification document

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-06-26 20:47:06 +02:00
2a78d2a61c pkg/services: Check errors (#19712)
* pkg/services: Check errors
* pkg/services: Don't treat context.Canceled|context.DeadlineExceeded as error
2019-10-22 14:08:18 +02:00
a86b8c8a04 http: remove dualstack since its deprecated (#16940)
Deprecated: Fast Fallback is enabled by default. To
disable, set FallbackDelay to a negative value.

https://golang.org/src/net/dial.go
2019-05-08 10:37:48 +02:00
110ffb69de Fix bug tls renegociation problem in Notification channel (webhook) #14800 2019-01-13 21:42:33 +01:00
24636da800 closes the body properly on successful webhooks
this commit also adds a test docker container
for receiving alerting web hook requests
2018-12-27 16:08:13 +01:00
e5e8b9800c merge: fixed conflicts in discord PR 2018-05-07 15:40:43 +02:00
df71fe33fd refactor: refactoring notification service to use new service registry hooks 2018-04-27 14:15:17 +02:00
c1742df9ac remove unused variables detected by varcheck 2018-04-18 19:04:37 +02:00
30f048965c Merge branch 'master' into feature/discord 2018-04-08 20:09:56 +02:00
9a4ae30227 Enable dualstack in every net.Dialer, fixes #9364
Default transport enables it:

* https://github.com/golang/go/blob/d2826d3e06/src/net/http/transport.go#L42-L46

```
    DialContext: (&net.Dialer{
	Timeout:   30 * time.Second,
	KeepAlive: 30 * time.Second,
	DualStack: true,
    }).DialContext,
```

See also: https://github.com/golang/go/issues/15324
2017-09-27 22:29:48 -07:00
1bf982439b Sending image 2017-03-23 21:53:54 +01:00
412b8998a8 webhooks: get proxy settings from ini file
closes #7710
2017-03-02 13:57:28 +01:00
05952688c5 tech: avoid using http.DefaultClient 2017-02-24 17:22:12 +01:00
03354bc49a tech: replace context.TODO with background ctx 2017-02-24 09:20:28 +01:00
f5d8a75381 tech(webhook): remove redundant if statement 2017-01-19 09:29:40 +01:00
376d2d56bf (feature) add LINE notify to notifier 2017-01-19 17:26:53 +09:00
b81e97c99c webhook: adds json content-type
closes #6822
2016-12-05 10:46:04 +01:00
d1eceedf55 feat(webhook): add httpmethod to webhook
closes #6255
2016-10-18 16:50:16 +02:00
c38f6ff182 Make alerting notifcations sync (#6158)
* tech(routines): move the async logic from notification to alerting notifier

* tech(notification): reduce code dupe

* fix(notification): dont touch the response unless its an error

* feat(alerting): make alerting exeuction async but flow sync

* tech(alerting): remove commented code

* tech(alerting): remove unused code

* tech(alerting): fix typo

* tech(alerting): implement Context on EvalContext

* tech(alerting): wait for all alerts to return

* feat(alerting): dont allow alert responses to cancel

* Revert "feat(alerting): dont allow alert responses to cancel"

This reverts commit 324b006c96687da18a542942f39c10c99119430c.

* feat(alerting): give alerts some time to finish before closing down
2016-10-03 09:38:03 +02:00
a49c21df3a fix(png-renderer): increase timeouts 2016-09-22 19:24:18 +02:00
d6fdb598b0 fix(alerting): gofmt 2016-08-08 14:46:47 +02:00
ae5f8a76d9 feat(alerting): lots of progress on notifications, refactored them out to their own package, restored webhook notitication and added slack notification 2016-07-27 12:09:55 +02:00
72e23bca5f tech(alerting): improve/cleanup logging 2016-06-16 08:56:19 +02:00
2e809cae05 tech(alerting): enforce POST for webhooks 2016-06-16 08:16:16 +02:00
efea3bc9cb feat(alerting): skeleton commit for webhook 2016-06-16 08:16:16 +02:00