How to pass hostname to alarm title for a BGP trap

Document ID : KB000047968
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

Scenario: Customer has configured BGP traps on a device to alert Spectrum when the BGP peer session is down. They would like to have Hostname and Peer Router IP address in the event message to reflect as a part of alarm title in OneClick console.

This can be achieved using Dynamic Alarm Title with the help of Event Procedures.

Solution:

This solution details 2 procedures:

  1. How to extract hostname from the BGP trap to a new event message

  2. How to pass the peer router IP address and hostname from new event message to the alarm title

Procedure #1:

  1. Identify the event code for the BGP transition alarm from OneClick event configuration editor. Default event code is 0x220011

  2. The event message for this alert looks like

    "A bgpBackwardTransition trap has been received for this device. The peer router is {S 5}, the current state is {T bgpPeerState 3}, and the LastError is {O 1}"

    The event variable "5" here gives the value of the Interface IP address on which the link went down. This is not reflected in the alarm title. We are going to use "Dynamic Alarm Title" concept to forward this IP address to the alarm title.

    The event message also does not include the hostname event variable. So we need to:

    1. Pass the hostname attribute (0x1006e) to event message 0xfff00000

    2. Pass the hostname and interface IP address to alarm title of 0xfff00001

  3. Logon to OneClick Event Configuration Editor -> Remove the default critical alarm from the default BGP transition event i.e. 220011 event.

  4. Create two new events from the Event Configuration Editor. In this case assume the new event codes are 0xfff00000 and 0xfff00001. Map event 0xfff00001 to a "critical" alarm and set the severity of 0xfff00000 to "none".

  5. The text for the event message of 0xfff00000 event should look like:

    "A bgpBackwardTransition trap has been received for this device. The peer router is {S 5}, hostname is {S 7} the current state is {T bgpPeerState 3}, and the LastError is {O 1}"

  6. The event message for 0xfff00001 will be same as 0xfff00000 event.

  7. The event code for BGP established event is 0x00220010 . By default this will clear the default BGP transition alarm. As we removed the default alarm and asserted the same on the new event 0xfff00001, we need to reconfigure the BGP established event to clear the alarm for 0xfff00001 and remove the default mapping .

  8. Filter for the event 0x00220010 -> In the right panel at the bottom under cleared alarm list -> Remove the default BGP alarm and insert the new alarm 0xfff00001. Now the BGP Established Trap will clear the 0xfff00001 alarm.

  9. Save the new events and changes in the Event Configuration Editor. No need to update the event configuration on the VNM icon for these changes in the latest versions of Spectrum starting 9.2 H08. The changes are reflected automatically once they are saved in the Event Configuration Editor.

Procedure #2:

Now you need to write an event procedure which will copy the model name attribute from the device model and pass it to event variable 7 of 0xfff00000. Once this is done, the second event procedure will pull the event variables 5 and 7 from 0xfff00000 and append them to the alarm title of the new event 0xfff00001.

  1. Open the EventDisp file present in the $SPECROOT/custom directory on the SpectroSERVER and insert the code below into it.

    0x00220011 P" CreateEventWithAttributes({C CURRENT_MODEL },{H 0xfff00000},\
    SetEventAttribute(GetEventAttributeList(),{U 7},ReadAttribute({C CURRENT_MODEL },\
    {H 0x1006e})))"
    0xfff00000 E 50 P"CreateEventWithVariables({C CURRENT_MODEL},{H 0xfff00001},\
    SetEventVariable(GetEventVariableList(),{H 0x00012b4c},Append({S\"BGP ip and modelname is :\"},\
    Append(Append(Append({ S \"\" },GetEventVariable( { U 7})),{S \" : \" }),\
    GetEventVariable({U 5})))))"
    save the file.

  2. In the OC console -> VNM icon -> Component detail panel -> SpectroSERVER control tab -> Click on "Update event configuration". This will reflect the above changes in the EventDisp file onto the OneClick alarms console.

  3. Reload the events in OneClick.

Note: Check if the respective event/alarm files are created in OneClick and the Spectrum servers. Check for the events 0xfff00000 and 0xfff00001 on the models having the BGP traps. If you see a problem in event processing, add the debug for eventdisp in the .vnmrc file on SpectroSERVER, and check for exceptions in the VNM.OUT file.