Skip to content

Commit

Permalink
Added documentation for the use of autoconfigured NotificationFilterC…
Browse files Browse the repository at this point in the history
…ontroller (#2803)

Added documentation for the use of autoconfigured NotificationFilterController.
  • Loading branch information
ulischulte committed Oct 13, 2023
1 parent 32212fa commit ee6bbae
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
32 changes: 23 additions & 9 deletions spring-boot-admin-docs/src/site/asciidoc/server-notifications.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ To enable https://www.hipchat.com/[Hipchat] notifications you need to create an

[[slack-notifications]]
=== Slack Notifications ===
To enable https://slack.com/[Slack] notifications you need to add a incoming Webhook under custom integrations on your Slack
To enable https://slack.com/[Slack] notifications you need to add an incoming Webhook under custom integrations on your Slack
account and configure it appropriately.

.Slack notifications configuration options
Expand All @@ -216,15 +216,15 @@ account and configure it appropriately.
|

| spring.boot.admin.notify.slack.channel
| Optional channel name (without # at the beginning). If different than channel in Slack Webhooks settings
| Optional channel name (without # at the beginning). If different from channel in Slack Webhooks settings
|

| spring.boot.admin.notify.slack.icon
| Optional icon name (without surrounding colons). If different than icon in Slack Webhooks settings
| Optional icon name (without surrounding colons). If different from icon in Slack Webhooks settings
|

| spring.boot.admin.notify.slack.username
| Optional username to send notification if different than in Slack Webhooks settings
| Optional username to send notification if different from in Slack Webhooks settings
| `Spring Boot Admin`

| spring.boot.admin.notify.slack.message
Expand Down Expand Up @@ -275,7 +275,7 @@ To enable https://sdelements.github.io/lets-chat/[Let's Chat] notifications you

[[ms-teams-notifications]]
=== Microsoft Teams Notifications ===
To enable Microsoft Teams notifications you need to setup a connector webhook url and set the appropriate configuration property.
To enable Microsoft Teams notifications you need to set up a connector webhook url and set the appropriate configuration property.

.Microsoft Teams notifications configuration options
|===
Expand Down Expand Up @@ -348,7 +348,7 @@ To enable https://telegram.org/[Telegram] notifications you need to create and a
| `false`

| spring.boot.admin.notify.telegram.parse_mode
| The parsing mode for the sent message. Currently ``HTML'` and `'Markdown'` are supported.
| The parsing mode for the sent message. Currently, ``HTML'` and `'Markdown'` are supported.
| `'HTML'`

| spring.boot.admin.notify.telegram.message
Expand Down Expand Up @@ -421,9 +421,9 @@ All Notifiers which are using a `RestTemplate` can be configured to use a proxy.
=== Notification Reminder ===
The `RemindingNotifier` sends reminders for down/offline applications, it delegates the sending of notifications to another notifier.

By default a reminder is triggered when a registered application changes to `DOWN` or `OFFLINE`. You can alter this behaviour via `setReminderStatuses()`. The reminder ends when either the status changes to a non-triggering status or the regarding application gets deregistered.
By default, a reminder is triggered when a registered application changes to `DOWN` or `OFFLINE`. You can alter this behaviour via `setReminderStatuses()`. The reminder ends when either the status changes to a non-triggering status or the regarding application gets deregistered.

By default the reminders are sent every 10 minutes, to change this use `setReminderPeriod()`. The `RemindingNotifier` itself doesn't start the background thread to send the reminders, you need to take care of this as shown in the given example below;
By default, the reminders are sent every 10 minutes, to change this use `setReminderPeriod()`. The `RemindingNotifier` itself doesn't start the background thread to send the reminders, you need to take care of this as shown in the given example below;

.How to configure reminders
[source,java]
Expand Down Expand Up @@ -452,8 +452,22 @@ public class NotifierConfiguration {
The `FilteringNotifier` allows you to filter certain notification based on rules you can add/remove at runtime. It delegates the sending of notifications to another notifier.

If you add a `FilteringNotifier` to your `ApplicationContext` a RESTful interface on `notifications/filter` gets available.
The restful interface provides the following methods for getting, adding, and deleting notification filters:

This notifier is useful if you don't want receive notifications when deploying your applications. Before stopping the application you can add an (expiring) filter either via a `POST` request.
* `GET notifications/filter`
** Returns a list of all registered notification filters. Each containing the attributes `id`, `applicationName`, `expiry`, and `expired`.

* `POST notifications/filters?instanceId=<yourInstanceId>&applicationName=<yourApplicationName>&ttl=<yourInstant>`
** Posts a new notification filter for the application/instance of the given `instanceId` or `applicationName`. Either `instanceId` or `applicationName` must be set. The parameter `ttl` is optional and represents the expiration of the filter as an instant (the number of seconds from the epoch of `1970-01-01T00:00:00Z`).

* `DELETE notifications/filters/{id}`
** Deletes the notification filter with the requested id from the filters.

You may as well access all notification filter configurations via the main applications view inside SBA client, as seen in the screenshot below.

image::images/notification-filter.png[Sample notification filters]

A `FilteringNotifier` might be useful, for instance, if you don't want to receive notifications when deploying your applications. Before stopping the application, you can add an (expiring) filter via a `POST` request.

.How to configure filtering
[source,java,indent=0]
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.csrfTokenRequestHandler(new CsrfTokenRequestAttributeHandler())
.ignoringRequestMatchers(
new AntPathRequestMatcher(this.adminServer.path("/instances"), POST.toString()),
new AntPathRequestMatcher(this.adminServer.path("/notifications/**"), POST.toString()),
new AntPathRequestMatcher(this.adminServer.path("/notifications/**"), DELETE.toString()),
new AntPathRequestMatcher(this.adminServer.path("/instances/*"), DELETE.toString()),
new AntPathRequestMatcher(this.adminServer.path("/actuator/**"))));

Expand Down

0 comments on commit ee6bbae

Please sign in to comment.