-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[Cases][Connectors] ServiceNow ITOM: MVP #114125
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
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
1f9ee81
Create itom service
cnasikas 8bac8f6
Register itom connector
cnasikas 76a651a
Register itom ui connector
cnasikas 0ae3042
Make severity required
cnasikas 71be5f2
Add additional information
cnasikas b3dc5a3
Remove text from readme
cnasikas 2b2ad41
Add backend tests
cnasikas 0e73412
Add docs
cnasikas 63a4d41
Use message key to group alerts
cnasikas 73c83e9
Fix i18n
cnasikas 81793e0
Small fixes
cnasikas d573cd3
Add ITOM to readme
cnasikas 09ecec1
Add tests
cnasikas 1d7f388
Merge branch 'master' into itom_mvp
kibanamachine 92c2c32
Fix test
cnasikas df94c7f
Merge branch 'master' into itom_mvp
kibanamachine c77bbee
Merge branch 'master' into itom_mvp
kibanamachine d3ee78d
Fix tests after updating nodejs to v16
cnasikas 64634d3
Fix bug with severity
cnasikas 449ecb7
Merge branch 'master' into itom_mvp
kibanamachine c305d37
Merge branch 'master' into itom_mvp
kibanamachine 03228e7
Merge branch 'master' into itom_mvp
kibanamachine 138d4fe
Merge branch 'master' into itom_mvp
kibanamachine 235ceee
Merge branch 'master' into itom_mvp
kibanamachine 2a95f93
Merge branch 'master' into itom_mvp
kibanamachine 11d841d
Merge branch 'master' into itom_mvp
kibanamachine 2aba958
Merge branch 'master' into itom_mvp
kibanamachine d9a079f
Merge branch 'master' into itom_mvp
kibanamachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
docs/management/connectors/action-types/servicenow-itom.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| [role="xpack"] | ||
| [[servicenow-itom-action-type]] | ||
| === ServiceNow connector and action | ||
| ++++ | ||
| <titleabbrev>ServiceNow ITOM</titleabbrev> | ||
| ++++ | ||
|
|
||
| The ServiceNow ITOM connector uses the https://docs.servicenow.com/bundle/rome-it-operations-management/page/product/event-management/task/send-events-via-web-service.html[Event API] to create ServiceNow events. | ||
|
|
||
| [float] | ||
| [[servicenow-itom-connector-configuration]] | ||
| ==== Connector configuration | ||
|
|
||
| ServiceNow ITOM connectors have the following configuration properties. | ||
|
|
||
| Name:: The name of the connector. The name is used to identify a connector in the **Stack Management** UI connector listing, and in the connector list when configuring an action. | ||
| URL:: ServiceNow instance URL. | ||
| Username:: Username for HTTP Basic authentication. | ||
| Password:: Password for HTTP Basic authentication. | ||
|
|
||
| The ServiceNow user requires at minimum read, create, and update access to the Event table and read access to the https://docs.servicenow.com/bundle/paris-platform-administration/page/administer/localization/reference/r_ChoicesTable.html[sys_choice]. If you don't provide access to sys_choice, then the choices will not render. | ||
|
|
||
| [float] | ||
| [[servicenow-itom-connector-networking-configuration]] | ||
| ==== Connector networking configuration | ||
|
|
||
| Use the <<action-settings, Action configuration settings>> to customize connector networking configurations, such as proxies, certificates, or TLS settings. You can set configurations that apply to all your connectors or use `xpack.actions.customHostSettings` to set per-host configurations. | ||
|
|
||
| [float] | ||
| [[Preconfigured-servicenow-itom-configuration]] | ||
| ==== Preconfigured connector type | ||
|
|
||
| [source,text] | ||
| -- | ||
| my-servicenow-itom: | ||
| name: preconfigured-servicenow-connector-type | ||
| actionTypeId: .servicenow-itom | ||
| config: | ||
| apiUrl: https://example.service-now.com/ | ||
| secrets: | ||
| username: testuser | ||
| password: passwordkeystorevalue | ||
| -- | ||
|
|
||
| Config defines information for the connector type. | ||
|
|
||
| `apiUrl`:: An address that corresponds to *URL*. | ||
|
|
||
| Secrets defines sensitive information for the connector type. | ||
|
|
||
| `username`:: A string that corresponds to *Username*. | ||
| `password`:: A string that corresponds to *Password*. Should be stored in the <<creating-keystore, {kib} keystore>>. | ||
|
|
||
| [float] | ||
| [[define-servicenow-itom-ui]] | ||
| ==== Define connector in Stack Management | ||
|
|
||
| Define ServiceNow ITOM connector properties. | ||
|
|
||
| [role="screenshot"] | ||
| image::management/connectors/images/servicenow-itom-connector.png[ServiceNow ITOM connector] | ||
|
|
||
| Test ServiceNow ITOM action parameters. | ||
|
|
||
| [role="screenshot"] | ||
| image::management/connectors/images/servicenow-itom-params-test.png[ServiceNow ITOM params test] | ||
|
|
||
| [float] | ||
| [[servicenow-itom-action-configuration]] | ||
| ==== Action configuration | ||
|
|
||
| ServiceNow ITOM actions have the following configuration properties. | ||
|
|
||
| Source:: The name of the event source type. | ||
| Node:: The Host that the event was triggered for. | ||
| Type:: The type of event. | ||
| Resource:: The name of the resource. | ||
| Metric name:: Name of the metric. | ||
| Source instance (event_class):: Specific instance of the source. | ||
| Message key:: All actions sharing this key will be associated with the same ServiceNow alert. Default value: `<rule ID>:<alert instance ID>`. | ||
| Severity:: The severity of the event. | ||
| Description:: The details about the event. | ||
|
|
||
| Refer to https://docs.servicenow.com/bundle/rome-it-operations-management/page/product/event-management/task/send-events-via-web-service.html[ServiceNow documentation] for more information about the properties. | ||
|
|
||
| [float] | ||
| [[configuring-servicenow-itom]] | ||
| ==== Configure ServiceNow ITOM | ||
|
|
||
| ServiceNow offers free https://developer.servicenow.com/dev.do#!/guides/madrid/now-platform/pdi-guide/obtaining-a-pdi[Personal Developer Instances], which you can use to test incidents. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
x-pack/plugins/actions/server/builtin_action_types/servicenow/api_itom.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import { Logger } from '../../../../../../src/core/server'; | ||
| import { externalServiceITOMMock, itomEventParams } from './mocks'; | ||
| import { ExternalServiceITOM } from './types'; | ||
| import { apiITOM, prepareParams } from './api_itom'; | ||
| let mockedLogger: jest.Mocked<Logger>; | ||
|
|
||
| describe('api_itom', () => { | ||
| let externalService: jest.Mocked<ExternalServiceITOM>; | ||
| const eventParamsWithFormattedDate = { | ||
| ...itomEventParams, | ||
| time_of_event: '2021-10-13, 10:51:44', | ||
| }; | ||
|
|
||
| beforeEach(() => { | ||
| externalService = externalServiceITOMMock.create(); | ||
| jest.clearAllMocks(); | ||
| }); | ||
|
|
||
| describe('prepareParams', () => { | ||
| test('it prepares the params correctly', async () => { | ||
| expect(prepareParams(itomEventParams)).toEqual(eventParamsWithFormattedDate); | ||
| }); | ||
|
|
||
| test('it removes null values', async () => { | ||
| const { time_of_event: timeOfEvent, ...rest } = itomEventParams; | ||
| expect(prepareParams({ ...rest, time_of_event: null })).toEqual(rest); | ||
| }); | ||
|
|
||
| test('it set the time to null if it is not a proper date', async () => { | ||
| const { time_of_event: timeOfEvent, ...rest } = itomEventParams; | ||
| expect(prepareParams({ ...rest, time_of_event: 'not a proper date' })).toEqual(rest); | ||
| }); | ||
| }); | ||
|
|
||
| describe('addEvent', () => { | ||
| test('it adds an event correctly', async () => { | ||
| await apiITOM.addEvent({ | ||
| externalService, | ||
| params: itomEventParams, | ||
| logger: mockedLogger, | ||
| }); | ||
|
|
||
| expect(externalService.addEvent).toHaveBeenCalledWith(eventParamsWithFormattedDate); | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was done by an automated formating tool. Nothing is changed.