TECHZEN Zenoss User Community ARCHIVE  

Event Notifications - modifying email text

Subject: Event Notifications - modifying email text
Author: Mark H
Posted: 2014-02-12 08:52

I'd like to tweak the email content when an Event Trigger is activated.
Here's what I have now:

Device: ${eventSummary/actor/element_title}
Component: ${evt/component}
Severity: ${evt/severity}
Time: ${evt/lastTime}
Message: ${evt/message}


To start with, I'd like to modify the Severity section. At the moment ${evt/severity} brings back a number between 1 and 6. I'd prefer it to show a descriptive word instead, i.e. INFO, WARN, ERR, etc. Is there a $ parameter that I could use for that. With that in mind, is there a definitive list of all these $ parameters anyway Thanks

P.S. I cannot use the formatting on these appalling new forums! How on earth this was allowed to go live I'll never understand. Carriage Returns, code entry, none of it works




Subject: Hi,
Author: Andrew Kirch
Posted: 2014-02-18 15:14

Hi,

In the Core Admin guide take a look at page 191 for a list of evt/ variables you can use.

If you're having trouble with formatting or pasting try "Basic HTML" if you need a tag it's missing please request it in the Administration forum and we'll look at adding it.

Andrew Kirch

akirch@gvit.com

Need Zenoss support, consulting or custom development Look no further. Email or PM me!

Ready for Distributed Topology (collectors) for Zenoss 5 Coming May 1st from GoVanguard



Subject: OK, thanks. I've played with
Author: Mark H
Posted: 2014-02-21 08:20

OK, thanks. I've played with lots of different 'evt' and 'eventSummary' settings and none of them give me a word instead of a number for event severity. Can anyone else help me with this please
Thanks




Subject: You have to be creative and
Author: [Not Specified]
Posted: 2014-02-21 12:36

You have to be creative and do some research, I found the answer in 5 minutes.

Use the instructions from here:
http://community.zenoss.org/message/68226#68226 (dpetzel's Helpful Answer)

With this transform as an example:
#Severity Conversion
if getattr(evt, 'severity', 5):
evt.severity_title = 'Critical'

Modify your notification to include the new variable:
Severity: ${evt/severity_title}

I even tested it for you :) I received a critical alert and it said this:
Severity: Critical

I might write up a wiki entry on this!

Hydruid



Subject: Thanks
Author: Mark H
Posted: 2014-03-04 09:07

I had found that post you've linked to but because I don't know Python I couldn't move forward.
This is great, but can you help me a little bit more by showing me how to do 'else' commands e.g.

if getattr(evt, 'severity', 5):
evt.severity_title = 'Critical'; else
if getattr(evt, 'severity', 1):
evt.severity_title = 'Debug'; else

etc, etc......




Subject: Your formatting is wrong and
Author: [Not Specified]
Posted: 2014-03-04 10:31

Your formatting is wrong and you don't need the "; else" in there, take a look at my blog post:

http://hydruid-blog.com/p=772

Hydruid



Subject: Fantastic
Author: Mark H
Posted: 2014-03-11 08:31

Thanks very much Hydruid :)




Subject: You're very welcome!
Author: [Not Specified]
Posted: 2014-03-11 10:54

You're very welcome!

Hydruid



< Previous
How to monitor Windows Services by device class
  Next
survey of zenoss for useful OSS monitoring tool
>