TECHZEN Zenoss User Community ARCHIVE  

Inklude "Comments" from a device to email notification

Subject: Inklude "Comments" from a device to email notification
Author: Stig Wangdell
Posted: 2016-10-28 06:19

I have zenoss Core 4.2.5. I have manydevices thati have write "Comments" on. I what to include the "Comments" in the mail that says that a device is down.

Have can i do that.

Email:

Message: XXXXXXXX-01 is DOWN!
Time: 2016/10/27 08:48:18.000
Event class: /Status/Ping
Severity: 5

Device: XXXXXXXX-01
IP: 10.10.10.10.
Device class: /Network/Router/Cisco
Groups: None
Systems: None
Location: /House1
Collector: localhost
Component:

Regard

/Stig



Subject: Can you describe your
Author: Jane Curry
Posted: 2016-10-29 10:16

Can you describe your "comments" a bit more Are these individual comments for each event or do you add standard comments to particular event classes

Any field of an event can be included in a notification so, for example, if you want to include the standard Location field in an email, you would include it as ${evt/Location} - check the detail of an event to be sure you have the correct spelling and upper/lower case.

You can do this with your own user-created event fields in exactly the same way as the standard event fields. For example, you might have an event transform on an event class that includes a line like:

evt.myField1 = 'This is an example'

So, for notifications that have triggers that check that event Class, you could include ${evt/myField1}. You do need to be careful that your notifications using user-defined event fields are ONLY applied to notifications where that field does actually exist.

Cheers,

Jane

Email: jane.curry@skills-1st.co.uk    Web: https://www.skills-1st.co.uk



Subject: In our production,(network)
Author: Stig Wangdell
Posted: 2016-10-29 14:54

In our production,(network) we have manydevices from external companies. So we type in which external company to call and do when you get the alarm by e-mail. So you are absolutely right that there are different comments on all devices.



Subject: We have used the "comments"
Author: Stig Wangdell
Posted: 2016-10-29 15:02

We have used the "comments" field on 30-40 devices to write down important information.

The field is just under Location and Links when you enter in on the device in the admin gui.



Subject: So, if you have already added
Author: Jane Curry
Posted: 2016-11-02 06:10

So, if you have already added comments to a device in the Overview panel, then that is in the Zenoss object database (zodb). That means you can use it in an event transform and also in an email notification.

If you need access to the device's comments field for all device classes, create the transform at the top-level / Event. If you can restrict to a sub-device class then create the transform there - it's more efficient that way. So your transform might look like:

evt.comments = ''
if device.comments:
evt.comments = device.comments

Then you can simply use ${evt/comments} in an email notification like:

Device: ${evt/device}
Component: ${evt/component}
Severity: ${evt/severity}
Time: ${evt/lastTime}
Message:
${evt/message}
Comments: ${evt/comments}

Cheers,

Jane

Email: jane.curry@skills-1st.co.uk    Web: https://www.skills-1st.co.uk



Subject: Can you describe in more
Author: Stig Wangdell
Posted: 2016-11-02 17:06

Can you describe in more detail how to do. Have just started using Zenoss

Thanks Stig



Subject: Try grabbing my "Event
Author: Jane Curry
Posted: 2016-11-03 07:58

Try grabbing my "Event Management for Zenoss Core 4" paper at https://www.skills-1st.co.uk/papers/jane/zenoss4-events/zenoss_Core4_event_management_paper.pdf

It has some examples of transforms in section 7. The thing to remember is that you are basically writing Python so white space is important so in my little transform above the line with "evt.comments = device.comments" is indented. What I was suggesting above is a CLASS transform (not a mapping transform). You get to the class transform dialogue by selecting the appropriate class (EVENTS -> Event Classes, select the event) and then click on the little "gear" icon at the bottom-left - that should bring up a menu that includes "Transform".

I might suggest that you start by selecting one specific event class that generates testable events and add the transform to that; once you know it works and it feeds through into your Notification, then you could consider applying the transform higher up the event class hierarchy. You may want this at the root (/) level but if you get the transform wrong whilst testing then you could cause all sorts of trouble. Ideally test it all out in your test environment.

Section 10 of the paper gives some examples of Triggers and Notifications. You should be able to use the code I gave you earlier exactly as it is.

Cheers,

Jane

Email: jane.curry@skills-1st.co.uk    Web: https://www.skills-1st.co.uk



Subject: Thanks so much. It works
Author: Stig Wangdell
Posted: 2016-11-07 07:52

Thanks so much. It works

/Stig



< Previous
Lost access to Web interface
  Next
Change Zenoss Database location or Remote The Mysql Zenoss Database
>