Patterns, Probes & Credentials — How Discovery Reads Your Infrastructure
Once Discovery knows a device is alive (horizontal phase), it must connect to it and read its configuration. This is the job of Probes, Sensors, and Patterns. This topic explains the difference between the legacy probe/sensor model and the modern pattern model, how credentials are stored and matched, and what happens when credentials fail.
The Data Collection Challenge
Horizontal Discovery found 250 live devices in your IP range. Now Discovery must connect to each one and extract specific configuration data — OS version, CPU model, installed software, running services. But there's a fundamental challenge: each device type responds differently.
- A Linux server accepts SSH connections and responds to shell commands like
uname -a - A Windows server accepts WMI queries — its own Microsoft-specific inventory protocol
- A Cisco router responds to SNMP requests using MIBs (Management Information Bases)
- A VMware ESXi host has its own proprietary API
- An Oracle database needs a JDBC connection with its own query syntax
ServiceNow needs a framework to handle all these device types and protocols without writing completely custom code for each one. That's exactly what Probes, Sensors, and Patterns provide.
Probes and Sensors — The Legacy Model
The original Discovery framework uses two components that work as a pair: the Probe collects raw data; the Sensor processes that raw data into structured CI fields.
What a Probe Does
A Probe is a set of instructions (JavaScript) that runs on the MID Server to:
- Connect to a target device using a specific protocol (SSH, WMI, SNMP, etc.)
- Execute specific commands or queries
- Return the raw output to ServiceNow via the ECC Queue
Examples of built-in probes:
- Unix Probe: SSH connects to Linux/Unix; runs
uname -a,cat /etc/os-release,df -h - Windows Probe: WMI connects to Windows; queries Win32_OperatingSystem, Win32_Processor, Win32_LogicalDisk
- SNMP Probe: SNMP v1/v2c/v3 queries for network device MIBs
- TCP Probe: Port scan during horizontal discovery
- Registry Probe: Reads Windows registry for installed software
What a Sensor Does
A Sensor is JavaScript that runs on the ServiceNow instance (not MID Server) to:
- Receive the raw output from a Probe
- Parse it (split strings, extract values from JSON/XML/text)
- Build structured CI payloads (setting specific field values)
- Pass the payload to IRE for CMDB update
The Probe/Sensor relationship is always 1:1 — each Probe has a corresponding Sensor. The Probe says "here's what the device said." The Sensor says "here's what that means for the CMDB."
Probe/Sensor Limitations That Led to Patterns
- Probes are JavaScript — customizing them requires scripting skills
- When a new OS version ships with different command output formats, the sensor breaks
- No built-in version detection — a probe for RHEL 7 might not work for RHEL 9
- Probes run sequentially — poor parallelism for large environments
- Hard to extend for complex multi-step data collection flows
Discovery Patterns — The Modern Approach
Discovery Patterns are the modern replacement for most probe/sensor pairs. Introduced in Helsinki (2016) and significantly matured since, Patterns use a declarative, step-based approach rather than custom JavaScript.
What Makes Patterns Different
- Declarative steps, not scripts: Patterns are built as a sequence of named steps (Connect, Get OS Info, Run Command, Parse Output, Set CI Field). Each step uses configuration, not code.
- Version-aware: Patterns can include conditions ("if OS version > 7, use this command; else use that command"). This handles OS version differences cleanly.
- Pattern Designer UI: Patterns can be viewed and modified in ServiceNow's Pattern Designer — a visual editor, not a code editor.
- ServiceNow-maintained: ServiceNow ships and updates patterns for common CI types (Linux, Windows, Cisco, VMware, etc.). You receive pattern updates automatically, unlike probes which require manual script maintenance.
- Better performance: Patterns use a more efficient execution engine and better parallelism.
Pattern Components
| Component | Purpose | Example |
|---|---|---|
| Pattern | Top-level container for a CI type's discovery logic | "Linux OS Pattern," "Windows Server Pattern" |
| Step | Individual action within a pattern (connect, run command, parse, map to CI field) | "SSH Connect Step," "Get Hostname Step" |
| Connection Step | Establishes the protocol connection using a credential | SSH connection to port 22 using Linux credential |
| Command Step | Runs a specific command on the target and captures output | cat /proc/cpuinfo |
| Parse Step | Extracts specific values from command output using regex, JSON path, or XML path | Extract "model name" from /proc/cpuinfo output |
| CI Mapping Step | Maps extracted values to CMDB CI fields | Extracted "model name" → cpu_name field |
Pattern Execution Flow
uname -r returns 5.4.0-91-generic.Credential Types — What Discovery Uses to Authenticate
Vertical Discovery must authenticate to each target device. Credentials are stored in ServiceNow's Credential Vault (the discovery_credential table) and retrieved by the MID Server at scan time. Never stored in config.xml or in probe scripts.
Credential Types by Protocol
| Credential Type | Protocol | Used For | Key Fields |
|---|---|---|---|
| SSH Password | SSH | Linux/Unix servers, network devices | Username, Password |
| SSH Private Key | SSH | Linux/Unix servers; more secure than password | Username, Private Key (PEM), Passphrase |
| Windows (NTLM/WMI) | WMI / DCOM | Windows servers and workstations | Domain, Username, Password |
| SNMP v1/v2c | SNMP | Network devices (switches, routers, printers) | Community string (read-only recommended) |
| SNMP v3 | SNMP | Network devices with enhanced security | Username, Auth Protocol, Auth Key, Privacy Protocol, Privacy Key |
| VMware vSphere | VMware API | ESXi hosts and vCenter | Username, Password, vCenter URL |
| JDBC | JDBC | Databases (Oracle, SQL Server, MySQL) | Username, Password, Connection String |
| Basic Auth (HTTP) | HTTP/REST | Web APIs, management interfaces | Username, Password |
Credential Affinity — How Discovery Picks the Right Credential
You might have 50 different SSH credentials for different server groups. How does Discovery know which credential to use for which server? The answer is Credential Affinity.
Credential Selection Methods
ServiceNow tries credentials in this order:
- Credential Affinity (most specific first): A credential can be explicitly assigned to a specific IP address, IP range, or CI record. When a match is found, this credential is tried first.
- Type-based fallback: If no affinity match is found, Discovery tries all credentials of the matching type (e.g., all SSH credentials) in order until one succeeds.
- Failure: If no credential succeeds, vertical Discovery fails for that device. The CI gets a partial record with only IP-level data.
Credential Affinity Configuration
On each Credential record, you can specify:
- IP ranges: This credential only applies to 10.0.1.0/24 (the production Linux servers)
- CI class: This credential applies to all cmdb_ci_linux_server CIs
- MID Server: This credential is available only to specific MID Servers
Least-Privilege Principle for Discovery Credentials
Discovery credentials should use read-only accounts where possible:
- Linux: create a dedicated user with sudo access to specific read-only commands only (no full sudo)
- Windows: use a domain user in the "Read-Only" or specific WMI groups, not a Domain Admin
- SNMP: use read-only community strings, never read-write
- Databases: SELECT-only permissions; no INSERT/UPDATE/DELETE
Protocol Deep Dives — SSH, WMI, and SNMP
Understanding what each protocol can discover helps you answer "which credential type is needed for which CI class?" questions.
SSH — Linux and Unix Discovery
SSH is the primary protocol for discovering Linux, Unix, Mac OS X, and network devices that support SSH (Cisco IOS, Junos, etc.).
What Discovery collects via SSH:
- OS name, version, kernel version (
uname -a,/etc/os-release) - CPU model, count (
/proc/cpuinfo) - Memory total and available (
/proc/meminfo) - Disk partitions and usage (
df -h,lsblk) - Network interfaces and IPs (
ip addr) - Running services (
systemctl list-units --state=running) - Installed packages (
rpm -qaon RHEL,dpkg -lon Debian) - Running processes (
ps -ef)
SSH Private Key vs. Password: Private key authentication is more secure
and is preferred for production. The key must be added to the target server's
~/.ssh/authorized_keys for the Discovery user.
WMI — Windows Discovery
Windows Management Instrumentation (WMI) is Microsoft's remote management protocol. Discovery uses WMI (via DCOM/RPC, port 135 + dynamic high ports) to query Windows systems.
WMI classes Discovery queries:
Win32_OperatingSystem— OS name, version, build number, last boot timeWin32_Processor— CPU model, cores, speedWin32_ComputerSystem— Total RAM, domain name, hostnameWin32_LogicalDisk— Drive letters, capacity, free spaceWin32_NetworkAdapterConfiguration— IP addresses, MAC addressesWin32_Product— Installed software (MSI-installed only)Win32_Service— Windows services and their status
SNMP — Network Device Discovery
Simple Network Management Protocol is used for discovering routers, switches, firewalls, printers, and other network-attached devices that don't support SSH or WMI.
SNMP uses a hierarchical tree of data called a MIB (Management Information Base). Discovery queries specific OIDs (Object Identifiers) to get device properties.
sysDescr— Device description (make, model, OS version)sysName— HostnameifDescr— Interface names and typesifOperStatus— Interface operational status (up/down)- Cisco-specific MIBs — For detailed Cisco device data
SNMP v2c uses a community string (like a password). "public" is the default community string on many devices — this is a security risk and should be changed.
SNMP v3 adds proper authentication (SHA/MD5) and privacy/encryption (AES/DES). Preferred for production.
Pattern vs. Probe — Full Comparison
| Dimension | Probe/Sensor (Legacy) | Pattern (Modern) |
|---|---|---|
| Technology | JavaScript (Probe on MID Server, Sensor on ServiceNow) | Declarative XML steps, no-code / low-code |
| Version awareness | Limited — must code OS version checks manually | Built-in conditions per OS version |
| Customization | Requires JavaScript expertise | Pattern Designer UI; minimal scripting |
| ServiceNow maintenance | Probes rarely updated; customer maintains customizations | ServiceNow ships pattern updates; auto-applied |
| Execution location | Probe: MID Server. Sensor: ServiceNow instance | Entire pattern executes on MID Server execution engine |
| Performance | Sequential; limited parallelism | Better parallelism; more efficient execution |
| Supported CI types | Older device types; some still not covered by patterns | Modern OS, cloud, virtualization, storage types |
| Use today | Still active for device types not yet covered by patterns | Preferred for all new configurations |
Custom Patterns — Extending Discovery for Proprietary Systems
ServiceNow ships patterns for common CI types, but your environment may have proprietary applications or custom software that needs custom discovery logic. ServiceNow's Pattern Designer allows you to create custom patterns.
When to Create a Custom Pattern
- A proprietary application runs on discovered servers and you need to track its version and config
- An industry-specific system (medical device software, industrial control software) has no ServiceNow-provided pattern
- You need to discover specific configuration files or registry keys that standard patterns don't capture
Pattern Designer
Navigate to Discovery → Pattern Designer to create or modify patterns. The designer provides:
- Visual step builder (add/remove/reorder steps)
- Step library with pre-built operations
- Test mode to run the pattern against a specific CI and see output
- Version history for pattern changes
Pattern Lifecycle
- Active patterns are used by Discovery when they match a device type
- Retired patterns are kept for history but no longer executed
- When ServiceNow ships an updated version of a pattern (e.g., updated Linux pattern for RHEL 9), it replaces the old version automatically if you haven't customized it. Custom patterns are protected.
Patterns, Probes & Credentials — Key Facts
- Probe: Legacy. JavaScript on MID Server. Connects to device, runs commands, returns raw data to ServiceNow.
- Sensor: Legacy. JavaScript on ServiceNow instance. Parses probe raw output into structured CI fields.
- Pattern: Modern. Declarative steps on MID Server execution engine. Replaces probe/sensor pairs. No-code/low-code.
- Probe runs on MID Server. Sensor runs on ServiceNow. Patterns run entirely on the MID Server execution engine.
- Credentials stored in ServiceNow Credential Vault — never in config.xml or probe scripts.
- Credential affinity — credentials assigned to specific IP ranges take priority over general credentials.
- SSH private key is more secure than SSH password. Both are valid for exam.
- SNMP community strings (v2c) or username/auth-key/privacy-key (v3) for network devices.
- WMI requires port 135 + dynamic high ports. Firewall blocking dynamic ports = WMI failure.
- Partial discovery = horizontal succeeded, vertical failed. Almost always a credential issue.
- Least privilege for Discovery credentials. Never use root or Domain Admin.
Term Grid
discovery_credential) storing encrypted credentials for target devices. Retrieved by MID Server at scan time.Practice Questions
Click any question to reveal the answer and explanation.
Practice Questions
4 questions · Select an answer to see the explanation immediately.
What is the key architectural difference between a Discovery Probe and a Discovery Pattern?
B is correct. Probes are the legacy model: JavaScript runs on the MID Server, collects raw data, and returns it to ServiceNow where a paired Sensor script parses it. Patterns are modern and declarative — they run entirely on the MID Server execution engine without requiring a separate Sensor. A is wrong — Sensors run on ServiceNow, not Probes. C and D are incorrect distinctions.