Configuration & Administration

Expand all | Collapse all

Help with event transform

  • 1.  Help with event transform

    Posted 10 days ago
    Hello,

    I am trying to write an event transform for the following situation:

    I have an SNMP trap that comes in, and when looking in the details, I see the following fields


    I would like to write an event transform that looks like the following

    if str (getattr(evt, "clogHistFacility.xxx"))=='LINK':
     evt.summary = "Interface state change-" + str (getattr(evt, "clogHistMsgText.xxx"))

    My problem is that the number at the end of the "clogHistFacility" and "clogHistMsgText" fields varies, so I need to be able to match a wildcard for the above transform like "clogHistFacility.*" and "clogHistMsgText.*". Each time the trap occurs, the number increments by one.

    This is for trying to alert on an SNMP trap for a link up/down on a Cisco switch

    How do I indicate/match the last xxx numeric part of the field in a transform? I don't know if I need to use regex somehow, or if there is a much easier way.

    Thanks for the help!

    ------------------------------
    anon anon
    anon
    TX
    ------------------------------


  • 2.  RE: Help with event transform

    Posted 10 days ago
    Hey, I got this working via the below transform

    for detail in evt.details._map.keys():
      if detail.startswith('clogHistFacility'):
    HistFacility = getattr(evt, detail)
      if detail.startswith('clogHistMsgText'):
    HistMsgText = getattr(evt, detail)

    if HistFacility=="LINK":
      evt.summary = "Interface state change-" + HistMsgText

    ------------------------------
    anon anon
    anon
    TX
    ------------------------------



  • 3.  RE: Help with event transform

    Posted 10 days ago
    Excellent! Sorry - saw your append this morning and then it got manic :(

    You might pull the Event Management paper that I wrote if you are looking for more examples in the future - https://www.skills-1st.co.uk/papers/jane/zenoss4-events/  .

    Cheers,
    Jane

    ------------------------------
    Jane Curry
    Skills 1st United Kingdom
    jane.curry@skills-1st.co.uk
    ------------------------------