Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended existing alerting functionality to support preconfigured only action types #64030

Merged
Merged
5 changes: 4 additions & 1 deletion docs/user/alerting/action-types.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,19 @@ see https://www.elastic.co/subscriptions[the subscription page].

[float]
[[create-connectors]]
=== Connectors
=== Preconfigured connectors and action types

You can create connectors for actions in <<managing-alerts-and-actions, Alerts and Actions>> or via the action API.
For out-of-the-box and standardized connectors, you can <<pre-configured-connectors, preconfigure connectors>>
before {kib} starts.

Action type with only preconfigured connectors could be specified as a <<pre-configured-action-types, preconfigured action type>>.
YulNaumenko marked this conversation as resolved.
Show resolved Hide resolved

include::action-types/email.asciidoc[]
include::action-types/index.asciidoc[]
include::action-types/pagerduty.asciidoc[]
include::action-types/server-log.asciidoc[]
include::action-types/slack.asciidoc[]
include::action-types/webhook.asciidoc[]
include::pre-configured-connectors.asciidoc[]
include::pre-configured-action-types.asciidoc[]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 61 additions & 0 deletions docs/user/alerting/pre-configured-action-types.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[role="xpack"]
[[pre-configured-action-types]]

== Preconfigured action types

You can preconfigure an action type to have all the information it needs prior to startup
by excluding this action type from `xpack.actions.enabledActionTypes` and adding all its connectors to the `kibana.yml` file.
How to preconfigure connectors is described with details <<pre-configured-connectors, here>>.

Preconfigured action types offer the following capabilities:

- Require no setup. Configuration and credentials needed to execute an
action are predefined.
- Has only <<pre-configured-connectors, preconfigured connectors>>.
- Connectors cannot be edited or deleted.

[float]
[[preconfigured-action-type-example]]
=== Example of a preconfigured action type

The following example shows a valid configuration of preconfigured action type with 1 out-of-the box connector.

[source,console]
------------------------
xpack.actions.enabledActionTypes: ['.slack', '.email', '.index'] <1>
xpack.actions.preconfigured: <2>
- id: 'my-server-log'
actionTypeId: .server-log
name: 'Server log #xyz'
------------------------

<1> `enabledActionTypes` should exclude preconfigured action type to prevent creating and deleting connectors.
<2> `preconfigured` is the setting for defining the list of available connectors for the preconfigured action type.

[float]
[[pre-configured-action-type-alert-form]]
=== Creating an alert with a preconfigured action type

When attaching an action to an alert,
select from a list of available action types, and
then select the Server Log type. This action type was configured previously.
The preconfigured action type connectors is installed and the first is automatically selected.

[role="screenshot"]
image::images/pre-configured-action-type-alert-form.png[Create alert with selected Server log action type]

[float]
[[managing-pre-configured-action-types]]
=== Managing preconfigured action types

Preconfigured action type connectors appear in the connector list, regardless of which space the user is in.
They are tagged as “preconfigured” and cannot be deleted.

[role="screenshot"]
image::images/pre-configured-action-type-managing.png[Connectors managing tab with pre-cofigured]

Clicking on a Create connector button shows the select menu with the list of available action types.
But preconfigured action types shouldn't be in the select menu, because creating regular connector is not allowed.

[role="screenshot"]
image::images/pre-configured-action-type-select-type.png[Pre-configured connector create menu]
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -16007,7 +16007,6 @@
"xpack.triggersActionsUI.sections.alertForm.loadingActionTypesDescription": "アクションタイプを読み込み中...",
"xpack.triggersActionsUI.sections.alertForm.renotifyFieldLabel": "通知間隔",
"xpack.triggersActionsUI.sections.alertForm.renotifyWithTooltip": "アラートがアクティブな間にアクションを繰り返す頻度を定義します。",
"xpack.triggersActionsUI.sections.alertForm.selectAlertActionTypeEditTitle": "{actionConnectorName}",
"xpack.triggersActionsUI.sections.alertForm.selectAlertActionTypeTitle": "アクション:アクションタイプを選択してください",
"xpack.triggersActionsUI.sections.alertForm.selectAlertTypeTitle": "トリガータイプを選択してください",
"xpack.triggersActionsUI.sections.alertForm.selectedAlertTypeTitle": "{alertType}",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -16012,7 +16012,6 @@
"xpack.triggersActionsUI.sections.alertForm.loadingActionTypesDescription": "正在加载操作类型……",
"xpack.triggersActionsUI.sections.alertForm.renotifyFieldLabel": "通知频率",
"xpack.triggersActionsUI.sections.alertForm.renotifyWithTooltip": "定义告警处于活动状态时重复操作的频率。",
"xpack.triggersActionsUI.sections.alertForm.selectAlertActionTypeEditTitle": "{actionConnectorName}",
"xpack.triggersActionsUI.sections.alertForm.selectAlertActionTypeTitle": "操作:选择操作类型",
"xpack.triggersActionsUI.sections.alertForm.selectAlertTypeTitle": "选择触发器类型",
"xpack.triggersActionsUI.sections.alertForm.selectedAlertTypeTitle": "{alertType}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,47 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { ActionType } from '../../types';
import { checkActionTypeEnabled } from './check_action_type_enabled';
import { ActionType, ActionConnector } from '../../types';
import {
checkActionTypeEnabled,
checkActionFormActionTypeEnabled,
} from './check_action_type_enabled';

test(`returns isEnabled:true when action type isn't provided`, async () => {
expect(checkActionTypeEnabled()).toMatchInlineSnapshot(`
describe('checkActionTypeEnabled', () => {
test(`returns isEnabled:true when action type isn't provided`, async () => {
expect(checkActionTypeEnabled()).toMatchInlineSnapshot(`
Object {
"isEnabled": true,
}
`);
});
});

test('returns isEnabled:true when action type is enabled', async () => {
const actionType: ActionType = {
id: '1',
minimumLicenseRequired: 'basic',
name: 'my action',
enabled: true,
enabledInConfig: true,
enabledInLicense: true,
};
expect(checkActionTypeEnabled(actionType)).toMatchInlineSnapshot(`
test('returns isEnabled:true when action type is enabled', async () => {
const actionType: ActionType = {
id: '1',
minimumLicenseRequired: 'basic',
name: 'my action',
enabled: true,
enabledInConfig: true,
enabledInLicense: true,
};
expect(checkActionTypeEnabled(actionType)).toMatchInlineSnapshot(`
Object {
"isEnabled": true,
}
`);
});
});

test('returns isEnabled:false when action type is disabled by license', async () => {
const actionType: ActionType = {
id: '1',
minimumLicenseRequired: 'basic',
name: 'my action',
enabled: false,
enabledInConfig: true,
enabledInLicense: false,
};
expect(checkActionTypeEnabled(actionType)).toMatchInlineSnapshot(`
test('returns isEnabled:false when action type is disabled by license', async () => {
const actionType: ActionType = {
id: '1',
minimumLicenseRequired: 'basic',
name: 'my action',
enabled: false,
enabledInConfig: true,
enabledInLicense: false,
};
expect(checkActionTypeEnabled(actionType)).toMatchInlineSnapshot(`
Object {
"isEnabled": false,
"message": "This connector requires a Basic license.",
Expand All @@ -63,18 +67,82 @@ test('returns isEnabled:false when action type is disabled by license', async ()
</EuiCard>,
}
`);
});

test('returns isEnabled:false when action type is disabled by config', async () => {
const actionType: ActionType = {
id: '1',
minimumLicenseRequired: 'basic',
name: 'my action',
enabled: false,
enabledInConfig: false,
enabledInLicense: true,
};
expect(checkActionTypeEnabled(actionType)).toMatchInlineSnapshot(`
Object {
"isEnabled": false,
"message": "This connector is disabled by the Kibana configuration.",
"messageCard": <EuiCard
className="actCheckActionTypeEnabled__disabledActionWarningCard"
description=""
title="This feature is disabled by the Kibana configuration."
/>,
}
`);
});
});

test('returns isEnabled:false when action type is disabled by config', async () => {
const actionType: ActionType = {
id: '1',
minimumLicenseRequired: 'basic',
name: 'my action',
enabled: false,
enabledInConfig: false,
enabledInLicense: true,
};
expect(checkActionTypeEnabled(actionType)).toMatchInlineSnapshot(`
describe('checkActionFormActionTypeEnabled', () => {
const preconfiguredConnectors: ActionConnector[] = [
{
actionTypeId: '1',
config: {},
id: 'test1',
isPreconfigured: true,
name: 'test',
secrets: {},
referencedByCount: 0,
},
{
actionTypeId: '2',
config: {},
id: 'test2',
isPreconfigured: true,
name: 'test',
secrets: {},
referencedByCount: 0,
},
];

test('returns isEnabled:true when action type is preconfigured', async () => {
const actionType: ActionType = {
id: '1',
minimumLicenseRequired: 'basic',
name: 'my action',
enabled: true,
enabledInConfig: false,
enabledInLicense: true,
};

expect(checkActionFormActionTypeEnabled(actionType, preconfiguredConnectors))
.toMatchInlineSnapshot(`
Object {
"isEnabled": true,
}
`);
});

test('returns isEnabled:false when action type is disabled by config and not preconfigured', async () => {
const actionType: ActionType = {
id: 'disabled-by-config',
minimumLicenseRequired: 'basic',
name: 'my action',
enabled: true,
enabledInConfig: false,
enabledInLicense: true,
};
expect(checkActionFormActionTypeEnabled(actionType, preconfiguredConnectors))
.toMatchInlineSnapshot(`
Object {
"isEnabled": false,
"message": "This connector is disabled by the Kibana configuration.",
Expand All @@ -85,4 +153,5 @@ test('returns isEnabled:false when action type is disabled by config', async ()
/>,
}
`);
});
});
Loading