Overview
This article describes how JetPatch populates the Affected CI (Configuration Item) list in ServiceNow with relevant computers from a Remediation Plan (RP).
The integration ensures accurate association of endpoints (EPs) to CIs during change request creation through configurable matching criteria and optimized data retrieval.
Process Overview
Matching Logic
JetPatch matches endpoints (EPs) from the Remediation Plan with CIs in the ServiceNow cmdb_ci table using the following criteria:
- Name-based matching: Enabled by default.
- IP-based matching: Optional.
Only matched CIs are added to the Affected CI list in ServiceNow.
Data Fetching
JetPatch queries the cmdb_ci table using grouped patterns (nameSTARTSWITH) for affected endpoints.
Optimization:
- CI data is fetched in chunks to reduce unnecessary data retrieval.
- Fetched CIs are cached locally for one hour to improve performance.
Association
Once the relevant CIs are fetched and matched, their sys_ids are associated with the change request using the following API call:
POST /api/sn_chg_rest/v1/change/{change-request-sys_id}/ci
Request Body:
{ "cmdb_ci_sys_ids": "<ci-sys_id-1>,<ci-sys_id-2>,...,<ci-sys_id-n>", "association_type": "affected" } |
Configuration Properties and Example
Default Scenario
Populate the Affected CI list using CI names only, fetching data from the cmdb_ci_server table, while using hostnames (not full DNS names) for matching.
Default Configuration
# Enable or disable the Affected CI list population feature itsm.ci-list.enabled=true
# Limit the number of CI records fetched per query from the cmdb_ci table serviceNow.cmdb_ci.sysparm_limit=1000
# Enable matching by CI name serviceNow.ci.compare-name=true
# Disable matching by CI IP address (optional; enable if names are inconsistent) serviceNow.ci.compare-ip=false
# Specify the ServiceNow table used for querying CIs (e.g., cmdb_ci_server) serviceNow.ci.table=cmdb_ci_server
# Use only the hostname (not the full DNS name) for matching itsm.cmdb_ci.use-full-name=false
# Disable matching by querying the hostname in ServiceNow serviceNow.cmdb-ci.match-with-query=false |
Important Notes
Matching
- Ensure names in JetPatch match CI names in ServiceNow for successful population.
- Enable IP matching (serviceNow.ci.compare-ip=true) if CI names are inconsistent or not unique.
Performance
- Adjust serviceNow.cmdb_ci.sysparm_limit to optimize query efficiency and performance, balancing result size and API limitations.
Customization
Use serviceNow.cmdb_ci.sysparm_query to filter results.
Example:
| serviceNow.cmdb_ci.sysparm_query=sys_class_name=cmdb_ci_server^ORsys_class_name=cmdb_ci_linux_server |
Result
Only matched CIs are added to the Affected CI list, ensuring an accurate and relevant representation of impacted computers in ServiceNow. This improves visibility and helps streamline change request approvals and actions.
Troubleshooting
Validate Query Syntax
Ensure the nameSTARTSWITH syntax is correct and properly formatted. Use a basic curl command to test the query:
curl -X GET "https://<service-now-instance>/api/now/v1/table/cmdb_ci_server?sysparm_query=nameSTARTSWITH" \ -u "username:password" \ -H "Accept: application/json" |
- Replace <service-now-instance> with your ServiceNow instance URL.
- Replace username: password with valid credentials.
Comments
0 comments
Please sign in to leave a comment.