Archived community.zenoss.org | full text search
Skip navigation
1351 Views 2 Replies Latest reply: Dec 7, 2011 10:19 AM by Chet Luther RSS
gcollis1 Newbie 5 posts since
Apr 15, 2009
Currently Being Moderated

Dec 4, 2011 6:26 AM

match multiple attributes within trap

Hi,

 

How can I match multiple attributes within a trap? I have a trap that gets generated and I want to transform this trap only if text within two different oids is matched:

 

I can get this working on one match, but not two:

 

e.g. somthing like

 

import re

 

match = getattr(evt, "--OID1 from event Details--") and match = getattr(evt, "--OID2 from event Details--")
if match and device:

 


  • Chet Luther ZenossEmployee 1,302 posts since
    May 22, 2007
    Currently Being Moderated
    2. Dec 7, 2011 10:19 AM (in response to gcollis1)
    Re: match multiple attributes within trap

    You can do it either in the mapping's rule field, or in the transform field like you appear to be doing. The rule field would be the place to do it if you didn't even want you mapping to match the event unless the two varbinds existed. The transform field happens after the mapping has matched an event.

     

    Rule:

    hasattr(evt, 'OID1') and hasattr(evt, 'OID2')

     

    Transform:

    oid1 = getattr(evt, 'OID1', None)

    oid2 = getattr(evt, 'OID2', None)

     

    if oid1 and oid2 and device:

        do_something

More Like This

  • Retrieving data ...

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 2 points