Per another forum post, someone discovered a way to display the Device Title in the email template as opposed to the Device ID which is something that should be really really simple and an option. I used this:
d=dmd.Devices.findDevice(evt.device)
if d is not None:
evt.device_title=d.title
And then you can change the email template to:
Device: ${evt/device_title}
That works for some devices and only some of the time but mostly when I implement this, I get no alert notifications and the following error in zenactiond.log:
2013-07-17 20:00:38,882 ERROR zen.actions: Error when processing tales expression string:[zenoss] ${evt/device_title} ${evt/summary} on context {'evt': <Products.ZenModel.NotificationSubscription.NotificationEventSummaryProxy object at 0x76433d0>, 'trigger': {'name': 'Critical Events'}, 'urls': {'ackUrl': u'http://zenoss:8080/zport/dmd/Events/manage_ackEvents?evids=00212845-0b02-8fc0-11e2-ef56394dec52&zenScreenName=viewEvents', 'reopenUrl': u'http://zenoss:8080/zport/dmd/Events/manage_undeleteEvents?evids=00212845-0b02-8fc0-11e2-ef56394dec52&zenScreenName=viewEvents', 'eventUrl': u'http://zenoss:8080/zport/dmd/Events/viewDetail?evid=00212845-0b02-8fc0-11e2-ef56394dec52', 'baseUrl': 'http://zenoss:8080', 'closeUrl': u'http://zenoss:8080/zport/dmd/Events/manage_deleteEvents?evids=00212845-0b02-8fc0-11e2-ef56394dec52&zenScreenName=viewHistoryEvents', 'deviceUrl': u'http://zenoss:8080/zport/dmd/DevicesNone/devices/10.209.0.12/devicedetail', 'eventsUrl': 'http://zenoss:8080/zport/dmd/viewEvents'}, 'clearEvt': {}, 'notification': {'name': 'Critical_Email_Alerts'}, 'clearEventSummary': {}, 'eventSummary': <zenoss.protocols.wrappers.EventSummaryAdapter object at 0x766a890>} : Exception Class <class 'zope.location.interfaces.LocationError'>
Message: (<Products.ZenModel.NotificationSubscription.NotificationEventSummaryProxy object at 0x76433d0>, 'device_title')
2013-07-17 20:00:38,882 ERROR zen.actions: Error executing action Critical_Email_Alerts on set(['toc@bendbroadband.net'])
2013-07-17 20:00:38,887 ERROR zen.zenactiond: Error executing action: email on notification Critical_Email_Alerts
2013-07-17 20:00:38,888 INFO zen.zenactiond: Event:'10.209.0.12||/Unknown|5|Test Alert' Trigger:critical Action:email Status:FAIL Target:toc@bendbroadband.net Info:Failed Email for notification Critical_Email_Alerts on targets toc@bendbr
I'm totally confused how this works for some alerts but not others and why.