Configuration Property Parsing - Extract Network Data with Regex Patterns
Configuration Property Parsing - Extract Network Data with Regex Patterns
Section titled “Configuration Property Parsing - Extract Network Data with Regex Patterns”Configuration Property Parsing extracts structured data from unstructured configuration files using regular expressions. While SNMP Polling queries devices for standardized hardware and software details, Configuration Parsing mines the gold buried in your backed-up configs—VLANs, routing protocols, ACL counts, NTP servers, and any other configuration-specific data.
Configuration Property Parsing: Intelligence from Your Configs
Section titled “Configuration Property Parsing: Intelligence from Your Configs”What Configuration Parsing Does
Section titled “What Configuration Parsing Does”Every time rConfig backs up a device configuration, it can automatically run regex patterns against the output to extract specific values. These extracted properties become dynamic device attributes, just like SNMP-polled data, available for reporting and analysis.
The magic: You define the pattern once, and rConfig extracts the data automatically with every backup. No manual parsing, no custom scripts, no spreadsheet work.
How It Works
Section titled “How It Works”The Architecture
Section titled “The Architecture”Configuration Property Parsing uses three components:
- Commands - The rConfig commands that generate configuration output (e.g.,
show running-config
,display current-configuration
) - Regex Patterns - Regular expressions that match and capture specific values from command output
- Property Definitions - Named extraction rules that link regex patterns to specific commands
The Workflow
Section titled “The Workflow”- Device backup executes (manual, scheduled, or CLI)
- Configuration captured for all assigned commands
- rConfig checks if any Configuration Properties are linked to the executed commands
- If yes, regex patterns run against the command output
- Matching values extracted and stored as device properties
- Properties displayed in device details and inventory reports
Key insight: Parsing happens automatically during backups. The same operation that captures configs also extracts intelligence from them.
Why Use Configuration Parsing
Section titled “Why Use Configuration Parsing”Use Cases That Make Sense
Section titled “Use Cases That Make Sense”Configuration-Specific Data: Extract details that exist only in configs—VLAN lists, BGP networks, routing protocol timers, interface descriptions, ACL names.
SNMP-Disabled Environments: Security-focused networks often disable SNMP. Configuration parsing works regardless of SNMP status.
Vendor-Specific Details: Extract proprietary configuration elements that don’t have SNMP OIDs—Cisco VRFs, Juniper policies, Aruba controller roles.
Custom Properties: Need to track custom config elements unique to your environment? Write a regex, extract the data.
Compliance Validation: Extract security settings (NTP servers, SNMP communities, syslog hosts) to verify compliance with standards.
Audit Trails: Track which devices have specific features enabled—EIGRP vs OSPF, crypto policies, QoS configurations.
When Configuration Parsing Shines
Section titled “When Configuration Parsing Shines”- SNMP unavailable: The only option when SNMP is disabled or unsupported
- Configuration-centric data: Details that live in configs, not SNMP MIBs
- Vendor-specific syntax: Parsing handles any config format with the right regex
- Custom tracking needs: Extract anything that appears in text output
- Already backing up: Zero additional overhead—parsing piggybacks on existing backups
When to Use SNMP Polling Instead
Section titled “When to Use SNMP Polling Instead”See SNMP Polling Concepts for comparison, but generally:
- Standardized hardware details: Serial numbers, model info, interface MACs
- Runtime statistics: Uptime, CPU, memory—things not in static configs
- Cross-vendor consistency: Standard SNMP MIBs work across vendors
- Simpler setup: OIDs are more straightforward than regex patterns
Best practice: Use both. SNMP for standardized hardware/software details, configuration parsing for config-specific intelligence.
The Command Linkage Model
Section titled “The Command Linkage Model”Configuration Properties are explicitly linked to specific commands. This means:
- A property tied to
show running-config
extracts data when that command runs - Different properties can target different commands (
show version
,show ip route summary
, etc.) - Multiple properties can extract different values from the same command output
Example scenario: You have three properties linked to show running-config
:
- Extract hostname
- Extract NTP servers
- Extract SNMP community strings
One command execution, three automated extractions.
Regular Expressions: The Engine
Section titled “Regular Expressions: The Engine”Configuration parsing lives and dies by regex quality. Good regex patterns are:
- Specific enough to match only the intended values
- Flexible enough to handle config variations
- Efficient to avoid performance overhead
- Tested against real configuration samples
Regex Complexity Levels
Section titled “Regex Complexity Levels”Simple - Extracting single values with consistent syntax:
/^hostname\s+(\S+)/m
Extracts: hostname router1
→ router1
Moderate - Extracting structured data with variations:
/^ntp server\s+(\S+)/m
Extracts: All NTP server addresses from multiple ntp server
lines
Complex - Multi-line patterns or conditional matching:
/^interface\s+\S+[\s\S]*?ip address\s+(\d+\.\d+\.\d+\.\d+)/m
Extracts: IP addresses under interface configurations
Regex Testing is Critical
Section titled “Regex Testing is Critical”Never deploy untested regex. Use tools like regex101.com to validate patterns against sample configurations before creating properties in rConfig.
Better yet, use rConfig’s built-in Config Property Test feature to test against actual device configurations stored in the system.
What Gets Extracted
Section titled “What Gets Extracted”Common property categories:
System Information
- Hostnames
- Domain names
- System images/boot files
- Software versions
- Configuration registers
Network Services
- NTP servers
- DNS servers
- Syslog hosts
- SNMP community strings
- TACACS/RADIUS servers
Routing Protocols
- BGP networks
- OSPF/EIGRP areas
- Redistributed routes
- Route map names
Security Elements
- ACL names and counts
- Crypto policies
- AAA configurations
- Enable secrets (hashed)
Interface Details
- Loopback interfaces
- Interface descriptions
- IP addresses
- VLAN assignments
Hardware Identifiers
- Processor board IDs
- Serial numbers (when in
show version
output) - Memory specifications
- License levels
Performance Considerations
Section titled “Performance Considerations”Parsing Overhead
Section titled “Parsing Overhead”Regex execution against configuration files is fast:
- Each pattern: 1-10ms (typical)
- 10 properties per device: 10-100ms additional time
- For most deployments, this is negligible
Scaling
Section titled “Scaling”Configuration parsing scales linearly:
- 100 devices, 10 properties each = ~1000 regex operations
- Even at 10ms per operation, that’s ~10 seconds total
- Operations run in parallel during backup jobs
Config File Size Impact
Section titled “Config File Size Impact”Larger configs take slightly longer to parse:
- 1KB config: 5ms
- 100KB config: 50ms
- Performance remains excellent even for massive configs
Integration with Device Inventory
Section titled “Integration with Device Inventory”Configuration-parsed properties join SNMP-polled properties in Device Inventory:
- Inventory reports include both SNMP and config-parsed data
- Properties are queryable (in future V8+ releases)
- Historical tracking via activity logs
- Export to external systems via API or CSV
The combination gives you comprehensive device intelligence: SNMP for standardized data, config parsing for environment-specific details.
Comparison: Config Parsing vs SNMP Polling
Section titled “Comparison: Config Parsing vs SNMP Polling”Aspect | Config Parsing | SNMP Polling |
---|---|---|
Data Source | Backed-up config files | Live SNMP query |
Setup Complexity | Moderate (regex skills needed) | Moderate (OIDs, credentials) |
Data Types | Configuration-specific | Hardware, software, runtime |
SNMP Required | No | Yes |
Vendor Variability | High (config syntax varies) | Low (standard MIBs) |
Real-Time | Reflects last backup | Current device state |
Regex Knowledge | Required for custom patterns | Not required |
Works When SNMP Disabled | Yes | No |
When to Use Which Method
Section titled “When to Use Which Method”Use Configuration Parsing When:
Section titled “Use Configuration Parsing When:”- SNMP is disabled or unavailable
- You need config-specific details (VLANs, protocols, policies)
- The data doesn’t have a corresponding SNMP OID
- You’re already backing up configs regularly
- You need vendor-specific configuration elements
Use SNMP Polling When:
Section titled “Use SNMP Polling When:”- You need standardized hardware/software details
- Real-time operational data is important (uptime, stats)
- You want cross-vendor consistency
- The data is available via standard MIBs
- You need runtime information not in configs
Use Both When:
Section titled “Use Both When:”- Building comprehensive device inventory
- You want both config intelligence and hardware details
- Maximum visibility is the goal
- Different teams need different data types
Regex Best Practices
Section titled “Regex Best Practices”1. Test Before Deploying
Section titled “1. Test Before Deploying”Always validate regex against real config samples. Use regex101.com or rConfig’s test feature.
2. Use Multiline Mode
Section titled “2. Use Multiline Mode”Most config parsing needs ^
and $
to match line boundaries. Add the /m
flag:
/^hostname\s+(\S+)/m
3. Capture Groups Wisely
Section titled “3. Capture Groups Wisely”Use parentheses to capture the value you want:
/ip address\s+(\d+\.\d+\.\d+\.\d+)/ # Captures the IP
4. Handle Whitespace
Section titled “4. Handle Whitespace”Use \s+
for flexible whitespace matching, \S+
for non-whitespace sequences.
5. Be Specific
Section titled “5. Be Specific”Anchor patterns to avoid false matches:
/^ntp server\s+(\S+)/m # Only matches lines starting with "ntp server"
6. Account for Variations
Section titled “6. Account for Variations”Some configs use tabs, some use spaces. Some have trailing comments. Build flexibility into patterns.
7. Document Your Patterns
Section titled “7. Document Your Patterns”In rConfig, give properties clear names and descriptions explaining what they extract.
The Bottom Line
Section titled “The Bottom Line”Configuration Property Parsing turns your configuration backups into structured data. While SNMP Polling handles standardized hardware and operational details, config parsing extracts the configuration-specific intelligence that makes your network unique.
It’s most valuable when:
- You need config-specific data at scale
- SNMP isn’t available or doesn’t expose the data you need
- You’re already backing up configurations regularly
- You want to track custom configuration elements
Combined with SNMP Polling, Configuration Parsing gives you complete visibility into your network infrastructure—hardware, software, runtime stats, and configuration intelligence—all captured automatically with every backup.
Related Documentation
Section titled “Related Documentation”- SNMP Polling Concepts - The complementary data extraction method
- Device Inventory Overview - How parsed properties integrate with inventory
- Device Connectivity Process - Understanding how configs are captured
- Monaco Code Editor - Professional configuration editing and comparison
- CLI Commands - Automation and backup commands