Discussion:
How To Get Interface Descriptions In Notification Emails
Shane Ketterman
2013-07-14 21:39:42 UTC
Permalink
Shane Ketterman [http://community.zenoss.org/people/shaneketterman] created the discussion

"How To Get Interface Descriptions In Notification Emails"

To view the discussion, visit: http://community.zenoss.org/message/73961#73961

--------------------------------------------------------------
I want to be able to see interface descriptions in my email alerts and I did not see any reference to those in the /evt or /evt summary variables.  Is there another way to reference those and add them to the email template for notifications?  It's very useful to see since most of our interfaces have descriptions and on a router or switch with over 500 interfaces, knowing which one is having an issue is key.

Thanks!
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/73961#73961]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Shane Scott
2013-07-16 09:15:29 UTC
Permalink
Shane Scott [http://community.zenoss.org/people/hackman238] created the discussion

"Re: How To Get Interface Descriptions In Notification Emails"

To view the discussion, visit: http://community.zenoss.org/message/73992#73992

--------------------------------------------------------------
Shane,

You'll need to create a transform which acts on the events in question and adds the details you're looking for.
# Component Name
intId = evt.component
# No more iteration
f = component
# Validate interface and device really exist
    # Declares and imports only if the transform needs to execute
    currentUsage = 0
    strSpeed = ''
    intSpeed = 'Unknown'
    import re
    # Extract utilization from the summary and calculate a percent
    m = re.search('threshold of [^:]+: current value ([\d\.]+)', evt.message)
        currentUsage = (float(m.groups()[0])) * 8
        speed = f.speed
            p = (currentUsage / int(speed)) * 100
            p = 0
            usage = currentUsage / 1000000000
            strSpeed = 'Gbps'
               intSpeed = speed / 1000000000
            usage = currentUsage / 1000000
            strSpeed = 'Mbps'
               intSpeed = speed / 1000000
            usage = currentUsage / 1000
            strSpeed = 'Kbps'
               intSpeed = speed / 1000
            usage = currentUsage
            strSpeed = 'bps'
               intSpeed = speed
        # Build event
            evt.summary = 'Utilization on interface %s: Currently (%3.2f %s) or %3.2f%% is being used. Speed %s' %  (intId, usage, strSpeed, p, intSpeed)
            evt.summary = 'Utilization on interface %s: Currently (%3.2f %s) is being used. Speed %s' %  (intId, usage, strSpeed, intSpeed)
        # m didnt match, so flag the event for investigation
        evt.summary = evt.summary + ' - Could not match in transform. Investigate.'
    evt.message = evt.summary
# Drop the event sicne the component or device doesn't exist in reality
    evt._action = 'drop'
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/73992#73992]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Shane Ketterman
2013-07-16 15:04:47 UTC
Permalink
Shane Ketterman [http://community.zenoss.org/people/shaneketterman] created the discussion

"Re: How To Get Interface Descriptions In Notification Emails"

To view the discussion, visit: http://community.zenoss.org/message/73982#73982

--------------------------------------------------------------
Shane,

Thank you.  So for something as simple as the description of an interface (if there is one) would I need to create a transform?  I thought that it would be something I could just reference in the email template and it would pull it from the event and then display the interface description if there was one and if it didn't have one then it would be blank

Not all interfaces have descriptions (they should) but for those that do, it would be great to see it and I can't imagine there isn't something like interface.description or something to reference?
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/73982#73982]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Shane Ketterman
2013-07-18 00:43:10 UTC
Permalink
Shane Ketterman [http://community.zenoss.org/people/shaneketterman] created the discussion

"Re: How To Get Interface Descriptions In Notification Emails"

To view the discussion, visit: http://community.zenoss.org/message/74029#74029

--------------------------------------------------------------
Hi James!

Thank you much.  So it sounds like tranforms are the way to go and yes we definitely want it in the WebUI, however we rely on emails far far more than the WebUI. 

Any recommendations on a good and easy tuturial on some transforms?
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/74029#74029]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
jmp242
2013-07-18 12:16:59 UTC
Permalink
jmp242 [http://community.zenoss.org/people/jmp242] created the discussion

"Re: How To Get Interface Descriptions In Notification Emails"

To view the discussion, visit: http://community.zenoss.org/message/74041#74041

--------------------------------------------------------------
Beyond the admin guide, there are some older examples here:
http://community.zenoss.org/docs/DOC-2554 http://community.zenoss.org/docs/DOC-2554

That said, transforms are python, so there isn't really a special guide to them...

--
James Pulver
ZCA Member
CLASSE Computer Group
Cornell University
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/74041#74041]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Shane Ketterman
2013-07-18 14:49:52 UTC
Permalink
Shane Ketterman [http://community.zenoss.org/people/shaneketterman] created the discussion

"Re: How To Get Interface Descriptions In Notification Emails"

To view the discussion, visit: http://community.zenoss.org/message/74048#74048

--------------------------------------------------------------
Thanks much James!
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/74048#74048]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Loading...