Discussion:
How to use Device Title instead of Device ID in email notifications?
Jeremy Koerber
2012-08-17 15:14:54 UTC
Permalink
Jeremy Koerber [http://community.zenoss.org/people/jeremykoerber] created the discussion

"How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
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 -
| %1,3% Device ID: |
| %1,3% aws-i-252dsf5e |

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

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Shane Scott
2012-08-18 09:15:18 UTC
Permalink
Shane Scott [http://community.zenoss.org/people/hackman238] created the discussion

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
Jeremy:

You'll need to patch $ZENHOME/ZenModel/actions.py ~line 76 to add deviceTitle to the action context.

Good luck!

Best,
--Shane Scott (Hackman238)
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Luis Oliveira
2012-08-27 16:23:08 UTC
Permalink
Luis Oliveira [http://community.zenoss.org/people/kulamusic] created the discussion

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
Jeremy, did you tested this tip of Shane? It worked ? I have the same problem. :(

regards
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Jeremy Koerber
2012-08-27 16:33:21 UTC
Permalink
Jeremy Koerber [http://community.zenoss.org/people/jeremykoerber] created the discussion

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
No, it didn't work. I ended up filing a bug with Zenoss. What version of Zenoss and what OS/version are you running?
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Luis Oliveira
2012-08-27 16:42:14 UTC
Permalink
Luis Oliveira [http://community.zenoss.org/people/kulamusic] created the discussion

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
Damm :( , i really need the name in the subject otherwise only with ip it's weird.



| Zenoss (http://www.zenoss.com/) | Zenoss 4.2.0 |
| OS (http://www.tldp.org/) | Linux (x86_64) 2.6.32 (Linux tkppts03 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 x86_64) |

post here please the workaround if they answer to the bug.

regards.
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Shane Scott
2012-08-27 17:25:49 UTC
Permalink
Shane Scott [http://community.zenoss.org/people/hackman238] created the discussion

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
Luis:

This is a regression in the newer code.

Best,
--Shane Scott (Hackman238)
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Jeremy Koerber
2012-08-27 17:26:20 UTC
Permalink
Jeremy Koerber [http://community.zenoss.org/people/jeremykoerber] created the discussion

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
Looks like you'r running RHEL/CentOS 6, as am I. If you read through the rest of this thread you'll see that version 4.2.0 works on CentOS 5 for sending device titles, at least for one other user, Shane Scott. Your other option is to use the Rename Device option for each device to modify the Device ID. If you drill down to a device, you'll see that option in the little gear menu in the lower left. That's what I'm doing, although I plan to set up 4.2.0 on centos5 pretty soon and see if that works for me. Then they'll probably release a fix for centos6 right afterwards.. :)
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Luis Oliveira
2012-08-28 09:36:18 UTC
Permalink
Luis Oliveira [http://community.zenoss.org/people/kulamusic] created the discussion

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
Ok thanks for the feedback Jeremy, i will wait for that fix, but the workaround you give works very fine for what i want, i already rename all, thank you very much.

they respond that because of the ticket you put in Jira? Because i guess i found another bug :( but this time in the ssh linux monitoring template.

kind regards
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
digitlman
2012-08-28 13:17:34 UTC
Permalink
digitlman [http://community.zenoss.org/people/digitlman] created the discussion

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
I'm looking forward to this fix as well.
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Jeremy Koerber
2012-08-28 20:42:30 UTC
Permalink
Jeremy Koerber [http://community.zenoss.org/people/jeremykoerber] created the discussion

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
I just got an update from Zenoss Jira that says my bug that I filed on this was set to 'backlog'. I asked for a rough ETA on a fix. I'll post here if I hear anything back.
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
dpetzel
2012-08-29 03:51:19 UTC
Permalink
dpetzel [http://community.zenoss.org/people/dpetzel] created the discussion

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
Jeremy, sorry for the delayed response, finally got in front of a Core 4 install. As you've already worked I think this is a regression bug. I've added my .02 to your existing bug, so Zenoss is aware that its affecting more than just one person.

Aside from your workaround of renaming the device, I was able to come up with an another workaround using an event transform. Its a HACK IMHO, but it can work in light of renaming every device.
d = dmd.Devices.findDevice(evt.device)
  evt.device_title = d.title
This will set a custom attribute on the event object called device_title. From there you can use *${evt/device_title}* in your email notification content.

I tested this on my test system here and it seemed to do the trick.
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Jeremy Koerber
2012-08-30 01:16:13 UTC
Permalink
Jeremy Koerber [http://community.zenoss.org/people/jeremykoerber] created the discussion

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
dpetzel,
Thanks for that! I'm trying to configure it now. I think I'm in the right place, but would you mind posting a screenshot or 2 where that transform should go? I'm in Events > Event Classes and I created an EventClass Mapping, but I'm not sure it's in the right place (at the top of the event class tree as you specified). Thanks much for your help.

Jeremy
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
dpetzel
2012-08-30 01:21:45 UTC
Permalink
dpetzel [http://community.zenoss.org/people/dpetzel] created the discussion

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
Jeremy, no problem, see attached. The numbers represent the order you should click to get to the proper spot
#5 is where you should paste this code.
Loading Image... Loading Image...
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Jeremy Koerber
2012-08-30 01:47:56 UTC
Permalink
Jeremy Koerber [http://community.zenoss.org/people/jeremykoerber] created the discussion

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
Looks like that is doing the trick! Thanks! Now to see if I can model the ec2manager and let it import all 200 some odd instances..
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Great Beach
2012-09-10 23:18:11 UTC
Permalink
Great Beach [http://community.zenoss.org/people/beach] created the discussion

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
Thank you dpetzel - this fixed my issue.  I was at the point of reverting back to Zenoss 3.x because of this issue. 
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
digitlman
2012-08-30 11:27:22 UTC
Permalink
digitlman [http://community.zenoss.org/people/digitlman] created the discussion

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
I suggest hand-typing the transform instad of copying and pasting from this forum as to remove any extra characters that may stop it from working (like it did for me).
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Jeremy Koerber
2012-09-11 01:01:27 UTC
Permalink
Jeremy Koerber [http://community.zenoss.org/people/jeremykoerber] created the discussion

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
I know this should probably be mentioned under a separat topic, but I figured I'd also mention it here since it is somewhat related... Not only are there issues using device title in email notifications, but has anyone noticed that when you use the search box in the upper right, it only returns device ID's in the results? This isn't very helpful.. It seems like it should either be configurable to show you a variety fo fields, or default to device title. I've named all my devices with meaningful titles, I'm using those in email notifications (thanks to dpetzel's transform), but my searches look like this:
Loading Image... Loading Image...
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
dpetzel
2012-09-11 01:56:06 UTC
Permalink
dpetzel [http://community.zenoss.org/people/dpetzel] created the discussion

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
Jeremy, I'd start a seperate thread about this, and I'm willing to bet we can get hackman to answer this one pretty quick since I believe he wrote that search component. I took a really quick peek at https://github.com/zenoss/ZenPacks.ShaneScott.DeviceSearch/blob/master/ZenPacks/ShaneScott/DeviceSearch/__init__.py#L30 https://github.com/zenoss/ZenPacks.ShaneScott.DeviceSearch/blob/master/ZenPacks/ShaneScott/DeviceSearch/__init__.py#L30
and it appears it will be a trivial code updat to support device title (but again hackman is the expert here)
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Shane Scott
2012-09-11 15:06:02 UTC
Permalink
Shane Scott [http://community.zenoss.org/people/hackman238] created the discussion

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
Jeremy:

My pack will do what you need. Change line 30 to

return super(DeviceWrapper, self).searchKeywords() + (device.title)

Best,
--Shane Scott (Hackman238)
--------------------------------------------------------------

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

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

"Re: How to use Device Title instead of Device ID in email notifications?"

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

--------------------------------------------------------------
An old thread, but just to save someone else some time:

You might want to use evt.device_title = device.titleOrId() instead of the suggested code.

Otherwise, if you just use evt.device_title = device.title and device.title is an empty string, evt.device_title will not get set to anything and will not exist.  It will just ignore that you set it to an empty string.  And then if you use that in your notifications, it'll break on those devices.
--------------------------------------------------------------

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

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