search cancel

How to extract the IP address from a variable through Event Procedure and REGEX

book

Article ID: 215060

calendar_today

Updated On:

Products

CA Spectrum DX NetOps

Issue/Introduction

How to grab the IP address from a variable through an Event Procedure and Regular Expression?

 

Environment

Release : 10.4.1

Component : Spectrum Alarm & Event Management

Resolution

Use the following URL to validate your REGEX:

https://regex101.com/

((?:\d+\.){3}\d+)

Here an example:

The Event Procedure on 0x210d40 event code will generate the 0xfff0000b event code with the existing variable and it will grab the IP Address from the variable {S 4} and put it in the variable {S 6}.

0x210d40 E 0 P "CreateEventWithVariables({C CURRENT_MODEL}, {H 0xfff0000e}, SetEventVariable(GetEventVariableList(), {U 6}, GetRegexp(GetEventVariable({U 4}), {S \"((?:\\\\d+\\\\.){3}\\\\d+)\"}, {U 1})))"

0xfff0000e E 0

Please review this section of Spectrum guide about using Escape Character in the Event Procedure:

https://techdocs.broadcom.com/us/en/ca-enterprise-software/it-operations-management/spectrum/10-4-3/managing-network/event-configuration/about-event-disposition-files.html

 

Attachments