* adding state to the payload
* fix test
* fix linter
* documentation payload current state
* Apply suggestions from code review
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
* Make sure Metric field in Discord notification is never empty
Discord uniquely does not send the alert if the metric field is empty, which can happen in some cases, such as when the legend is {{hostname}}.
Signed-off-by: Levi Harrison <levisamuelharrison@gmail.com>
* Changed name of empty metric in Discord alert
Signed-off-by: Levi Harrison <levisamuelharrison@gmail.com>
Fixes behaviour of Notify that returns error when one of the dispatch
event return error, to maintain high availability, we should return error
when all dispatched events return error instead.
Fixes#30509
* Introduce PluginRequestValidator abstraction with a NoOp implementation
* Update PluginRequestValidator abstraction to use the dsURL instead
* Inject PluginRequestValidator into the HTTPServer and validate requests going through data source proxy
* Inject PluginRequestValidator into the BackendPluginManager and validate requests going through it
* Validate requests going through QueryMetrics & QueryMetricsV2
* Validate BackendPluginManager health requests
* Fix backend plugins manager tests
* Validate requests going through alerting service
* Fix tests
* fix tests
* goimports
Co-authored-by: Leonard Gram <leo@xlson.com>
* Always use cache: stop passing skipCache among ngalert functions
* Add updated column
* Scheduler initial draft
* Add retry on failure
* Allow settting/updating alert definition interval
Set default interval if no interval is provided during alert definition creation.
Keep existing alert definition interval if no interval is provided during alert definition update.
* Parameterise alerting.Ticker to run on custom interval
* Allow updating alert definition interval without having to provide the queries and expressions
* Add schedule tests
* Use xorm tags for having initialisms with consistent case in Go
* Add ability to pause/unpause the scheduler
* Add alert definition versioning
* Optimise scheduler to fetch alert definition only when it's necessary
* Change MySQL data column to mediumtext
* Delete alert definition versions
* Increase default scheduler interval to 10 seconds
* Fix setting OrgID on updates
* Add validation for alert definition name length
* Recreate tables
* cater for empty labels and new DisplayNameFromDS field
* simplify
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
* increase priority for ds display name
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
* Add support for Sensu Go notification channel
Similar to current support for the older "Core" version of
Sensu, this commit add support for the newer version.
Closes#19908
Signed-off-by: Todd Campbell <todd@sensu.io>
* fix linter errors
Signed-off-by: Todd Campbell <todd@sensu.io>
* Apply suggestions from code review
PR review suggestions
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix no new variables error
* Replace convey testing with testify
Signed-off-by: Todd Campbell <todd@sensu.io>
* Wording suggestions
Signed-off-by: Todd Campbell <todd@sensu.io>
* Add docker compose environment for testing/maintenance
Signed-off-by: Todd Campbell <todd@sensu.io>
* Renamed and fixed docker-compose.yaml to work in devenv
Signed-off-by: Todd Campbell <todd@sensu.io>
* Change sensugo web UI port to 3080 so as not to conflict with grafana
Signed-off-by: Todd Campbell <todd@sensu.io>
* Apply suggestions from code review
Set the API key as a secure value.
Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
* Add Sensu Go information to notifications doc
Signed-off-by: Todd Campbell <todd@sensu.io>
* Update pkg/services/alerting/notifiers/sensugo.go
Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
* change assert to require for Error/NoError tests
Signed-off-by: Todd Campbell <todd@sensu.io>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
* implement edit page
* connectWithCleanup
* remove angular related code
* use loadingindicator
* use the correct loading component
* handle secureFields
* fixed implementation of secure fields
* Keep secureFields after rerendering the form
* CollapsableSection and Page refactor
* use checkbox instead of switch
* fix comment
* add cursor to section
* Fixed issues after PR review
* Fix issue with some settings being undefined
* new reducer and start with test
* algorithm to migrate secure fields
* UX: Minor UI Tweaks
* Added field around checkboxes, and missing required field
* fixed test
* tests for util
* minor tweaks and changes
* define as records
* fix typ error
* forward invalid to textarea and inputcontrol
* merge formdata and redux data in test
* fix issue with creating channel
* do not figure out securefields in migration
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
Can be hard for users to understand what user is configured
when encrypting the username field why this reverts to
store the username in cleartext.
Also, we don't encrypt username for data sources.
Ref #25967
Support storing sensitive notification settings securely/encrypted.
Move slack notifier url and api token to secure settings.
Migrating slack notifier to store token and url encrypted is currently
a manual process by saving an existing slack alert notification channel.
saving an existing slack alert notification channel will reset the stored
non-secure url and token.
Closes#25113
Ref #25967
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
* creating page
* add types select
* adding switches
* start with converting angular templates to json
* converting more alert channels to new format
* convert remaining channels
* typing the form
* add validation, update models
* fix default value in type select
* fix type
* fix issue with validation rule
* add missing settings
* fix type errors
* test notification
* add comments to structs
* fix selectable value and minor things on each channel
* More typings
* fix strictnull
* rename ModelValue -> PropertyName
* rename show -> showWhen
* add enums and adding comments
* fix comment
* break out channel options to component
* use try catch
* adding default case to OptionElement if element not supported
* Alerting: Adds support for multiple URLs in Alertmanager notifier
Adds support for multiple URLs in Alertmanager notifier following
alertmanager documentation for high availability setup.
Update the documentation for alertmanager notifier.
Closes#24195
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
Co-authored-by: bergquist <carl.bergquist@gmail.com>
* Datasource/Cloudwatch: Adds support for Cloudwatch Logs
* Fix rebase leftover
* Use jsurl for AWS url serialization
* WIP: Temporary workaround for CLIQ metrics
* Only allow up to 20 log groups to be selected
* WIP additional changes
* More changes based on feedback
* More changes based on PR feedback
* Fix strict null errors
When Include image is enabled for an alert notification channel, but there's
no image renderer available/installed when sending notification an error
image will be uploaded/attached explaining that you need to install the
Grafana Image Renderer plugin.
Ref #13802
Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>
Removes all references and usage of PhantomJS #23375.
Remove direct link rendered image e2e smoke test for now.
Docker: Fix installing chrome in ubuntu custom docker image.
Improve handling of image renderer not available/installed #23593.
Add PhantomJS breaking change and upgrading notes.
Use grabpl v0.2.10.
Closes#13802
Co-authored-by: Kyle Brandt <kyle@grafana.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
* Hangouts: fixes notifications for alerts with empty message
* Update pkg/services/alerting/notifiers/googlechat.go
Co-Authored-By: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
data.Frame (that can be series) are converted to as tsdb.TimeSeriesSlice - so new backend plugins can be shimmed into existing alerting
use sdk v0.31.0
* AlertNotifications: Translate notifications IDs to UIDs in alert Rule builder
* Avoid shadowing errors, raise validation error on non-existing notification id
* create a cache for notification Uids to minimize db overhead
* add cache usage test
* avoid caching empty notification Uids
* isolate db in alert notificationUid caching tests
By storing render key in remote cache it will enable
image renderer to use public facing url or load
balancer url to render images and thereby remove
the requirement of image renderer having to use the
url of the originating Grafana instance when running
HA setup (multiple Grafana instances).
Fixes#17704
Ref grafana/grafana-image-renderer#91
- Fix bug with NaN in alerting - Closes#21953
- Alert reducers (avg/max/etc) drop null values from their calculation. This change makes it so NaN values are handled in the same way as null values.
Add support for passing tags to Pagerduty and allow notification
on specific event categories such as Class, Group and Component.
Ref #19912, #19913
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
* svc alerting - use a shorter ctx to upload the img
This will prevent timeout on img upload to cancel the notifications from being sent
* components img uploader - pass the ctx to aws lib
* make webdavuploader use the ctx
* make azureblobuploader use the ctx
* rename uploadImage() to renderAndUploadImage()
for better clarity about what this method work
* Use timeout + 2s for plugin renderer (same as service and phantomjs)
* Make sure that original EvalContext is updated after render and upload
* Verify notification sent even if render or image upload times out
* fix lint
* fixes after review
Co-authored-by: Edouard Hur <3418467+hekmon@users.noreply.github.com>
Fixes#21018
* add min_interval_seconds setting to alerting config
It will let operator enforce a minimum time for the scheduler to enqueue evaluations
* Introduce UI modifications
* Update docs
Co-authored-by: Martin <uepoch@users.noreply.github.com>
OpsGenie's model works heavily off of the priority of an alert,
e.g. routing and escalation. Currently this plugin only supports
the default "P3".
Setting a tag og_priority to the correct P-value, e.g. P1, P2, P3,
P4 or P5, will call the OpsGenie API with the correct priority value
set.
Add fallbackText to Google Chat notifications.
Definition of fallbackText: A plain-text description of the message's
cards, used when the actual cards cannot be displayed,
e.g. mobile notifications.
Fixes#21463
When an alert is sent by e-mail, the process sends an e-mail to
each recipient separately. This PR is a single delivery to all recipients.
For companies that use e-mail extensively, this is necessary in order
not to overload the sending queue.
Replaces #18013Fixes#12650
Co-authored-by: Henrique Oliveira <holiiveira@users.noreply.github.com>
* Pagerduty notifier: configurable severity
Instead of hardcoding `critical` make it configurable per notification channel instance.
* fix html
* Add a test to ensure default severity is correct
* Notifications doc
* Add a non-default test
* Add err check on NewJson (all tests)
* Add default severity (critical) to AlertNotificationEditCtrl class
Fixes so that all notification channels configured for an alert should
try to send notification even if one notification channel fails to send
a notification.
Signed-off-by: Abhilash Gnan <abhilashgnan@gmail.com>
Fixes#19768
* Emails: resurrect template notification
* Phantomjs (oh yeah, there is another dev dep phantom :-) was failing for
the generation of the html templates so I had to update the dependencies
in order to fix it. While doing that I update the scripts field and docs
for it as well. yarn.lock is included
* Move splitting of the emails to separate helper function, since more services
coming up that would need to use this functionality
* Add support for enterprise specific email letters. Probably could
be done in the better way, but it's not a priority right now
* added alert rule tags in webhook notifications
* fix: don't include whole list of Tag objects but only key/value pairs in Webhook JSON
* marked webhook alerts to support alert rule tags
* Metrics: remove unused metrics
Metric `M_Grafana_Version` is not used anywhere, nor the mentioned
`M_Grafana_Build_Version`. Seems to be an artefact?
* Metrics: make the naming consistent
* Metrics: add comments to exported vars
* Metrics: use proper naming
Fixes#18110
* Build: use golangci-lint as a make command
* Since gometalinter was deprecated in favor of golangci-lint so it was
replaced by it. Responsibilities held by the gometalinter was moved to
golangci-lint
* There was some changes in implementation (that was also mentioned in
the code comment) between the tools, which uncovered couple errors
in the code. Those issues were either solved or disabled by
the inline comments
* Introduce the golangci-lint config, to make their
configuration more manageable
* Build: replace backend-lint.sh script with make
* tsdb: add support for setting debug flag of tsdb query
* alerting: adds debug flag in eval context
Debug flag is set when testing an alert rule and this debug
flag is used to return more debug information in test aler rule
response. This debug flag is also provided to tsdb queries so
datasources can optionally add support for returning additional
debug data
* alerting: improve test alert rule ui
Adds buttons for expand/collapse json and copy json to clipboard,
very similar to how the query inspector works.
* elasticsearch: implement support for tsdb query debug flag
* elasticsearch: embedding client response in struct
* alerting: return proper query model when testing rule
Adds new alert settings for configuring timeouts and retries named
evaluation_timeout_seconds, notification_timeout_seconds
and max_attempts.
Closes#16240
If an image section is included in the JSON payload for MS Teams alerts
when no image URL exists, rendering of the alert in the client fails.
This change makes sure that an image section is only included in the
JSON payload if an image URL exists.
Closes#16082