ServiceNow Discovery Patterns Linux Server – Identifying Linux Distribution and Release Version
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Parse Category — Core Linux Operations
Config : Command, Parsing Strategy (Regex/Table/Delimited), Regex, Name
Run SSH command AND extract a specific value in a single step. Replaces the old 2-step approach of Run SSH Command → Parse Variable. More efficient.
2)Parse File (Parse · Read file directly from target)
Read a file on the Linux server without executing a command. It supports Regex, Delimited, and XML parsing.
3)Parse Variable(Parse · Extract from existing variable)
Specific value will be extracted from a variable that already contains raw text. This will be used after SSH Command, where a specific value will be pulled out using Regex or Table strategy
Table Operations — Multi-Row Data
1)Filter Table (Ops · Keep matching rows only)
Filter rows from a result table keeping only rows matching a condition. Result is a smaller table with matching rows only.
2)Union Tables (Append two tables)
Append rows from two tables (same columns) into one table. Like SQL UNION ALL. Combines results of multiple SSH commands into one unified table.
3)Create Relation/Reference(CMDB relationship builder)
Link two CI records in CMDB with a named relationship (Runs on, Depends on, Hosted by). After discovering an application that runs on the Linux Server.
Others — Utility Operations
1)Set Parameter Value (Write to CMDB · MOST USED)
Write the data discovered to a CMDB CI field. Value = Source variable. Name = Destination CMDB Field. Used in EVERY scenario.
Name: $cmdb_ci_linux_server[1].short_description
Temporarily switch to a different credential for privileged steps. Unchange User reverts back. Always used as a pair — Change User → privileged steps → Unchange User.
3)Parse URL(Decompose URL into parts)
Decompose a URL/connection string into its constituent parts. Used in Service Mapping to parse DB Server details from JDBC connection strings.
jdbc:mysql://db01:3306/app → host=db01, port=3306
Scenario: Cloud Dimensions wants to collect the Linux Kernel version from 192.168.16.12 and write it to the Description field for security patch planning. This uses Parse Command Output (single step) instead of the old 2-step SSH + Parse approach.
Step1 Parse Command Output
Command uname -r
Regular Expression (.+)
Step 2 Set Parameter Value
Value "Kernel: " + $kernelVersion
Name (target) $cmdb_ci_linux_server[1].short_description
Pattern 2 Collect CPU Model Name
Scenario: The
lscpu command returns many lines of CPU info. Cloud Dimensions wants only the Model name line extracted and written to Description. This requires Parse Variable with a Regex to extract just the model from multi-line output.Step 1 Parse Command Output
Command lscpu
Regular Expression Model name:\s+(.+)
Step 2 Set Parameter Value
Value "CPU: " + $cpuModel
Name (target) $cmdb_ci_linux_server[1].short_description
Pattern 3 Collect Disk Usage (Root Partition /)
Scenario: Cloud Dimensions wants to track disk utilisation of the root partition (/) on each Linux Server. The df -h / command returns a 2-line table — the regex extracts only the percentage number.
Step 1 Parse Command Output
Command df -h /
Regular Expression (\d+)%
Step 2 Set Parameter Value
Value "Root Disk Usage: " + $diskPct + "%"
Name (target) $cmdb_ci_linux_server[1].short_description
Scenario: Cloud Dimensions wants the full OS distribution name (e.g. Ubuntu 22.04.3 LTS) from each Linux Server. Instead of running an SSH cat command, Parse File directly reads /etc/os-release — more efficient, no SSH command needed.
Step 1 Parse File
File Path /etc/os-release
Regular Expression PRETTY_NAME="(.+)"
Step 2 Set Parameter Value
Value "OS: " + $osName
Name (target) $cmdb_ci_linux_server[1].short_description
Save → Sync → Run Discovery → Validate
1) Save (Do NOT Publish)
Click Save in the top-right corner of Pattern Designer.
2) Pattern Sync to MID
Discovery → MID Servers → windows_mid →Pattern Sync to MID
3)Run Discovery
Discovery → Discovery Schedules Run discovery against the target host: 192.168.16.12
This will execute the updated pattern on the Linux server.
4) Validate Check CMDB
CMDB → Linux Servers → itom-df-linux-target
Extension Sections: Save only, never publish (Identification/Connection sections require Save + Publish).
Always Sync After Save: Save → Pattern Sync to MID → Run Discovery.
No $ in Variable Names: Use diskPct in Variables tab, reference it as $diskPct.
Value vs Name: Value = data source, Name = CMDB field where data is stored.
Debug Before Full Discovery: Test the pattern step-by-step in Debug Mode first.
Test Credentials Before Discovery: Always test credentials against the target server before running Discovery.
Avoid Double $$: Use $cpuModel, not $$cpuModel, since double $ returns empty.
If you found this article useful, please mark it as Helpful. It helps others find the content more easily 👍🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Great @Prathmeshda ! , Please provide more pattern based Use Cases
