Discussion:
Is There A Way to show "Device Title" In Email Notifications?
Shane Ketterman
2013-07-03 19:46:05 UTC
Permalink
Shane Ketterman [http://community.zenoss.org/people/shaneketterman] created the discussion

"Is There A Way to show "Device Title" In Email Notifications?"

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

--------------------------------------------------------------
The device title field is something we really like because it can be used to give a friendly description of a device.  When we get alerts in email the default is to show the device ID and we want it to instead show us the Device Title.  I see that you can modify the email template, but what is the syntax for showing the device title?

Thanks in advance for the help!
--------------------------------------------------------------

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

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-04 03:58:09 UTC
Permalink
Shane Ketterman [http://community.zenoss.org/people/shaneketterman] created the discussion

"Re: Is There A Way to show "Device Title" In Email Notifications?"

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

--------------------------------------------------------------
I actually got this to work!  I used the following:

d = dmd.Devices.findDevice(evt.device)
if d is not None:
  evt.device_title = d.title

which is something I found by reading some other discussions....just remember to indent the 3rd line as I didn't at first and when I viewed the log I saw the error of my ways ;)
--------------------------------------------------------------

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

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
jeronimo
2013-10-11 21:14:22 UTC
Permalink
jeronimo [http://community.zenoss.org/people/jeronimo] created the discussion

"Re: Is There A Way to show "Device Title" In Email Notifications?"

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

--------------------------------------------------------------
You no doubt saw my other post, but just putting this here for completeness if someone else comes along.

Better answer is to use:

evt.device_title = device.titleOrId()

This works for 4.x.  You only need to use findDevice for earlier versions (thanks rmatte).

The reason why you shouldn't just use device.title is that if title = '', the device_title attribute will be dropped rather than be set to '' in the resulting event.  It drops all blank attributes.  And don't go by the GUI showing something in the title box, as it will fill it in with the ID if it's not set.
--------------------------------------------------------------

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

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...