Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ewilson-r7 committed Aug 19, 2024
1 parent 4dd2685 commit 024fa2b
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 10 deletions.
8 changes: 4 additions & 4 deletions plugins/servicenow/.CHECKSUM
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spec": "66383258e1872c8d7b97cb41c187f941",
"manifest": "3ae96f8b5579d7015c7ae616b98b942d",
"setup": "229c0103ca254f7cd51ca66efe73a79f",
"spec": "555158aefe9c8370012d317cde054eae",
"manifest": "9a5dd37917d235d9bfd40117f7e252dd",
"setup": "3cbd58d6404d01885426d768a8feea72",
"schemas": [
{
"identifier": "create_change_request/schema.py",
Expand Down Expand Up @@ -109,7 +109,7 @@
},
{
"identifier": "incident_changed/schema.py",
"hash": "b1827c050539a2e013a2d3d7d221d657"
"hash": "7aaa8b786a0ae6920053b440d5616ff4"
},
{
"identifier": "incident_created/schema.py",
Expand Down
2 changes: 1 addition & 1 deletion plugins/servicenow/bin/icon_servicenow
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from sys import argv

Name = "ServiceNow"
Vendor = "rapid7"
Version = "8.0.1"
Version = "9.0.0"
Description = "ServiceNow is a tool for managing incidents and configuration management. Using the ServiceNow plugin for Rapid7 InsightConnect, users can manage all aspects of incidents including creation, search, updates, as well as monitor them for changes"


Expand Down
3 changes: 3 additions & 0 deletions plugins/servicenow/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,7 @@ This trigger is used to reports changes of the given fields in the given Inciden
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
|interval|integer|5|False|How often to detect changes to the given Incident (in minutes)|None|5|None|None|
|monitored_fields|string|None|True|Comma-separated list of fields to be monitored (e.g. resolved,resolved_by)|None|resolved,resolved_by|None|None|
|query|string|None|None|Non-encoded query string (e.g. number=INC0000055^ORshort_description=New bug)|None|number=INC0000055^ORshort_description=New bug|None|None|
|system_ids|[]string|None|False|List of system IDs of the incident records to monitor|None|["9de5069c5afe602b2ea0a04b66beb2c0"]|None|None|

Example input:
Expand All @@ -1479,6 +1480,7 @@ Example input:
{
"interval": 5,
"monitored_fields": "resolved,resolved_by",
"query": "number=INC0000055^ORshort_description=New bug",
"system_ids": [
"9de5069c5afe602b2ea0a04b66beb2c0"
]
Expand Down Expand Up @@ -1686,6 +1688,7 @@ Example output:

# Version History

* 9.0.0 - Add new input for Incident Changed Trigger
* 8.0.1 - Update Setuptool to version 70.0.0 | Update SDK to version 6.0.0
* 8.0.0 - `Incident Created, Vulnerability Updated`: Updated triggers to allow users to check a list of system_ids or all of them
* 7.4.1 - `Incident Created`: Resolved issue related to trigger not working. Updated SDK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Component:
class Input:
INTERVAL = "interval"
MONITORED_FIELDS = "monitored_fields"
QUERY = "query"
SYSTEM_IDS = "system_ids"


Expand All @@ -29,14 +30,20 @@ class IncidentChangedInput(insightconnect_plugin_runtime.Input):
"title": "Interval",
"description": "How often to detect changes to the given Incident (in minutes)",
"default": 5,
"order": 3
"order": 4
},
"monitored_fields": {
"type": "string",
"title": "Monitored Fields",
"description": "Comma-separated list of fields to be monitored (e.g. resolved,resolved_by)",
"order": 2
},
"query": {
"type": "string",
"title": "Query",
"description": "Non-encoded query string (e.g. number=INC0000055^ORshort_description=New bug)",
"order": 3
},
"system_ids": {
"type": "array",
"title": "System IDs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ def run(self, params={}):
interval = params.get(Input.INTERVAL, 5)
monitored_fields = params.get(Input.MONITORED_FIELDS, "")
system_ids = params.get(Input.SYSTEM_IDS, [])
query = params.get(Input.QUERY, "")
# END INPUT BINDING - DO NOT REMOVE

# Initial pull of all the incidents with conversion generators to dict.
# We need to store all of them in memory for the comparison.
previous_incidents = dict(self.get_all_incidents(monitored_fields, system_ids=system_ids))
previous_incidents = dict(self.get_all_incidents(monitored_fields, system_ids=system_ids, query=query))

while True:
# Pull all the incidents
current_incidents = self.get_all_incidents(monitored_fields, system_ids=system_ids)
current_incidents = self.get_all_incidents(monitored_fields, system_ids=system_ids, query=query)

# Compare previous and new incident results. Using dict to speed up compute time.
# After comparison the previous_incidents variable is being updated to current_incidents
Expand Down
8 changes: 7 additions & 1 deletion plugins/servicenow/plugin.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ products: ["insightconnect"]
name: servicenow
title: ServiceNow
description: ServiceNow is a tool for managing incidents and configuration management. Using the ServiceNow plugin for Rapid7 InsightConnect, users can manage all aspects of incidents including creation, search, updates, as well as monitor them for changes
version: 8.0.1
version: 9.0.0
connection_version: 8
supported_versions: ["2023-10-28 Tokyo"]
vendor: rapid7
Expand Down Expand Up @@ -45,6 +45,7 @@ references:
- "[ServiceNow Operators](https://docs.servicenow.com/bundle/quebec-platform-user-interface/page/use/common-ui-elements/reference/r_OpAvailableFiltersQueries.html)"
- "[ServiceNow Plugin Setup Guide](https://docs.rapid7.com/insightconnect/servicenow)"
version_history:
- "9.0.0 - Add new input for Incident Changed Trigger"
- "8.0.1 - Update Setuptool to version 70.0.0 | Update SDK to version 6.0.0"
- "8.0.0 - `Incident Created, Vulnerability Updated`: Updated triggers to allow users to check a list of system_ids or all of them"
- "7.4.1 - `Incident Created`: Resolved issue related to trigger not working. Updated SDK"
Expand Down Expand Up @@ -1489,6 +1490,11 @@ triggers:
type: string
required: true
example: resolved,resolved_by
query:
title: Query
description: Non-encoded query string (e.g. number=INC0000055^ORshort_description=New bug)
type: string
example: number=INC0000055^ORshort_description=New bug
interval:
title: Interval
description: How often to detect changes to the given Incident (in minutes)
Expand Down
2 changes: 1 addition & 1 deletion plugins/servicenow/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


setup(name="servicenow-rapid7-plugin",
version="8.0.1",
version="9.0.0",
description="ServiceNow is a tool for managing incidents and configuration management. Using the ServiceNow plugin for Rapid7 InsightConnect, users can manage all aspects of incidents including creation, search, updates, as well as monitor them for changes",
author="rapid7",
author_email="",
Expand Down

0 comments on commit 024fa2b

Please sign in to comment.