Re: Help on SNMP Trap template (326 Views)
Reply
Honored Contributor
ramesh9
Posts: 1,034
Registered: ‎04-19-2011
Message 1 of 7 (398 Views)
Accepted Solution

Help on SNMP Trap template

Hi All

 

In one of our SNMP trap template I am finding following condition,

 

CONDITION
                        $e ".1.3.6.1.4.1.610201.2"
                        $G 6
                        $S 10
                        $6 "<1*><*.source>"

 

Here I am not able to understand the line,

 

                       $6 "<1*><*.source>"

 

I could infer it takes the input from $6 variable been passed from device but could not understand
what other part does.

 

Can someone help me with a example of what could be the input for $6 please..

Please use plain text.
Honored Contributor
Pat Campbell
Posts: 735
Registered: ‎08-01-2001
Message 2 of 7 (374 Views)

Re: Help on SNMP Trap template

$6 "<1*><*.source>"

 

pattern matching on $6 will be for any characters (*), with all except the first character assigned to variable source

 

<1*>  "one character of any kind, including seperators"

<*.source> "multiple characters of any kind, including seperators, assigned to variable source"

 

If $6 contains "abcd", then variable source will be populated with "bcd"

Please use plain text.
Honored Contributor
ramesh9
Posts: 1,034
Registered: ‎04-19-2011
Message 3 of 7 (365 Views)

Re: Help on SNMP Trap template

Thanks Pat,

 

If my incoming text is like,

 

(Customer123 \HOST-IPBX) :Route Pattern #1 - LOCAL has status up.,

 

which comes in varbind .1.3.6.1.4.1.6102.1.2.1

 

How can I pattern match, so I can pick only "HOST-IPBX" from the text.

 

I tried

 

      <*.var1>=<14*><*.source>,<*>

 

but it did not work.

 

Can you please help..

Please use plain text.
Honored Contributor
Pat Campbell
Posts: 735
Registered: ‎08-01-2001
Message 4 of 7 (360 Views)

Re: Help on SNMP Trap template

Assuming "HOST-IPBX is always preceeded by "\", and terminated with ")", try

\\<*.yourvar>)

(you must escape the "\" with another "\")
Please use plain text.
Honored Contributor
ramesh9
Posts: 1,034
Registered: ‎04-19-2011
Message 5 of 7 (350 Views)

Re: Help on SNMP Trap template

Thanks Pat, but I am not getting any message in OM console.

 

I tried following for pattern match,

 

<*.var0>=<*.application>,<*.var2>=<*.severity>,<*.var3>=<*.eventid>,<*.var4>=<*.condition>,<*.var1>=<*.message>,<*.var1>=\\<*.s
ource>)

 

and

 

<*.var0>=<*.application>,<*.var2>=<*.severity>,<*.var3>=<*.eventid>,<*.var4>=<*.condition>,<*.var1>=<*.message>,<*.var1>=\\<*.s
ource>)<*>

 

where the input string is coming in var1.

 

Is there any problem that I am trying to extract from var1 twice

 

<*.var1>=<*.message>,

<*.var1>=\\<*.source>)

 

var1 contains following message text,

 

(Customer123:\HOST-IPBX): S0/SU2/DS1from HOST-IPBX is DOWN.

 

Also if I the message text contains,

 

 

(Customer123:HOST-IPBX): Device from HOST-IPBX is DOWN.

 

does the above pattern matching work..

 

 

 Please help.

Please use plain text.
Honored Contributor
Pat Campbell
Posts: 735
Registered: ‎08-01-2001
Message 6 of 7 (345 Views)

Re: Help on SNMP Trap template

Sorry, but I am not familiar with using an equal sign to extract from a variable to another variable, and I am unable to find a reference to that syntax in my OMU documentation.

Maybe you can explain why you need to do that. Normally, I assign data to a variable in the pattern matching ($6 \\<*.source>) and then use the variable where needed, such as in the message text ("message text contains <source> blah, blah").

If your text is "Customer123:HOST-IPBX): Device from HOST-IPBX is DOWN.", then, no, the pattern will not match because is is looking for the text between "\" and ")".

Please use plain text.
Honored Contributor
ramesh9
Posts: 1,034
Registered: ‎04-19-2011
Message 7 of 7 (326 Views)

Re: Help on SNMP Trap template

Following pattern match worked,

 

<*.var0>=<*.application>,<*.var2>=<*.severity>,<*.var3>=<*.eventid>,<*.var4>=<*.condition>,<*.var1>=([CustomerABC |CustomerXYZ:]<*.source>)<*.message>,<*>

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation