Changed behavior in ISM and Alerting, and added more details
Signed-off-by: keithhc2 <keithhc2@users.noreply.github.com>
This commit is contained in:
parent
447cb1948d
commit
a3f2b7ff2d
|
@ -51,6 +51,9 @@ collections:
|
|||
monitoring-plugins:
|
||||
permalink: /:collection/:path/
|
||||
output: true
|
||||
notifications-plugin:
|
||||
permalink: /:collection/:path/
|
||||
output: true
|
||||
clients:
|
||||
permalink: /:collection/:path/
|
||||
output: true
|
||||
|
@ -90,6 +93,9 @@ just_the_docs:
|
|||
monitoring-plugins:
|
||||
name: Monitoring plugins
|
||||
nav_fold: true
|
||||
notifications-plugin:
|
||||
name: Notifications plugin
|
||||
nav_fold: true
|
||||
clients:
|
||||
name: Clients and tools
|
||||
nav_fold: true
|
||||
|
|
|
@ -441,7 +441,7 @@ For information on writing cron expressions, see [Cron expression reference]({{s
|
|||
## Error notifications
|
||||
|
||||
The `error_notification` operation sends you a notification if your managed index fails.
|
||||
It notifies a single destination with a custom message.
|
||||
It notifies a single destination or [notification channel]({{site.url}}{{site.baseurl}}/notifications-plugin/index) with a custom message.
|
||||
|
||||
Set up error notifications at the policy level:
|
||||
|
||||
|
@ -459,7 +459,8 @@ Set up error notifications at the policy level:
|
|||
|
||||
Parameter | Description | Type | Required
|
||||
:--- | :--- |:--- |:--- |
|
||||
`destination` | The destination URL. | `Slack, Amazon Chime, or webhook URL` | Yes
|
||||
`destination` | The destination URL. | `Slack, Amazon Chime, or webhook URL` | Yes if `channel` isn't specified
|
||||
`channel` | A notification channel's ID | `string` | Yes if `destination` isn't specified`
|
||||
`message_template` | The text of the message. You can add variables to your messages using [Mustache templates](https://mustache.github.io/mustache.5.html). | `object` | Yes
|
||||
|
||||
The destination system **must** return a response otherwise the `error_notification` operation throws an error.
|
||||
|
@ -515,6 +516,21 @@ The destination system **must** return a response otherwise the `error_notificat
|
|||
}
|
||||
```
|
||||
|
||||
#### Example 4: Using a notification channel
|
||||
|
||||
```json
|
||||
{
|
||||
"error_notification": {
|
||||
"channel": {
|
||||
"id": "some-channel-config-id"
|
||||
},
|
||||
"message_template": {
|
||||
"source": "The index {% raw %}{{ctx.index}}{% endraw %} failed during policy execution."
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can use the same options for `ctx` variables as the [notification](#notification) operation.
|
||||
|
||||
## Sample policy with ISM template
|
||||
|
|
|
@ -23,76 +23,7 @@ Monitor | A job that runs on a defined schedule and queries OpenSearch indices.
|
|||
Trigger | Conditions that, if met, generate *alerts*.
|
||||
Alert | An event associated with a trigger. When an alert is created, the trigger performs *actions*, which can include sending a notification.
|
||||
Action | The information that you want the monitor to send out after being triggered. Actions have a *destination*, a message subject, and a message body.
|
||||
Destination | A reusable location for an action. Supported locations are Amazon Chime, Email, Slack, or custom webhook.
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Create destinations
|
||||
|
||||
1. Choose **Alerting**, **Destinations**, **Add destination**.
|
||||
1. Specify a name for the destination so that you can identify it later.
|
||||
1. For **Type**, choose Slack, Amazon Chime, custom webhook, or [email](#email-as-a-destination).
|
||||
|
||||
For Email, refer to the [Email as a destination](#email-as-a-destination) section below. For all other types, specify the webhook URL. See the documentation for [Slack](https://api.slack.com/incoming-webhooks) and [Amazon Chime](https://docs.aws.amazon.com/chime/latest/ug/webhooks.html) to learn more about webhooks.
|
||||
|
||||
If you're using custom webhooks, you must specify more information: parameters and headers. For example, if your endpoint requires basic authentication, you might need to add a header with a key of `Authorization` and a value of `Basic <Base64-encoded-credential-string>`. You might also need to change `Content-Type` to whatever your webhook requires. Popular values are `application/json`, `application/xml`, and `text/plain`.
|
||||
|
||||
This information is stored in plain text in the OpenSearch cluster. We will improve this design in the future, but for now, the encoded credentials (which are neither encrypted nor hashed) might be visible to other OpenSearch users.
|
||||
|
||||
|
||||
### Email as a destination
|
||||
|
||||
To send or receive an alert notification as an email, choose **Email** as the destination type. Next, add at least one sender and recipient. We recommend adding email groups if you want to notify more than a few people of an alert. You can configure senders and recipients using **Manage senders** and **Manage email groups**.
|
||||
|
||||
|
||||
#### Manage senders
|
||||
|
||||
Senders are email accounts from which the alerting plugin sends notifications.
|
||||
|
||||
To configure a sender email, do the following:
|
||||
|
||||
1. After you choose **Email** as the destination type, choose **Manage senders**.
|
||||
1. Choose **Add sender**, **New sender** and enter a unique name.
|
||||
1. Enter the email address, SMTP host (e.g. `smtp.gmail.com` for a Gmail account), and the port.
|
||||
1. Choose an encryption method, or use the default value of **None**. However, most email providers require SSL or TLS, which require a username and password in OpenSearch keystore. Refer to [Authenticate sender account](#authenticate-sender-account) to learn more.
|
||||
1. Choose **Save** to save the configuration and create the sender. You can create a sender even before you add your credentials to the OpenSearch keystore. However, you must [authenticate each sender account](#authenticate-sender-account) before you use the destination to send your alert.
|
||||
|
||||
You can reuse senders across many different destinations, but each destination only supports one sender.
|
||||
|
||||
|
||||
#### Manage email groups or recipients
|
||||
|
||||
Use email groups to create and manage reusable lists of email addresses. For example, one alert might email the DevOps team, whereas another might email the executive team and the engineering team.
|
||||
|
||||
You can enter individual email addresses or an email group in the **Recipients** field.
|
||||
|
||||
1. After you choose **Email** as the destination type, choose **Manage email groups**. Then choose **Add email group**, **New email group**.
|
||||
1. Enter a unique name.
|
||||
1. For recipient emails, enter any number of email addresses.
|
||||
1. Choose **Save**.
|
||||
|
||||
|
||||
#### Authenticate sender account
|
||||
|
||||
If your email provider requires SSL or TLS, you must authenticate each sender account before you can send an email. Enter these credentials in the OpenSearch keystore using the CLI. Run the following commands (in your OpenSearch directory) to enter your username and password. The `<sender_name>` is the name you entered for **Sender** earlier.
|
||||
|
||||
```bash
|
||||
./bin/opensearch-keystore add plugins.alerting.destination.email.<sender_name>.username
|
||||
./bin/opensearch-keystore add plugins.alerting.destination.email.<sender_name>.password
|
||||
```
|
||||
|
||||
Note: Keystore settings are node-specific. You must run these commands on each node.
|
||||
{: .note}
|
||||
|
||||
To change or update your credentials (after you've added them to the keystore on every node), call the reload API to automatically update those credentials without restarting OpenSearch:
|
||||
|
||||
```json
|
||||
POST _nodes/reload_secure_settings
|
||||
{
|
||||
"secure_settings_password": "1234"
|
||||
}
|
||||
```
|
||||
Channel | A notifications channel to use in an action. See [notifications]({{site.url}}{{site.baseurl}}/notifications-plugin/index) for more information.
|
||||
|
||||
|
||||
---
|
||||
|
@ -321,7 +252,6 @@ Variable | Data Type | Description
|
|||
:--- | :--- | : ---
|
||||
`ctx.trigger.actions.id` | String | The action's ID.
|
||||
`ctx.trigger.actions.name` | String | The action's name.
|
||||
`ctx.trigger.actions.destination_id`| String | The alert destination's ID.
|
||||
`ctx.trigger.actions.message_template.source` | String | The message to send in the alert.
|
||||
`ctx.trigger.actions.message_template.lang` | String | The scripting language used to define the message. Must be Mustache.
|
||||
`ctx.trigger.actions.throttle_enabled` | Boolean | Whether throttling is enabled for this trigger. See [adding actions](#add-actions) for more information about throttling.
|
||||
|
@ -356,7 +286,7 @@ If you don't want to receive notifications for alerts, you don't have to add act
|
|||
{: .tip }
|
||||
|
||||
1. Specify a name for the action.
|
||||
1. Choose a destination.
|
||||
1. Choose a [notification channel]({{site.url}}{{site.baseurl}}/notifications-plugin/index).
|
||||
1. Add a subject and body for the message.
|
||||
|
||||
You can add variables to your messages using [Mustache templates](https://mustache.github.io/mustache.5.html). You have access to `ctx.action.name`, the name of the current action, as well as all [trigger variables](#available-variables).
|
||||
|
@ -367,7 +297,7 @@ If you don't want to receive notifications for alerts, you don't have to add act
|
|||
{% raw %}{ "text": "Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue. - Trigger: {{ctx.trigger.name}} - Severity: {{ctx.trigger.severity}} - Period start: {{ctx.periodStart}} - Period end: {{ctx.periodEnd}}" }{% endraw %}
|
||||
```
|
||||
|
||||
In this case, the message content must conform to the `Content-Type` header in the [custom webhook](#create-destinations).
|
||||
In this case, the message content must conform to the `Content-Type` header in the [custom webhook]({{site.url}}{{site.baseurl}}/notifcations-plugin/index).
|
||||
1. If you're using a bucket-level monitor, you can choose whether the monitor should perform an action for each execution or for each alert.
|
||||
|
||||
1. (Optional) Use action throttling to limit the number of notifications you receive within a given span of time.
|
||||
|
|
|
@ -8,9 +8,7 @@ redirect_from:
|
|||
|
||||
# Notifications API
|
||||
|
||||
If you don’t want to use OpenSearch Dashboards, you can use the REST API to create, configure, and delete notification channels, email senders, and email recipient groups, as well as send test messages.
|
||||
|
||||
If you want to programmatically define your notifications channels and sources for versioning and reuse, you can use the REST API to create, configure, and delete notification channels, email senders, and email recipient groups, as well as send test messages.
|
||||
If you want to programmatically define your notifications channels and sources for versioning and reuse, you can use the REST API to define, configure, and delete notification channels, as well as send test messages.
|
||||
|
||||
---
|
||||
|
||||
|
@ -20,9 +18,9 @@ If you want to programmatically define your notifications channels and sources f
|
|||
|
||||
---
|
||||
|
||||
## List supported features
|
||||
## List supported channel types
|
||||
|
||||
Lists supported channel types and email limitations, such as accepted file sizes and connect timeouts.
|
||||
Lists supported channel types.
|
||||
|
||||
#### Sample Request
|
||||
|
||||
|
@ -34,28 +32,106 @@ GET /_plugins/_notifications/features
|
|||
|
||||
```json
|
||||
{
|
||||
"config_type_list" : [
|
||||
"slack",
|
||||
"chime",
|
||||
"webhook",
|
||||
"email",
|
||||
"sns",
|
||||
"smtp_account",
|
||||
"email_group"
|
||||
"allowed_config_type_list" : [
|
||||
"slack",
|
||||
"chime",
|
||||
"webhook",
|
||||
"email",
|
||||
"sns",
|
||||
"ses_account",
|
||||
"smtp_account",
|
||||
"email_group"
|
||||
],
|
||||
"plugin_features" : {
|
||||
"opensearch.notifications.spi.email.sizeLimit" : "10000000",
|
||||
"opensearch.notifications.spi.email.minimumHeaderLength" : "160",
|
||||
"opensearch.notifications.spi.http.maxConnections" : "60",
|
||||
"opensearch.notifications.spi.http.maxConnectionPerRoute" : "20",
|
||||
"opensearch.notifications.spi.http.connectionTimeout" : "5000",
|
||||
"opensearch.notifications.spi.http.socketTimeout" : "50000",
|
||||
"opensearch.notifications.spi.tooltip_support" : "false"
|
||||
"tooltip_support" : "true"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Create channel
|
||||
## List all configurations
|
||||
|
||||
Lists all configurations.
|
||||
|
||||
#### Sample Request
|
||||
|
||||
```json
|
||||
GET _plugins/_notifications/configs
|
||||
```
|
||||
|
||||
#### Sample Response
|
||||
|
||||
```json
|
||||
{
|
||||
"start_index" : 0,
|
||||
"total_hits" : 2,
|
||||
"total_hit_relation" : "eq",
|
||||
"config_list" : [
|
||||
{
|
||||
"config_id" : "sample-id",
|
||||
"last_updated_time_ms" : 1652760532774,
|
||||
"created_time_ms" : 1652760532774,
|
||||
"config" : {
|
||||
"name" : "Sample Slack Channel",
|
||||
"description" : "This is a Slack channel",
|
||||
"config_type" : "slack",
|
||||
"is_enabled" : true,
|
||||
"slack" : {
|
||||
"url" : "https://sample-slack-webhook"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"config_id" : "sample-id2",
|
||||
"last_updated_time_ms" : 1652760735380,
|
||||
"created_time_ms" : 1652760735380,
|
||||
"config" : {
|
||||
"name" : "Test chime channel",
|
||||
"description" : "A test chime channel",
|
||||
"config_type" : "chime",
|
||||
"is_enabled" : true,
|
||||
"chime" : {
|
||||
"url" : "https://sample-chime-webhook"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
You can include query parameters in your request path to filter the notification channels this request returns. All parameters are optional.
|
||||
|
||||
Parameter | Description
|
||||
:--- | :---
|
||||
config_id | identifier of a channel.
|
||||
config_id_list | Comma-separated list of channel IDs.
|
||||
from_index | The starting index to search from.
|
||||
max_items | The maximum amount of items to return in your request.
|
||||
sort_order | Specifies the direction to sort results in. Valid options are asc and desc.
|
||||
sort_field | Field to sort results with.
|
||||
last_updated_time_ms | The unix time in milliseconds of when the channel was last updated.
|
||||
created_time_ms | The unix time in milliseconds of when the channel was created.
|
||||
is_enabled | Whether the channel is enabled.
|
||||
config_type | The channel type. Valid options are `sns`, `slack`, `chime`, `webhook`, `smtp_account`, `ses_account`, `email_group`, `email`.
|
||||
name | The channel's name.
|
||||
description | The channel's description.
|
||||
email.email_account_id | The sender emails the channel uses.
|
||||
email.email_group_id_list | The email groups the channel uses.
|
||||
email.recipient_list | The channel's recipient list.
|
||||
email_group.recipient_list | The channel's list of email recipient groups.
|
||||
smtp_account.method | The email encryption method.
|
||||
slack.url | The Slack channel's URL.
|
||||
chime.url | The Amazon Chime connection's URL.
|
||||
webhook.url | The webhook's URL.
|
||||
smtp_account.host | The domain of the smtp account.
|
||||
smtp_account.from_address | The email account's sender address.
|
||||
smtp_account.method | The smtp account's encryption method.
|
||||
sns.topic_arn | The Amazon SNS topic's ARN.
|
||||
sns.role_arn | The Amazon SNS topic's role ARN.
|
||||
ses_account.region | The Amazon SES account's region.
|
||||
ses_account.role_arn | The Amazon SES account's role ARN.
|
||||
ses_account.from_address | The Amazon SES account's sender email address.
|
||||
|
||||
## Create channel configuration
|
||||
|
||||
Creates a notification channel.
|
||||
|
||||
|
@ -64,15 +140,12 @@ Creates a notification channel.
|
|||
```json
|
||||
POST /_plugins/_notifications/configs/
|
||||
{
|
||||
"id": "sample-id",
|
||||
"config_id": "sample-id",
|
||||
"name": "sample-name",
|
||||
"config": {
|
||||
"name": "Sample Slack Channel",
|
||||
"description": "This is a Slack channel",
|
||||
"config_type": "slack",
|
||||
"feature_list": [
|
||||
"reports"
|
||||
],
|
||||
"is_enabled": true,
|
||||
"slack": {
|
||||
"url": "https://sample-slack-webhook"
|
||||
|
@ -83,17 +156,16 @@ POST /_plugins/_notifications/configs/
|
|||
|
||||
The create channel API operation accepts the following fields in its request body:
|
||||
|
||||
|
||||
Field | Data Type | Description | Required
|
||||
:--- | :--- | :--- | :---
|
||||
config_id | String | The config's custom ID. | No
|
||||
config | Object | Contains all of relevant information such as channel name, configuration type, and plugin source. | Yes
|
||||
name | String | Name of the channel. | Yes
|
||||
description | String | The channel's description. | No
|
||||
config_type | String | The destination of your notification. Valid options are `chime`, `sns`, `slack`, `email`, and `webhook`. | Yes
|
||||
feature_list | Array of strings | The OpenSearch plugins you want to associate with the channel. Valid options are `alerting`, `reports`, and `index_management`. | Yes
|
||||
is_enabled | Boolean | Whether to enable to channel to receive and send notifications. Default is true. | No
|
||||
config_type | String | The destination of your notification. Valid options are `sns`, `slack`, `chime`, `webhook`, `smtp_account`, `ses_account`, `email_group`, `email`. | Yes
|
||||
is_enabled | Boolean | Whether to enable to channel for sending and receiving notifications. Default is true. | No
|
||||
|
||||
The create channel operation accepts multiple `config_types` as possible notification destinations, so just follow the format for your preferred `config_type`.
|
||||
The create channel operation accepts multiple `config_types` as possible notification destinations, so follow the format for your preferred `config_type`.
|
||||
|
||||
```json
|
||||
"sns": {
|
||||
|
@ -106,22 +178,39 @@ The create channel operation accepts multiple `config_types` as possible notific
|
|||
"chime": {
|
||||
"url": "https://sample-amazon-chime-webhoook"
|
||||
}
|
||||
"webhook" : {
|
||||
"url" : "https://sample-webhook",
|
||||
"header_params" : {
|
||||
"Content-Type" : "application/json"
|
||||
},
|
||||
"method" : "POST"
|
||||
"webhook": {
|
||||
"url": "https://custom-webhook-test-url.com:8888/test-path?params1=value1¶ms2=value2"
|
||||
}
|
||||
"email" : {
|
||||
"email_account_id" : "<sample-email-account-id>",
|
||||
"recipient_list" : [
|
||||
"sample@email.com"
|
||||
],
|
||||
"email_group_id_list" : [
|
||||
"<email-group-id>"
|
||||
"smtp_account": {
|
||||
"host": "test-host.com",
|
||||
"port": 123,
|
||||
"method": "start_tls",
|
||||
"from_address": "test@email.com"
|
||||
}
|
||||
"ses_account": {
|
||||
"region": "us-east-1",
|
||||
"role_arn": "arn:aws:iam::012345678912:role/NotificationsSESRole",
|
||||
"from_address": "test@email.com"
|
||||
}
|
||||
"email_group": { //Email recipient group
|
||||
"recipient_list": [
|
||||
{
|
||||
"recipient": "test-email1@test.com"
|
||||
},
|
||||
{
|
||||
"recipient": "test-email2@test.com"
|
||||
}
|
||||
]
|
||||
}
|
||||
"email": { //The channel that sends emails
|
||||
"email_account_id": "<smtp or ses account config id>",
|
||||
"recipient_list": [
|
||||
{
|
||||
"recipient": "custom.email@test.com"
|
||||
}
|
||||
],
|
||||
"email_group_id_list": []
|
||||
}
|
||||
```
|
||||
|
||||
The following example demonstrates how to create a channel using email as a `config_type`:
|
||||
|
@ -135,9 +224,6 @@ POST /_plugins/_notifications/configs/
|
|||
"name": "Sample Email Channel",
|
||||
"description": "Sample email description",
|
||||
"config_type": "email",
|
||||
"feature_list": [
|
||||
"reports"
|
||||
],
|
||||
"is_enabled" : true,
|
||||
"email" : {
|
||||
"email_account_id" : "<email_account_id>",
|
||||
|
@ -157,259 +243,6 @@ POST /_plugins/_notifications/configs/
|
|||
}
|
||||
```
|
||||
|
||||
## Send test notification
|
||||
|
||||
Sends a test notification.
|
||||
|
||||
#### Sample Request
|
||||
|
||||
```json
|
||||
GET _plugins/_notifications/events
|
||||
```
|
||||
|
||||
#### Sample Response
|
||||
|
||||
```json
|
||||
{
|
||||
"event_id" : "<event_id>"
|
||||
}
|
||||
```
|
||||
|
||||
## List all sent notifications
|
||||
|
||||
Lists all sent notifications.
|
||||
|
||||
#### Sample Request
|
||||
|
||||
```json
|
||||
GET _plugins/_notifications/events
|
||||
```
|
||||
|
||||
#### Sample Response
|
||||
|
||||
```json
|
||||
{
|
||||
"start_index" : 0,
|
||||
"total_hits" : 10,
|
||||
"total_hit_relation" : "eq",
|
||||
"event_list" : [
|
||||
{
|
||||
"event_id" : "<event_id>",
|
||||
"last_updated_time_ms" : 1629226098683,
|
||||
"created_time_ms" : 1629226098222,
|
||||
"tenant" : "__user__",
|
||||
"event" : {
|
||||
"event_source" : {
|
||||
"title" : "Sample notification event",
|
||||
"reference_id" : "<reference_id>",
|
||||
"feature" : "reporting",
|
||||
"severity" : "info",
|
||||
"tags" : [ ]
|
||||
},
|
||||
"status_list" : [
|
||||
{
|
||||
"config_id" : "<config_id>",
|
||||
"config_type" : "webhook",
|
||||
"config_name" : "This is a config name",
|
||||
"email_recipient_status" : [ ],
|
||||
"delivery_status" : {
|
||||
"status_code" : "200",
|
||||
"status_text" : "Example status text"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
To filter down your results, specify the following parameters in your request path. All parameters are optional.
|
||||
|
||||
Parameter | Description
|
||||
:--- | :---
|
||||
event_id_list | Comma-separated list of notification event IDs to retrieve.
|
||||
from_index | The starting index to search from.
|
||||
max_items | The maximum number of items the request should return.
|
||||
sort_order | Specifies the direction to sort results in. Valid options are asc and desc.
|
||||
sort_field | Field to sort results with.
|
||||
last_updated_time_ms | The unix time in milliseconds of when the channel was last updated.
|
||||
created_time_ms | The unix time in milliseconds of when the channel was created.
|
||||
event_source.reference_id | The notification event's reference ID.
|
||||
event_source.feature | The OpenSearch plugin that triggered the notification event.
|
||||
event_source.severity | The severity of the of the notification event. Valid options are info and high.
|
||||
event_source.tags | Any tags associated with the notification event.
|
||||
event_source.title | The notification event's title.
|
||||
status_list.config_id | The channel's config ID.
|
||||
status_list.config_type | The channel's notification type. Valid options are slack, chime, sns, email, and webhook.
|
||||
status_list.config_name | The channel's name.
|
||||
status_list.delivery_status.status_code | The notification event's delivery status code.
|
||||
status_list.delivery_status.status_text | Status text related to the notification's delivery status.
|
||||
status_list.email_recipient_status.recipient | Any statuses associated with email recipients.
|
||||
status_list.email_recipient_status.delivery_status.status_code | Any status codes associated with email recipients.
|
||||
status_list.email_recipient_status.delivery_status.status_text | Status text related to email recipients' delivery statuses.
|
||||
|
||||
For example, the following request returns a notification sent to Slack that was triggered by the Alerting plugin.
|
||||
|
||||
#### Sample Request
|
||||
|
||||
```json
|
||||
GET _plugins/_notifications/events?status_list.config_type=slack&event_source.feature=alerting
|
||||
```
|
||||
|
||||
#### Sample Response
|
||||
|
||||
```json
|
||||
{
|
||||
"start_index" : 0,
|
||||
"total_hits" : 1,
|
||||
"total_hit_relation" : "eq",
|
||||
"event_list" : [
|
||||
{
|
||||
"event_id" : "<event_id>",
|
||||
"last_updated_time_ms" : 1630354617088,
|
||||
"created_time_ms" : 1630354617082,
|
||||
"tenant" : "__user__",
|
||||
"event" : {
|
||||
"event_source" : {
|
||||
"title" : "Sample notification event",
|
||||
"reference_id" : "<reference_id>",
|
||||
"feature" : "alerting",
|
||||
"severity" : "info",
|
||||
"tags" : [ ]
|
||||
},
|
||||
"status_list" : [
|
||||
{
|
||||
"config_id" : "<config_id>",
|
||||
"config_type" : "slack",
|
||||
"config_name" : "Sample Slack Channel",
|
||||
"email_recipient_status" : [ ],
|
||||
"delivery_status" : {
|
||||
"status_code" : "200",
|
||||
"status_text" : "Example status text"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## List all channels
|
||||
|
||||
Lists all notification channels.
|
||||
|
||||
#### Sample Request
|
||||
|
||||
```json
|
||||
GET _plugins/_notifications/configs
|
||||
```
|
||||
|
||||
#### Sample Response*
|
||||
|
||||
```json
|
||||
{
|
||||
"start_index" : 0,
|
||||
"total_hits" : 3,
|
||||
"total_hit_relation" : "eq",
|
||||
"config_list" : [
|
||||
{
|
||||
"config_id" : "f8gxMnsBgleqOc4sp278",
|
||||
"last_updated_time_ms" : 1628634720251,
|
||||
"created_time_ms" : 1628634720251,
|
||||
"tenant" : "__user__",
|
||||
"config" : {
|
||||
"name" : "Testing Gmail Channel",
|
||||
"description" : "",
|
||||
"config_type" : "smtp_account",
|
||||
"feature_list" : [
|
||||
"alerting",
|
||||
"index_management",
|
||||
"reports"
|
||||
],
|
||||
"is_enabled" : true,
|
||||
"smtp_account" : {
|
||||
"host" : "smtp.gmail.com",
|
||||
"port" : 80,
|
||||
"method" : "ssl",
|
||||
"from_address" : "example@gmail.com"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"config_id" : "g20bN3sBUeso9oKNgb8C",
|
||||
"last_updated_time_ms" : 1628717154562,
|
||||
"created_time_ms" : 1628717154562,
|
||||
"tenant" : "__user__",
|
||||
"config" : {
|
||||
"name" : "Slack Channel 1",
|
||||
"description" : "This is an optional description",
|
||||
"config_type" : "slack",
|
||||
"feature_list" : [
|
||||
"reports"
|
||||
],
|
||||
"is_enabled" : true,
|
||||
"slack" : {
|
||||
"url" : "https://hooks.slack.com/a-sample-url"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"config_id" : "0W0kN3sBUeso9oKNur-_",
|
||||
"last_updated_time_ms" : 1628717759167,
|
||||
"created_time_ms" : 1628717759167,
|
||||
"tenant" : "__user__",
|
||||
"config" : {
|
||||
"name" : "Another Sample Slack Channel",
|
||||
"description" : "Sample description",
|
||||
"config_type" : "slack",
|
||||
"feature_list" : [
|
||||
"reports"
|
||||
],
|
||||
"is_enabled" : true,
|
||||
"slack" : {
|
||||
"url" : "https://hooks.slack.com/another-sample-url"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
You can include query parameters in your request path to filter the notification channels this request returns. All parameters are optional.
|
||||
|
||||
Parameter | Description
|
||||
:--- | :---
|
||||
config_id Unique | identifier of a channel.
|
||||
config_id_list | Comma-separated list of channel IDs.
|
||||
from_index | The starting index to search from.
|
||||
max_items | The maximum amount of items to return in your request.
|
||||
sort_order | Specifies the direction to sort results in. Valid options are asc and desc.
|
||||
sort_field | Field to sort results with.
|
||||
last_updated_time_ms | The unix time in milliseconds of when the channel was last updated.
|
||||
created_time_ms | The unix time in milliseconds of when the channel was created.
|
||||
is_enabled | Whether the channel is enabled.
|
||||
config_type | The channel type. Valid options are slack, chime, sns, email, and webhook.
|
||||
feature_list | The OpenSearch plugin associated with the channel.
|
||||
name | The channel's name.
|
||||
description | The channel's description.
|
||||
email.email_account_id | The sender emails the channel uses.
|
||||
email.email_group_id_list | The email groups the channel uses.
|
||||
smtp_account.method | The email encryption method.
|
||||
slack.url | The Slack channel's URL.
|
||||
chime.url | The Amazon Chime connection's URL.
|
||||
webhook.url | The webhook's URL.
|
||||
email.recipient_list | The channel's recipient list.
|
||||
email_group.recipient_list | The channel's list of email recipient groups.
|
||||
smtp_account.host | The domain of the smtp account.
|
||||
smtp_account.from_address | The email account's sender address.
|
||||
smtp_account.recipient_list | The channel's recipient list.
|
||||
sns.topic_arn | The Amazon SNS topic's ARN.
|
||||
sns.role_arn | The Amazon SNS topic's role ARN.
|
||||
ses_account.region | The Amazon SES account's region.
|
||||
ses_account.role_arn | The Amazon SES account's role ARN.
|
||||
ses_account.from_address | The Amazon SES account's sender email address.
|
||||
|
||||
## Get channel configuration
|
||||
|
||||
|
@ -420,6 +253,7 @@ Get a channel’s configuration by config_id.
|
|||
```json
|
||||
GET _plugins/_notifications/configs/<config_id>
|
||||
```
|
||||
|
||||
#### Sample Response
|
||||
|
||||
```json
|
||||
|
@ -428,33 +262,25 @@ GET _plugins/_notifications/configs/<config_id>
|
|||
"total_hits" : 1,
|
||||
"total_hit_relation" : "eq",
|
||||
"config_list" : [
|
||||
{
|
||||
"config_id" : "<config_id>",
|
||||
"last_updated_time_ms" : 1628634720251,
|
||||
"created_time_ms" : 1628634720251,
|
||||
"tenant" : "__user__",
|
||||
"config" : {
|
||||
"name" : "Testing Gmail Channel",
|
||||
"description" : "",
|
||||
"config_type" : "smtp_account",
|
||||
"feature_list" : [
|
||||
"alerting",
|
||||
"index_management",
|
||||
"reports"
|
||||
],
|
||||
"is_enabled" : true,
|
||||
"smtp_account" : {
|
||||
"host" : "smtp.gmail.com",
|
||||
"port" : 80,
|
||||
"method" : "ssl",
|
||||
"from_address" : "example@gmail.com"
|
||||
{
|
||||
"config_id" : "sample-id",
|
||||
"last_updated_time_ms" : 1652760532774,
|
||||
"created_time_ms" : 1652760532774,
|
||||
"config" : {
|
||||
"name" : "Sample Slack Channel",
|
||||
"description" : "This is a Slack channel",
|
||||
"config_type" : "slack",
|
||||
"is_enabled" : true,
|
||||
"slack" : {
|
||||
"url" : "https://sample-slack-webhook"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Update channel configuration
|
||||
|
||||
Updates a channel’s configuration.
|
||||
|
@ -468,9 +294,6 @@ PUT _plugins/_notifications/configs/<config_id>
|
|||
"name": "Slack Channel",
|
||||
"description": "This is an updated channel configuration",
|
||||
"config_type": "slack",
|
||||
"feature_list": [
|
||||
"index_management"
|
||||
],
|
||||
"is_enabled": true,
|
||||
"slack": {
|
||||
"url": "https://hooks.slack.com/sample-url"
|
||||
|
@ -487,7 +310,8 @@ PUT _plugins/_notifications/configs/<config_id>
|
|||
}
|
||||
```
|
||||
|
||||
#### Delete channel
|
||||
|
||||
## Delete channel configuration
|
||||
|
||||
Deletes a channel.
|
||||
|
||||
|
@ -527,303 +351,51 @@ DELETE /_plugins/_notifications/configs/?config_id_list=<config_id1>,<config_id2
|
|||
}
|
||||
```
|
||||
|
||||
#### Create email sender
|
||||
|
||||
Creates an email sender for use when creating an email channel.
|
||||
## Send test notification
|
||||
|
||||
Sends a test notification to a channel.
|
||||
|
||||
#### Sample Request
|
||||
|
||||
```json
|
||||
POST _plugins/_notifications/configs
|
||||
{
|
||||
"config": {
|
||||
"name": "test_email_08-20-2021",
|
||||
"config_type": "smtp_account",
|
||||
"feature_list" : [
|
||||
"alerting"
|
||||
],
|
||||
"is_enabled" : true,
|
||||
"smtp_account": {
|
||||
"host": "smtp.gmail.com",
|
||||
"port": 465,
|
||||
"method": "ssl",
|
||||
"from_address": "test@gmail.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
GET _plugins/_notifications/feature/test/<config_id>
|
||||
```
|
||||
|
||||
#### Sample Response
|
||||
|
||||
```json
|
||||
{
|
||||
"config_id" : "<config_id>"
|
||||
}
|
||||
```
|
||||
|
||||
## Get email sender
|
||||
|
||||
Retrieves an email sender.
|
||||
|
||||
#### Sample Request
|
||||
|
||||
```json
|
||||
GET _plugins/_notifications/configs/<config_id>
|
||||
```
|
||||
|
||||
#### Sample Response
|
||||
|
||||
```json
|
||||
{
|
||||
"start_index" : 0,
|
||||
"total_hits" : 1,
|
||||
"total_hit_relation" : "eq",
|
||||
"config_list" : [
|
||||
{
|
||||
"config_id" : "6j2jZXsBnB7tlos71NNu",
|
||||
"last_updated_time_ms" : 1629497886595,
|
||||
"created_time_ms" : 1629497840749,
|
||||
"tenant" : "__user__",
|
||||
"config" : {
|
||||
"name" : "Sample_Email_2021",
|
||||
"description" : "",
|
||||
"config_type" : "smtp_account",
|
||||
"feature_list" : [
|
||||
"alerting"
|
||||
],
|
||||
"is_enabled" : true,
|
||||
"smtp_account" : {
|
||||
"host" : "smtp.gmail.com",
|
||||
"port" : 465,
|
||||
"method" : "ssl",
|
||||
"from_address" : "address@gmail.com"
|
||||
"event_source" : {
|
||||
"title" : "Test Message Title-0Jnlh4ABa4TCWn5C5H2G",
|
||||
"reference_id" : "0Jnlh4ABa4TCWn5C5H2G",
|
||||
"severity" : "info",
|
||||
"tags" : [ ]
|
||||
},
|
||||
"status_list" : [
|
||||
{
|
||||
"config_id" : "0Jnlh4ABa4TCWn5C5H2G",
|
||||
"config_type" : "slack",
|
||||
"config_name" : "sample-id",
|
||||
"email_recipient_status" : [ ],
|
||||
"delivery_status" : {
|
||||
"status_code" : "200",
|
||||
"status_text" : """<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<h1>Example Domain</h1>
|
||||
<p>Sample paragraph.</p>
|
||||
<p><a href="sample.example.com">TO BE OR NOT TO BE, THAT IS THE QUESTION</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Update email sender
|
||||
|
||||
Updates an email sender with new fields.
|
||||
|
||||
#### Sample Request
|
||||
|
||||
```json
|
||||
PUT _plugins/_notifications/configs/<config_id>
|
||||
{
|
||||
"config": {
|
||||
"name": "This is a new name",
|
||||
"config_type": "smtp_account",
|
||||
"feature_list" : [
|
||||
"alerting"
|
||||
],
|
||||
"is_enabled" : false,
|
||||
"smtp_account": {
|
||||
"host": "smtp.gmail.com",
|
||||
"port": 587,
|
||||
"method": "ssl",
|
||||
"from_address": "new_address@gmail.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Sample Response
|
||||
|
||||
```json
|
||||
{
|
||||
"config_id" : "<config_id>"
|
||||
}
|
||||
```
|
||||
|
||||
## Delete email sender
|
||||
|
||||
Deletes an email sender.
|
||||
|
||||
#### Sample Request
|
||||
|
||||
```json
|
||||
DELETE _plugins/_notifications/configs/<config_id>
|
||||
```
|
||||
|
||||
#### Sample Response
|
||||
|
||||
```json
|
||||
{
|
||||
"delete_response_list" : {
|
||||
"<config_id>" : "OK"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To delete multiple email senders, specify all of the necessary IDs in a comma-separated list.
|
||||
|
||||
#### Sample Request
|
||||
|
||||
```json
|
||||
DELETE _plugins/_notifications/configs/?config_id_list=<config_id1>,<config_id2>,<config_id3>
|
||||
```
|
||||
|
||||
#### Sample Response
|
||||
|
||||
```json
|
||||
{
|
||||
"delete_response_list" : {
|
||||
"<config_id1>" : "OK",
|
||||
"<config_id2>" : "OK",
|
||||
"<config_id3>" : "OK",
|
||||
"<config_id4>" : "OK"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Create email recipient group
|
||||
|
||||
Creates an email recipient group
|
||||
|
||||
#### Sample Request
|
||||
|
||||
```json
|
||||
POST _plugins/_notifications/configs/
|
||||
{
|
||||
"config": {
|
||||
"name": "Sample Email Group Name",
|
||||
"description": "This is an email group",
|
||||
"config_type": "email_group",
|
||||
"feature_list": [
|
||||
"alerting"
|
||||
],
|
||||
"is_enabled": true,
|
||||
"email_group": {
|
||||
"recipient_list": [
|
||||
"some_address@email.com"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Sample Response
|
||||
|
||||
```json
|
||||
{
|
||||
"config_id" : "<config_id>"
|
||||
}
|
||||
```
|
||||
|
||||
## Get email recipient group
|
||||
|
||||
Returns an email recipient group
|
||||
|
||||
#### Sample Request
|
||||
|
||||
```json
|
||||
GET _plugins/_notifications/configs/<config_id>
|
||||
```
|
||||
|
||||
#### Sample Response
|
||||
|
||||
```json
|
||||
{
|
||||
"start_index" : 0,
|
||||
"total_hits" : 1,
|
||||
"total_hit_relation" : "eq",
|
||||
"config_list" : [
|
||||
{
|
||||
"config_id" : "<config_id>",
|
||||
"last_updated_time_ms" : 1630106022155,
|
||||
"created_time_ms" : 1630106022155,
|
||||
"tenant" : "__user__",
|
||||
"config" : {
|
||||
"name" : "Sample Email Group Name",
|
||||
"description" : "This is an email group",
|
||||
"config_type" : "email_group",
|
||||
"feature_list" : [
|
||||
"alerting"
|
||||
],
|
||||
"is_enabled" : true,
|
||||
"email_group" : {
|
||||
"recipient_list" : [
|
||||
"some_address@email.com"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Update email recipient group
|
||||
|
||||
Updates an email recipient group
|
||||
|
||||
#### Sample Request
|
||||
|
||||
```json
|
||||
PUT _plugins/_notifications/configs/<config_id>
|
||||
{
|
||||
"config": {
|
||||
"name": "This is an updated email group",
|
||||
"description": "This is an updated description",
|
||||
"config_type": "email_group",
|
||||
"feature_list": [
|
||||
"alerting"
|
||||
],
|
||||
"is_enabled": true,
|
||||
"email_group": {
|
||||
"recipient_list": [
|
||||
"some_address@email.com"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Sample Response
|
||||
|
||||
```json
|
||||
{
|
||||
"config_id" : "<config_id>"
|
||||
}
|
||||
```
|
||||
|
||||
## Delete email recipient group
|
||||
|
||||
Deletes an email recipient group
|
||||
|
||||
#### Sample Request
|
||||
|
||||
```json
|
||||
DELETE _plugins/_notifications/configs/<congid_id>
|
||||
```
|
||||
|
||||
#### Sample Response
|
||||
|
||||
```json
|
||||
{
|
||||
"delete_response_list" : {
|
||||
"<config_id>" : "OK"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The delete email group operation also supports deleting multiple email groups with one request.
|
||||
|
||||
#### Sample Request
|
||||
|
||||
```json
|
||||
DELETE _plugins/_notifications/configs/?config_id_list=<config_id1>,<config_id2>
|
||||
```
|
||||
|
||||
#### Sample Response
|
||||
|
||||
```json
|
||||
{
|
||||
"delete_response_list" : {
|
||||
"<config_id1>" : "OK",
|
||||
"<config_id2>" : "OK"
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
|
|
@ -9,7 +9,7 @@ redirect_from:
|
|||
|
||||
# Notifications
|
||||
|
||||
The notifications plugin provides a central location for all of your notifications from OpenSearch plugins. Using the plugin, you can configure which communication service you want to use as well as see relevant statistics and troubleshooting information. Currently, the plugin supports sending notifications from the Alerting, Index State Management (ISM), and Reporting plugins.
|
||||
The notifications plugin provides a central location for all of your notifications from OpenSearch plugins. Using the plugin, you can configure which communication service you want to use as well as see relevant statistics and troubleshooting information. Currently, the plugin supports sending notifications from the Alerting and Index State Management (ISM) plugins.
|
||||
|
||||
You can use either OpenSearch Dashboards or the REST API to configure notifications. Dashboards offers a more organized way of selecting a channel type and selecting which OpenSearch plugin sources you want to use, whereas the REST API lets you programmatically define your notification channels for better versioning and reuse later on.
|
||||
|
||||
|
@ -18,7 +18,7 @@ You can use either OpenSearch Dashboards or the REST API to configure notificati
|
|||
|
||||
## Create a channel
|
||||
|
||||
In OpenSearch Dashboards, choose **Notifications**, **Channels**, and then **Create channel**.
|
||||
In OpenSearch Dashboards, choose **Notifications**, **Channels**, and **Create channel**.
|
||||
|
||||
1. In the **Name and description** section, specify a name and optional description for your channel.
|
||||
2. In the **Configurations** section, select the channel type and enter the necessary information for each type. For more information about configuring a channel that uses Amazon SNS or emails, refer to the sections below. If you want to use Amazon Chime or Slack, you need to specify the webhook URL. For more information about using webhooks, see the documentation for [Slack](https://api.slack.com/messaging/webhooks) and [Amazon Chime](https://docs.aws.amazon.com/chime/latest/ug/webhooks.html).
|
||||
|
@ -101,16 +101,16 @@ Then add this policy into the IAM user’s trust relationship to actually assume
|
|||
|
||||
## Email as a channel type
|
||||
|
||||
To send or receive notifications with emails, choose **Email** as the channel type. Next, select at least one sender and default recipient. If you want to send notifications to more than a few people at a time, select a recipient group. If the Notifications plugin doesn’t currently have the necessary senders or groups, you can add them by choosing **Create sender** or **Create recipient group**.
|
||||
To send or receive notifications with emails, choose **Email** as the channel type. Next, select at least one sender and default recipient. To send notifications to more than a few people at a time, select a recipient group. If the Notifications plugin doesn’t currently have the necessary senders or groups, you can add them by first selecting **SMTP sender**, then choose **Create SMTP sender** or **Create recipient group**. Choose **SES sender** to use Amazon Simple Email Service (SES).
|
||||
|
||||
### Create a sender
|
||||
### Create email sender
|
||||
|
||||
1. Specify a unique name to associate with the sender.
|
||||
2. Enter an email address, its host (for example, smtp.gmail.com), and the port.
|
||||
3. Choose an encryption method, or use the default value of None. However, most email providers require SSL or TLS, which requires a username and password in the OpenSearch keystore. Refer to Authenticate sender account to learn more.
|
||||
4. Choose **Create** to save the configuration and create the sender. You can create a sender even before you add your credentials to the OpenSearch keystore. However, you must authenticate each sender account before you use the the sender in your channel configuration.
|
||||
2. Enter an email address, and, if applicable, its host (for example, smtp.gmail.com), and the port. If you're using SES, enter the IAM role ARN of the AWS account to send notifications from, along with the region.
|
||||
3. Choose an encryption method. Most email providers require SSL or TLS, which requires a username and password in the OpenSearch keystore. See [Authenticate sender account](#authenticate-sender-account) to learn more. Selecting an encryption method is only applicable if you're creating an SMTP sender.
|
||||
4. Choose **Create** to save the configuration and create the sender. You can create a sender before you add your credentials to the OpenSearch keystore; however, you must [authenticate each sender account](#authenticate-sender-account) before you use the sender in your channel configuration.
|
||||
|
||||
### Create a recipient group
|
||||
### Create email recipient group
|
||||
|
||||
1. After choosing **Create recipient group**, enter a unique name to associate with the email group and an optional description.
|
||||
2. Select or enter the emails you want to add to the recipient group.
|
||||
|
|
Loading…
Reference in New Issue