Archived community.zenoss.org | full text search
Skip navigation
22251 Views 12 Replies Latest reply: May 18, 2010 10:16 AM by terrys RSS
terrys Rank: White Belt 62 posts since
Nov 27, 2009
Currently Being Moderated

May 13, 2010 2:37 PM

Adding interface description to an event

I've tried two mechanisms that are described in the forum for adding an interface description to an event summary and am not getting anything to work.  The two things I've tried are from the Event Transforms and Examples blog (docs/DOC-2554).

 

What I get now is below and contains a bunch of redundant  information:

Router001  GigabitEthernet0/1  /Net/Link    Interface  GigabitEthernet0/1, changed state to down

 

What I'd like is to have interface down events display  something like this:

Router001  GigabitEthernet0/1  /Net/Link     DOWN: Link to Router002 Gig0/2

 

The first thing I tried was the section titled "Modify event down to specify which interface is down".  It runs, but the resulting event says "No description", which is the text I used to denote that an interface had no description.  I print the Index value and it is zero, which it shouldn't be for the interface in question.

 

The second thing I tried was in the section titled "Event Mapping based on Interface Description".  It turns red when I enter it into the Transform section of editing a class, so I'm guessing that something has changed since this transform was first built.

 

Can I print things from within a Transform and see the output somewhere?  Jane's paper on transforms says to look at zenaction.log, but it doesn't contain anything useful when debug is enabled.

 

Thanks!

  • jalapeno Rank: White Belt 5 posts since
    Oct 6, 2009
    Currently Being Moderated
    1. May 13, 2010 3:51 PM (in response to terrys)
    Re: Adding interface description to an event

    When the Transform section turns red if means there is an error with the text/code in there.  It needs to be Python I believe (i'm still learning).  I have a working transform as follows that may help some.

    evt.summary = 'LINK DOWN - Module: %s Port: %s to %s' % (evt.mcModulInx, evt.mcPortPortInx, evt.mcPortPortDesc)

    which transforms like 'LINK DOWN - Module: 4 Port 2 to SwitchWhatever'

     

    evt.xxxx are values pulled from the Trap, which will be a bunch of numbers if the Mibs are not installed for that device. So the above evt.xxx will not be the same for your device.  These should work evt.device for the device name and evt.ifDescr may be description but thats a guess.  I am sure that there are other programmatic statements you could use in the transform area but I am not that savy yet.

  • jalapeno Rank: White Belt 5 posts since
    Oct 6, 2009
    Currently Being Moderated
    5. May 17, 2010 8:24 AM (in response to terrys)
    Re: Adding interface description to an event

    try evt.device it should give you the device the event is linked to

  • jalapeno Rank: White Belt 5 posts since
    Oct 6, 2009
    Currently Being Moderated
    7. May 17, 2010 10:43 AM (in response to terrys)
    Re: Adding interface description to an event

    here is something I found that looks through the interfaces to match an index.  Maybe it will work if you replace ifindex with interfaceName or description.

     

    for obj in device.os.interfaces.objectItems():

        if obj[1].ifindex == index:

           blah blah...

  • jalapeno Rank: White Belt 5 posts since
    Oct 6, 2009
    Currently Being Moderated
    10. May 17, 2010 4:05 PM (in response to terrys)
    Re: Adding interface description to an event

    Though I have not tested it.  I had thought that using 'device' in an event transform always refered to the device in which the event was linked so you would not have to search for the device itself in the transform.  If it is just a string and you are unable to use device.whatever it is certainly an inconvience.  Wish I was more familier with the code to tell, but I would just take out the dev=device.findDevice statement and see if that works.  If not there must be some other magic statement we have not found.

More Like This

  • Retrieving data ...

Legend

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