CIS-DF Hub Part 3: Discovery Patterns, Probes & Credentials
⬡ Part 3 · Topic 3

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.

📋 9 sections ~30 min read 🎯 ~19% exam weight (INGEST domain) 🏷 Probe · Sensor · Pattern · Credential · SSH · WMI · SNMP

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.

💡
Key Concept — Two Generations of Discovery Technology ServiceNow has two generations of vertical discovery technology: (1) Probe/Sensor model (legacy, still in use for some device types) and (2) Pattern model (modern, recommended for all new configurations). Both are tested on the exam. The key difference: patterns are declarative and version-aware; probes are procedural JavaScript. Patterns replaced probes for most device types starting with the Helsinki release.

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:

  1. Connect to a target device using a specific protocol (SSH, WMI, SNMP, etc.)
  2. Execute specific commands or queries
  3. 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:

  1. Receive the raw output from a Probe
  2. Parse it (split strings, extract values from JSON/XML/text)
  3. Build structured CI payloads (setting specific field values)
  4. 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."

🧪
Analogy — Probe as Lab Test, Sensor as Lab Analyst A Probe is like a lab test — it goes to the patient (device), takes a blood sample (raw data), and brings it back to the lab. The Sensor is the lab analyst who processes the sample, interprets the results, and writes a report (structured CI data) that the doctor (CMDB) can use. The probe collects; the sensor interprets.

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

1
Pattern Selection
Device Classified → Pattern Chosen
Horizontal Discovery identifies the device type (Linux server, Windows, Cisco switch). IRE looks up which Pattern applies to that CI class and triggers it on the MID Server execution engine.
Input: device classified as cmdb_ci_linux_server Output: Linux OS Pattern selected
2
Connection Step
Credential Matched → Session Opened
The Pattern's Connection Step selects the matching credential from the Credential Store (SSH key or username/password for Linux) and opens a session to the target device.
Credential type: SSH (Linux) Result: SSH session established
3
Command Step
Commands Executed on Device
The Pattern runs configured commands over the open session. Each Command Step collects one or more data points. Example: uname -r returns 5.4.0-91-generic.
4
Parse Step
Raw Output Parsed to Typed Values
Parse Steps apply regex or JavaScript logic to extract typed values from raw command output. The parsed value is stored in the Pattern's variable scope for use in CI Mapping.
Input: raw string "5.4.0-91-generic" Output: kernel_version = "5.4.0-91-generic"
5
CI Mapping → IRE
Parsed Values Mapped to CI Fields → Payload Sent to IRE
CI Mapping Steps assign parsed variable values to specific CMDB fields on the target CI class. The complete CI payload is sent to IRE for identification and reconciliation.
kernel_release ← "5.4.0-91-generic" CI payload → IRE → CMDB
Exam Trap — Probes vs. Patterns Are Both Tested The exam tests both models. Know: Probes = JavaScript, run on MID Server, return raw data. Sensors = JavaScript, run on ServiceNow, parse probe output into CI fields. Patterns = declarative steps, run on MID Server execution engine, modern approach. "Which component processes raw probe output?" → Sensor. "Which modern Discovery component replaces probe/sensor pairs?" → Pattern.

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
💡
Key Concept — Credential Vault Encryption All credentials in the Credential Vault are stored encrypted using ServiceNow's AES encryption. The MID Server retrieves credentials at scan time — they are decrypted in memory only and never written to disk in plaintext. This is why you configure target credentials in ServiceNow, not in config.xml.

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:

  1. 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.
  2. 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.
  3. 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
Exam Pattern — Credential Failure Causes Partial Discovery "Discovery creates CIs with IP addresses but no OS details. The devices are reachable on port 22. What is the most likely cause?" Answer: SSH credentials are missing or wrong. Horizontal succeeded (port 22 open = reachable) but vertical failed (SSH authentication failed). Check Credential Vault for valid SSH credentials covering those IP ranges.

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
Warning — Never Use Admin/Root Credentials for Discovery Using root (Linux) or Domain Admin (Windows) credentials for Discovery is a major security risk. If ServiceNow or the MID Server is compromised, the attacker gains admin access to every server Discovery can reach. Always create dedicated, least-privilege service accounts specifically for Discovery.

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 -qa on RHEL, dpkg -l on 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 time
  • Win32_Processor — CPU model, cores, speed
  • Win32_ComputerSystem — Total RAM, domain name, hostname
  • Win32_LogicalDisk — Drive letters, capacity, free space
  • Win32_NetworkAdapterConfiguration — IP addresses, MAC addresses
  • Win32_Product — Installed software (MSI-installed only)
  • Win32_Service — Windows services and their status
💡
Tip — WMI Port Complexity WMI initially connects on port 135 (DCOM endpoint mapper) but then negotiates a dynamic high port (1024–65535) for the actual data transfer. This means firewalls must allow port 135 AND dynamic high ports from the MID Server to Windows targets. This is a common WMI Discovery failure cause: port 135 is open, but dynamic ports are blocked by the firewall, causing WMI to connect and then fail during data transfer.

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 — Hostname
  • ifDescr — Interface names and types
  • ifOperStatus — 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
💡
Key Concept — Probes and Patterns Coexist In a modern ServiceNow environment, you will find both Probes and Patterns. Patterns cover most common server and cloud CI types. Probes still handle some legacy device types (certain mainframes, proprietary systems, older network devices). ServiceNow's goal is to eventually replace all probes with patterns, but this transition is still ongoing. Knowing both is exam-required.

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.
💡
Tip — Test Patterns Before Activating Pattern Designer's test mode lets you run a pattern against a specific CI without affecting the CMDB. This lets you verify the pattern collects the right data and maps it to the correct fields before you activate it for the full Discovery schedule. Always test first — debugging a broken pattern in production is significantly harder.

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 Probe
Legacy component. JavaScript that runs on MID Server to connect to a device and collect raw data. Always paired with a Sensor.
Discovery Sensor
Legacy component. JavaScript that runs on ServiceNow to parse probe output and build structured CI field values.
Discovery Pattern
Modern replacement for probe/sensor pairs. Declarative step-based logic. Runs on MID Server execution engine. No scripting required.
Credential Vault
ServiceNow table (discovery_credential) storing encrypted credentials for target devices. Retrieved by MID Server at scan time.
Credential Affinity
Assignment of a specific credential to an IP range, CI class, or MID Server. Matching affinity credentials are tried before general credentials.
SNMP Community String
SNMP v2c "password." Should be changed from default "public" to a unique value. Use read-only community strings for Discovery.

Practice Questions

Click any question to reveal the answer and explanation.

1. In the legacy Probe/Sensor Discovery model, where does the Sensor run and what is its purpose?
A) On the MID Server — to collect raw data from target devices
B) On the target device — to run diagnostic commands
C) On the ServiceNow instance — to parse probe output and build CI field values
D) On the ServiceNow instance — to select which probe to run next
💡 Probe is on MID Server. Sensor is on the other end.
Answer: C — In the probe/sensor model, the Probe runs on the MID Server (connects to the device, collects raw data, sends it back to ServiceNow). The Sensor runs on the ServiceNow instance — it receives the raw probe output and processes it: parsing strings, extracting values, and building the structured CI field payload that gets sent to IRE.
2. Discovery for Windows servers is failing to collect OS details even though the MID Server can ping the Windows servers and port 135 is open. What is the most likely network-level cause?
A) The Windows firewall is blocking ICMP
B) The firewall blocks dynamic high ports (1024–65535) needed by WMI after the initial port 135 connection
C) WMI requires port 443 to be open
D) The Windows servers need SSH enabled for Discovery to work
💡 WMI uses port 135 to negotiate but then switches to a random high port.
Answer: B — WMI connects on port 135 first (DCOM endpoint mapper) to negotiate, then switches to a dynamically assigned high port for the actual data transfer. If the firewall blocks dynamic high ports from the MID Server to the Windows server, WMI connects and then immediately fails to transfer any data. The fix: allow the MID Server's IP to reach Windows servers on all high ports (or use Windows Firewall exceptions for WMI specifically).
3. An organization has two SSH credential records: Credential A (assigned to IP range 10.0.0.0/8) and Credential B (assigned to IP range 10.0.1.0/24). Discovery scans the IP 10.0.1.15. Which credential is tried first?
A) Credential A — it was configured first
B) Credential B — it is more specific (smaller range)
C) Both are tried simultaneously
D) The credential with the longest name alphabetically
💡 Credential affinity prefers the most specific (narrowest) matching range.
Answer: B — Credential affinity gives priority to the most specific matching range. 10.0.1.0/24 is a /24 (256 addresses), while 10.0.0.0/8 is a /8 (16 million addresses). The /24 is more specific for IP 10.0.1.15, so Credential B is tried first. If it fails, Credential A is tried as fallback.
4. What is the primary advantage of Discovery Patterns over the legacy Probe/Sensor approach?
A) Patterns require no MID Server — they run entirely in ServiceNow's cloud
B) Patterns are declarative and version-aware, reducing the need for custom JavaScript maintenance
C) Patterns can discover CIs without network credentials
D) Patterns run on the target device itself, improving data accuracy
💡 Think about what problems made probes/sensors difficult to maintain.
Answer: B — Patterns use a declarative, step-based approach that doesn't require JavaScript expertise. They include version-aware conditions (handling RHEL 7 vs RHEL 9 differently within the same pattern). ServiceNow ships and updates patterns, reducing maintenance burden. Probes required custom JavaScript that broke when OS command output formats changed. Patterns still require a MID Server (A is wrong) and still need credentials (C is wrong).
5. Where are SSH and WMI credentials for Discovery target devices stored in ServiceNow?
A) In config.xml on each MID Server host
B) In Discovery Behaviors as plain text parameters
C) In the Credential Vault (discovery_credential table) with encryption
D) In the Discovery Schedule record for each IP range
💡 Target device credentials are separate from MID Server → ServiceNow credentials.
Answer: C — Target device credentials (SSH keys, WMI passwords, SNMP community strings) are stored in ServiceNow's Credential Vault — the discovery_credential table — with AES encryption. The MID Server retrieves these from ServiceNow at scan time. config.xml (A) contains only the MID Server's credentials to connect TO ServiceNow — not target device credentials.
6. A company wants to discover a proprietary industrial monitoring application running on their Linux servers. ServiceNow's built-in Linux pattern doesn't capture data from this application. What is the recommended approach?
A) Manually enter the application data as non-discoverable CIs
B) Use the Pattern Designer to create a custom pattern with steps to collect the application's specific configuration data
C) Write a custom Business Rule to extract data when Discovery runs
D) This is not possible — only ServiceNow can create Discovery patterns
💡 ServiceNow provides a tool specifically for extending Discovery patterns.
Answer: B — ServiceNow's Pattern Designer allows customers to create custom patterns. You would build a custom pattern with steps that SSH into the Linux servers, run specific commands to read the proprietary application's configuration (e.g., checking a specific config file or running an app-specific status command), parse the output, and map the results to custom CI fields. This is the correct, supported approach for proprietary application discovery.

Practice Questions

4 questions · Select an answer to see the explanation immediately.

Patterns & Probes Quiz 1 / 4

What is the key architectural difference between a Discovery Probe and a Discovery Pattern?

💡 Explanation

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.

Where should Discovery credentials be stored in ServiceNow?

💡 Explanation

C is correct. Discovery credentials should always be stored in the ServiceNow Credential Vault as Credential records. They are encrypted, audited, and can be assigned to specific IP ranges. Storing credentials in config.xml (A) or scripts (B) is a security risk and not the ServiceNow best practice. System Properties (D) are not designed for credential storage.

A Windows server fails vertical Discovery. Horizontal Discovery succeeded. The most likely cause is a credential issue. What protocol does Windows vertical Discovery use that requires specific firewall rules?

💡 Explanation

C is correct. Windows vertical Discovery uses WMI (Windows Management Instrumentation) which requires port 135 for the initial RPC endpoint mapper, then dynamically negotiated high ports for the actual data transfer. Firewall rules blocking these dynamic ports are a common cause of partial Discovery on Windows. SSH (A) is for Linux/Unix. SNMP (B) is for network devices. HTTPS (D) is not used for WMI.

What is "credential affinity" in ServiceNow Discovery?

💡 Explanation

B is correct. Credential affinity means assigning credentials to specific IP ranges. When Discovery scans IPs in that range, the affinity-assigned credentials take priority over general credentials. This improves efficiency by reducing failed credential attempts and enables environment-specific credentials (e.g., different domains for different subnets). A, C, and D are not the definition of credential affinity.

← MID Server Deep Dive Service Mapping →