A discovery pattern is the sequence of commands that tells ServiceNow how to recognize a configuration item and its connections. You build patterns in Pattern Designer, each save creates a new version, and the commands run through a MID Server. Test them against the credentials and IP addresses you actually have before use.
Where patterns fit in ITOM Visibility
A pattern detects the attributes of a configuration item (CI) and its outbound connections. Application patterns serve both Service Mapping and Discovery, so one definition drives top-down service maps and horizontal inventory. Infrastructure patterns feed Discovery alone, which uses them to build device lists.
Each pattern points at a main CI type and can list related CI types that are populated in the same run. Language is the first thing to check. Confirm the language of command output on the target system before you blame the pattern logic.
Create the CI type before the pattern
The CMDB needs a class for an item before a pattern can report it, so create the CI type first. Open CI Class Manager, switch to the hierarchy view, and add a child class under the closest existing parent. Name the table to match the other CMDB classes, using a custom prefix such as u_ for your own tables.
Identifiers stop a rediscovered server from appearing twice. An identifier lists the criteria, such as class, installation directory or serial number, that match a discovered CI to a record already in the CMDB. Set it active and set priorities when several identifier entries exist. If no criterion matches, the CI is treated as new. Each CMDB class can be associated with a single identification rule, and that rule is what uniquely identifies its CIs in the CMDB. For the identifier topic in more depth, see ServiceNow CMDB Identification and Reconciliation Explained. For the classifier side of discovery, see ServiceNow Discovery Classifiers and Identifiers.
Related entries work the same way. Each names a related table and a referenced field that must point at the configuration item table or one of its children. Lower priority numbers are checked first, and entries with identical priorities are applied at random. Leave gaps between numbers, such as 10, 20 and 30, so new entries fit in later.
Build the pattern on the Basic tab
Creating a pattern requires the pd_admin role. Go to All > Pattern Designer > Discovery Patterns, select New, and complete the Basic tab.
| Field | What to enter |
|---|---|
| Pattern type | Application for top-down and horizontal discovery; Infrastructure for host list discovery |
| Name | A unique, self-explanatory name, such as an Apache on Unix pattern |
| CI type | The type the pattern discovers |
| Operating system | Application patterns only: All, or the specific systems the CI runs on |
| Run Order | Application patterns only: Before or After another named pattern |
| Enforce Process Classification | Application patterns only: the pattern runs when the process on the CI matches the classification criteria |
Run Order matters where two patterns can match one service. IIS and Microsoft Exchange both expose an HTTP entry point, and Exchange reuses some IIS components. If IIS runs first, discovery can mislabel an Exchange server as IIS. Setting the Exchange pattern to run Before IIS prevents that.
Define identification steps for each incoming connection, then add a connection section for application patterns. Save, select Debug Mode, and enter a test host IP address to check the steps. When the results look right, select Pattern Sync to Mid from Discovery > MID Servers to push the set to the MID Server. For the publishing steps, see Finalize a Pattern: Save, Check and Publish in Discovery.
Extend a pattern without rewriting identification
Extension sections add discovery logic without changing the identification sections. Each wraps a shared library, a reusable run of steps stored as its own record. When a pattern has several extension sections, set their order numbers. The MID Server runs the lowest number first, and a lone section defaults to 1. Extensions run after identification, and only when at least one identification section has succeeded. Customizing a pattern means reading command output and deciding how the values should be parsed, so basic programming knowledge is desirable.
Saving a change to a shared library updates all patterns that use it, so check which patterns reference a library before editing it. A precondition on a library step belongs to the pattern where it was created. When the condition fails, that pattern skips the library’s steps, and other patterns are unaffected.
Related items let a server be discovered together with its ports or serial numbers. Open the identification section, select Manage related CIs on the CI Attributes pane, and add the related CI type. Each related type appears as a new tab under the main CI tab. Related items add context, but the system does not use them to identify the CI.
Track versions and choose the active one
Every save creates a version, and the version marked Current is the one discovery uses. The default is the latest version. To switch, open the Versions section on the Pattern tab, select the version, and choose Revert to this version. The chosen version becomes Current.
Compare before switching. Select an older version and choose Compare to Current. The texts open side by side, color-coded: purple for an updated step, green for added lines, and red for deleted ones. Revert chunk restores one step from the older version, and Save Merge keeps copied steps.
Customizing creates a copy and leaves the original preconfigured pattern in place. When an update arrives from the ServiceNow Store, the original is updated and your copy is excluded from the upgrade. To drop your copy, revert to the original. In domain-separated instances, a customized global pattern becomes a copy for that domain. Switching a pattern on or off is not a customization from Visibility Content 6.28.0, so it keeps receiving updates. A discovery admin ticks Active on the disabled pattern and selects Update.
Validate commands before the first run
The MID Server runs each command, many of which need credentials and some of which need elevated rights on the target. For the probe and sensor types, see Discovery probes and sensors.
First refresh the list under All > Pattern Designer > Command Validation Tool > Commands List with Refresh Command List. Do this on first viewing, after upgrading the pattern applications, and after customizing a pattern. A pde_viewer user can view the Command List but cannot modify it.
Then go to Command Validation Tool > Create New. Select Validate All Pattern Commands to test a whole pattern at once, or pick individual commands.
| Field | Purpose |
|---|---|
| MID Server Selection Method | A specific MID Server, automatic selection by IP range, or any eligible MID Server |
| IP Addresses | Comma-separated addresses, a hyphenated range, or a slash-notation network |
| Command Type | Shell, WMI, SNMP tabular or scalar, SNMP Walk, or HTTP GET for basic authentication |
| Pattern or Commands | Validate one pattern’s commands, or specific commands from the list |
Testing an IP range or network needs the ParseIPRanges script include installed on your instance first. If commands use temporary variables, save the form, select Refresh Temporary Variable Mappings, and enter values on the Temporary Variable Mappings tab. Then select Run Command Validation.
Read results and debug mapping errors
Open Command Validation Tasks, find the task number, and confirm Status reads Complete. On Command Validation Task Results, look for FAILURE in the Result column, open the command type link, and read Results Details. A discovery admin can then open the troubleshooting suggestions and follow the Steps to Remediate window.
From the Discovery Patterns list, right-click a pattern and choose List Pattern Commands to open its commands in the Command List.
Mapping errors appear as warning icons on a service instance map. If the discovery message reads “Failed to recognize application”, the pattern is the cause. Right-click the affected CI, choose Show discovery log, expand the failed section, click the failed step, and select Debug. Run the steps in order until the faulty one appears. In one worked case, a port set to 8081 should have been 8080. Correct the attribute, click Test, save, activate, and then select Resume discovery on the CI. This work needs the admin and service_mapping_admin roles. For a wider troubleshooting sequence, see Troubleshooting ServiceNow Discovery: A Practical Guide.
Install the applications and move patterns to production
Pattern Designer installs with Discovery or Service Mapping, and the patterns ship in separate applications. Discovery and Service Mapping Patterns (sn_itom_pattern) holds the latest versions of Store-released patterns. Visibility Content (sn_pattern_design) holds updated patterns from the family releases up to Tokyo. Pattern Designer Enhancements (sn_itom_pde) adds command validation, and from version 3.9.0 it provides the pde_viewer role. Check which application holds a pattern before upgrading, because ServiceNow releases discovery patterns through two different plugins.
To move patterns, build and test in development, then select them under Discovery Patterns, open Actions on selected rows, and choose Export patterns or Export patterns with CMDB items. The CMDB option adds CI types, identifiers and reconciliation rules, and takes no more than 20 patterns at a time. Shared libraries cannot be exported directly, and script includes are not in the update set, so move them separately. In production, elevate to security_admin, import the XML under Retrieved Update Sets, preview it, and commit. Then run Pattern Sync to Mid, and restart the MID Server if results look wrong.
Frequently asked questions
Do I need programming skills to customize a pattern?
Basic programming knowledge is desirable, because customizing a pattern means reading command output and deciding how the values should be parsed.
Can I change a shared library for just one pattern?
No. A saved change applies to all patterns using that library. To limit a step, add a precondition inside that pattern’s extension section.
What happens to my customized pattern when an update arrives?
The Store updates the original, and your copy is excluded from the upgrade. Compare the two versions, then keep your copy or revert.
Which role can read validation results without changing them?
The pde_viewer role can open tasks, results and the command list, but cannot modify them or open the Steps to Remediate window.