Start a Conversation

This post is more than 5 years old

Solved!

Go to Solution

5083

September 14th, 2018 13:00

ASL to extract IP from Cisco BGP4 ObjectID

Hi, can anyone with a deeper knowledge of ASL help with this and/or suggest an easier way.

I am integrating the CISCO-BGP4-MIB into Smarts and for some reason Cisco have decided to append the BGP remotePeerIP address to the end of the SNMP objectID, why they did not put it into one of the varbinds I don't know, probably a variant/hybrid of the IETF BGP4-MIB.

The EMC ASL_Ref.pdf does mention that this is common practice, what I need to do is extract this IP to use within the notification, here is the issue:

OID2=.1.3.6.1.4.1.9.9.187.1.2.5.1.3.10.236.48.23


The only sustainable way I can think is to use ASL to repeat over the line from the right hand side & maybe using a "." as a file separator, how to achieve this though is beyond me. I want to end up with 2 variables - cleaned_oid & cleaned_ip for use within the notification itself.


thanks for any help.


Mark.
V2V

5 Posts

September 18th, 2018 09:00

Hi Mark,

I was able to separate the oid and ip address with the below example code using the substring function:

test.asl file

START {

a:rep(word) eol

}

do {

print("Value".a);

oid=substring(a,5,30);

ip=substring(a,36,50);

print("OID ".oid);

print("IP ".ip);

}

DEFAULT {

..eol

}

fs_match.txt

OID2=.1.3.6.1.4.1.9.9.187.1.2.5.1.3.10.236.48.23

run output:

./sm_adapter --file=fs_match.txt test.asl

ValueOID2=.1.3.6.1.4.1.9.9.187.1.2.5.1.3.10.236.48.23

OID .1.3.6.1.4.1.9.9.187.1.2.5.1.3

IP 10.236.48.23

Reference to the use of the substring function can be found in the 9.2 ASL Reference guide on page 85

Ron Miller

Advisor, Enterprise Technical Services

22 Posts

September 18th, 2018 00:00

thanks Ron, I have one amendment to my original post, this vendor SNMP behaviour is not documented in the asl_ref.pdf as I stated but in the "SAM 9.2 Notification Module user Guide.pdf" - specifically it is detailed in the section "Enumeration of keyword/value pairs".

Mark.

22 Posts

September 21st, 2018 06:00

thanks Ron, that certainly worked but a colleague pointed me in a different direction which for my solution is a little neater. Because I am using Notif to configure these SNMP notifications then within the Notif GUI I can perform a much similar activity to what you are doing in the ASL script.

so in the Notif GUI "Event Setup" TAB for the EventName I created this

EventName=CISCO-BGP4-PEER-STATE-$substr(OID1,24,40)$


many thanks for your help.

Mark.

5 Posts

September 24th, 2018 09:00

Excellent work around, happy to be of help

Ron Miller

Advisor, Enterprise Technical Services

No Events found!

Top