I'm trying to customize the e-mail notifications sent out by Zenoss Core 3.0.3. Here's what I have so far.
<a href="%(eventUrl)s">Event Detail</a>
<a href="%(eventsUrl)s">Device Events</a>
This works great for most devices, however any devices that are not registered in DNS only show the IP address in the notfication. For example I have a device named BURL-SERVER-UPS. IP address 192.168.17.98
When the up/down notification gets sent, it gives a notification saying:
192.168.17.98 ip 192.168.17.98 is up
What field can I use so that the notification shows the Device Name rather than the IP?
I think you're doing it right, but I believe there's an inconsistancy underneath your data that is coming into play here. Did your devices detect with the IP and then you renamed them? Assuming yes, did you just type in the "in the details screen?
If you said yes to both, then try this: Go to your device screen and hit the actions menu (lower left), rename device. Now check your notification.
I don't know why there is the difference between the two rename methods, but it is there. Notice in the URL for the device that the deep down data files never change.
If all you want is the name of the device to show in the "Device" column for the event, you don't need to rename the device.
Just put the device name in the "Device Name:" field on the Overview page for the device. The name will then show up in the Device
column in Event Console and can be referenced in an alert message by using %(device)s.
If you don't populate the "Device Name:" field, the device id (ip address) will be used instead.
I already have the device name populated in the "Device Name" field, however the notifications are still coming through with the IP Address rather than the name. If it helps, this device was originally added to Zenoss using its IP address and not a host name, and the issue seems to be happening with all devices that I have added using the IP address rather than a host name. See below:
I added all my devices using the IP as well and then edited the device name field to a friendly name and didnt have the problem your having.
I wonder if the space in the name is causing a problem. Can you remove the space and see if it helps?
Just tried it out, something still isn't right with this. I renamed the device and took out the space. To test I changed the IP address to 184.108.40.206.
When I got the alert, it now comes in as (note I put an x in the last 2 octets for security reasons):
65.248.x.x ip 220.127.116.11 is down
So it's still keeping the original IP address from when it was added as the device name. I'm wondering if I should just remove the devices in question, create a manual DNS entry for each device, and then let Zenoss re-add the device, and then remove the DNS entries?
I had another go after reading this post and I clicked on the clog icon, renamed the deviced, remodelled it and it's now reporting the name rather than IP address...
I'm using Zenoss 4.2 and monitoring AWS instances. All of my devices got imported automatically when I plugged in my AWS credentials to the EC2Manager plugin. However, it made their device id something like this -
But their device titles were populated like this: ec2-167-21-180-175.compute-1.amazonaws.com.
All fine and good, except for the fact that the email notifications use %(device) and that references the Device ID, and not the device title. This is not helpful when I get an alert. I am able to rename the device with the Rename Device menu option in the lower left (by clicking the gear under Overview left hand pane for the device.). This changes the Device ID and then the alert has the name I want. But this seems to break the automatic linking between imported EC2 instances and their respective device objects. I really like that feature, and I'd be fine if I could just tell the email notifications to use something like %(deviceTitle) instead of the device ID. It seems silly that this isn't a notification variable. Also 'device group' should be a notification variable. Device ID's should be able to be left alone, and the more meaningful, easily modified, and human readable 'Device Title' is what I want to see in my notifications.
Zenoss - please add one more little notification variable, pretty please!
Thanks Shane. So I'm looking at the block of code that starts on line 76 in /opt/zenoss/Products/ZenModel/actions.py and I'm not really seeing anything that looks related directly to my issue. I'm on version 4.2.0 and this is what I see:
def _signalToContextDict(signal, zopeurl, notification=None, guidManager=None): summary = signal.event # build basic event context wrapper for notifications if signal.clear: # aged and closed events have clear == True, but they don't have an associated clear event # spoof a clear event in those cases, so the notification messages contain useful info if summary.status == zep_pb2.STATUS_AGED: occur = signal.clear_event.occurrence.add() occur.summary = "Event aging task aged out the event." summary.cleared_by_event_uuid = "Event aging task" elif summary.status == zep_pb2.STATUS_CLOSED: occur = signal.clear_event.occurrence.add() occur.summary = "User '" + summary.current_user_name + "' closed the event in the Zenoss event console." summary.cleared_by_event_uuid = "User action" data = NotificationEventContextWrapper(summary, signal.clear_event) else: data = NotificationEventContextWrapper(summary)
I hate be overly needy, but can you give me another hint or 2 as to what exactly I'm looking to do here? Really appreciate it...
ps - whole file is attached
My mistsake, I was looking at v4.1. For v4.2 it's around line 96.
You will see where the other variables are defined in this area.
--Shane Scott (Hackman238)
Follow Us On Twitter »
||Latest from the Zenoss Blog »||Community||Products||Services||Customers||About Us|
Copyright © 2005-2011 Zenoss, Inc.