ServiceNow CMDB integration for SCP unified model
Project description
ServiceNow CMDB Integration
Sync SCP unified model JSON to ServiceNow Configuration Management Database (CMDB).
Installation
cd packages/vendor/servicenow
uv sync
Quick Start
# Set credentials
export SERVICENOW_INSTANCE="https://dev12345.service-now.com"
export SERVICENOW_USERNAME="admin"
export SERVICENOW_PASSWORD="password"
# Sync (uses sensible defaults)
scp-servicenow cmdb sync graph.json
That's it! The integration works out-of-the-box with sensible defaults. No configuration file needed.
Commands
sync - Sync SCP graph to ServiceNow
scp-servicenow cmdb sync graph.json [OPTIONS]
Options:
--instance, -i- ServiceNow instance URL (overrides env var)--ci-class, -c- CI class to use (default:cmdb_ci_service_discovered)--dry-run, -d- Validate without making changes--config- Path to customcmdb.yamlconfig file
Examples:
# Basic sync
scp-servicenow cmdb sync graph.json
# Dry-run
scp-servicenow cmdb sync graph.json --dry-run
# Custom config
scp-servicenow cmdb sync graph.json --config my-cmdb.yaml
validate - Validate SCP graph mapping
scp-servicenow cmdb validate graph.json
Checks for mapping issues before syncing.
init - Generate configuration template
scp-servicenow cmdb init [OPTIONS]
Generates a cmdb.yaml configuration file with defaults that you can customize.
Options:
--output, -o- Output path (default:cmdb.yaml)--force, -f- Overwrite existing file
Examples:
# Generate config template
scp-servicenow cmdb init
# Custom path
scp-servicenow cmdb init --output config/prod-cmdb.yaml
Default Field Mappings
The integration works without configuration using these defaults:
| SCP Field | ServiceNow Field | Notes |
|---|---|---|
node.id (URN) |
correlation_id |
Unique identifier for idempotent upserts |
node.name |
name |
CI display name |
node.tier |
business_criticality |
1→Critical, 2→High, 3→Medium, 4→Low |
node.team |
comments |
Stored in metadata section |
node.domain |
comments |
Stored in metadata section |
node.contacts[] |
owned_by + comments |
Email→User lookup, others in metadata |
node.escalation[] |
comments |
Formatted escalation chain |
edge.DEPENDS_ON |
cmdb_rel_ci |
Relationship: "Depends on::Used by" |
Comments Field Format
By default, team, domain, contacts, and escalation are stored in the comments field:
SCP Metadata:
Team: checkout-team
Domain: payments
Contacts:
- pagerduty: acmepay-checkout-critical
- slack: #team-checkout
Escalation Chain:
checkout-team → payments-platform
Configuration (Optional)
When to Use Configuration
Configuration is OPTIONAL. Use cmdb.yaml if you need to:
- Map SCP fields to custom ServiceNow fields (e.g.,
u_business_domain) - Customize the comments template format
- Change tier-to-criticality mappings
- Disable email-to-user resolution
Generate Configuration Template
scp-servicenow cmdb init
This creates cmdb.yaml with all defaults. Edit to customize for your instance.
Example: Using Custom Fields
If your ServiceNow instance has custom fields:
# cmdb.yaml
field_mappings:
name: name
business_criticality: tier
u_business_domain: domain # Custom field (must exist in ServiceNow)
u_support_team: team # Custom field (must exist in ServiceNow)
comments:
- contacts
- escalation
Note: Custom fields (
u_*) must be created in ServiceNow first. See Creating Custom Fields.
Configuration Options
# Field mappings
field_mappings:
name: name # Standard field
business_criticality: tier # Via tier_mappings
comments: [team, domain, ...] # List of fields to store in comments
# Tier to criticality mapping
tier_mappings:
1: "1 - Critical"
2: "2 - High"
# ...
# Contact resolution
contact_resolution:
resolve_email_to_owned_by: true # Try to map email→owned_by
email_not_found: "warn" # warn, ignore, or error
# CI class
ci_class: "cmdb_ci_service_discovered"
# Comments template (Python format string)
comments_template: |
SCP Metadata:
Team: {team}
Domain: {domain}
...
Authentication
Set environment variables for ServiceNow credentials:
Basic Auth (Recommended for Development)
export SERVICENOW_INSTANCE="https://dev12345.service-now.com"
export SERVICENOW_USERNAME="admin"
export SERVICENOW_PASSWORD="password"
OAuth Bearer Token
export SERVICENOW_INSTANCE="https://dev12345.service-now.com"
export SERVICENOW_TOKEN="your-bearer-token"
OAuth Client Credentials
export SERVICENOW_INSTANCE="https://dev12345.service-now.com"
export SERVICENOW_CLIENT_ID="your-client-id"
export SERVICENOW_CLIENT_SECRET="your-client-secret"
Creating Custom Fields
To use custom fields like u_business_domain or u_support_team:
- Navigate to System Definition > Tables in ServiceNow
- Find table:
cmdb_ci_service_discovered - Add new fields:
- Column:
u_business_domain, Type: String, Length: 100 - Column:
u_support_team, Type: String, Length: 100
- Column:
- Update your
cmdb.yamlto use these fields - Run sync
Complete Example
# 1. Generate SCP JSON
cd packages/constructor
uv run scp-cli scan /path/to/repos --export json -o /tmp/graph.json
# 2. (Optional) Generate config template
cd ../vendor/servicenow
uv run scp-servicenow cmdb init
# 3. (Optional) Edit config to use custom fields
# vim cmdb.yaml
# 4. Set credentials
export SERVICENOW_INSTANCE="https://dev12345.service-now.com"
export SERVICENOW_USERNAME="admin"
export SERVICENOW_PASSWORD="password"
# 5. Dry-run to validate
uv run scp-servicenow cmdb sync /tmp/graph.json --dry-run
# 6. Sync to ServiceNow
uv run scp-servicenow cmdb sync /tmp/graph.json
Troubleshooting
No configuration file found (Warning)
This is OK! The integration works with defaults. Only create cmdb.yaml if you need custom mappings.
Custom field not populated
Verify the field exists in ServiceNow:
- Check
sys_dictionarytable for your field - Ensure field name matches exactly (case-sensitive)
- Confirm you're using the correct CI table
Email contact not resolving to owned_by
Check that:
- Email address matches a ServiceNow user exactly
- User exists in
sys_usertable contact_resolution.resolve_email_to_owned_byistrue(default)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scp_servicenow-0.1.1.tar.gz.
File metadata
- Download URL: scp_servicenow-0.1.1.tar.gz
- Upload date:
- Size: 46.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6032099a6a798792a6e4eefefcd7a2ec5bacf2b3efc5007550015cecf9c5187
|
|
| MD5 |
1e19ee3ad6d7569c630daf8fe9b7f185
|
|
| BLAKE2b-256 |
b9d64e9a4f26aec1e05b4fde3541937b159ac7a7aff7fbe3e1b20d4b235f0af1
|
Provenance
The following attestation bundles were made for scp_servicenow-0.1.1.tar.gz:
Publisher:
ci.yml on krackenservices/scp-integrations
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scp_servicenow-0.1.1.tar.gz -
Subject digest:
a6032099a6a798792a6e4eefefcd7a2ec5bacf2b3efc5007550015cecf9c5187 - Sigstore transparency entry: 831965373
- Sigstore integration time:
-
Permalink:
krackenservices/scp-integrations@dd5fd47aa62bbf8f3a06456be11158c12914f8fc -
Branch / Tag:
refs/tags/servicenow-v0.1.1 - Owner: https://github.com/krackenservices
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@dd5fd47aa62bbf8f3a06456be11158c12914f8fc -
Trigger Event:
push
-
Statement type:
File details
Details for the file scp_servicenow-0.1.1-py3-none-any.whl.
File metadata
- Download URL: scp_servicenow-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d13c895963a00e19a366ead7fb81279a8111cb5e97262f9e151313c30c5ff064
|
|
| MD5 |
6f862dd9bea396eb7e6c86fc924af926
|
|
| BLAKE2b-256 |
edb30e3c241f4c382bfce6729db53884945111c373f18fa5c7ac6798c193779d
|
Provenance
The following attestation bundles were made for scp_servicenow-0.1.1-py3-none-any.whl:
Publisher:
ci.yml on krackenservices/scp-integrations
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scp_servicenow-0.1.1-py3-none-any.whl -
Subject digest:
d13c895963a00e19a366ead7fb81279a8111cb5e97262f9e151313c30c5ff064 - Sigstore transparency entry: 831965376
- Sigstore integration time:
-
Permalink:
krackenservices/scp-integrations@dd5fd47aa62bbf8f3a06456be11158c12914f8fc -
Branch / Tag:
refs/tags/servicenow-v0.1.1 - Owner: https://github.com/krackenservices
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@dd5fd47aa62bbf8f3a06456be11158c12914f8fc -
Trigger Event:
push
-
Statement type: