Difference between revisions of "Transforms - Print Device Title in Event Notification"

From Zenoss Wiki
Jump to: navigation, search
(Category, formatting)
(Wrote initial content)
Line 1: Line 1:
One option would be to add a transform (likely at the root for events) that does something like this:
+
One option would be to add a transform (likely at the root for events) that does something like this:<br />
 
+
<pre>
<syntaxhighlight lang=python>
+
 
if device: evt.device = device.titleOrId()
 
if device: evt.device = device.titleOrId()
</syntaxhighlight>
+
</pre><br />
 
+
 
This will set evt.device to the devices title if one is present. You wouldn't need to change anything in the notifications as this would change the evt.device to be the title where title is set (if a title isn't set the title field is the device id which is what you are renaming when you select the "rename" option which is giving you troubles). To implement this go to Events > Event Classes and click on the action wheel (gear icon) at the bottom left and select Transform. Here at the line above and all of your events will prefer the device title where set.
 
This will set evt.device to the devices title if one is present. You wouldn't need to change anything in the notifications as this would change the evt.device to be the title where title is set (if a title isn't set the title field is the device id which is what you are renaming when you select the "rename" option which is giving you troubles). To implement this go to Events > Event Classes and click on the action wheel (gear icon) at the bottom left and select Transform. Here at the line above and all of your events will prefer the device title where set.
 
[[Category:Transforms]]
 

Revision as of 17:44, 4 September 2013

One option would be to add a transform (likely at the root for events) that does something like this:

if device: evt.device = device.titleOrId()

This will set evt.device to the devices title if one is present. You wouldn't need to change anything in the notifications as this would change the evt.device to be the title where title is set (if a title isn't set the title field is the device id which is what you are renaming when you select the "rename" option which is giving you troubles). To implement this go to Events > Event Classes and click on the action wheel (gear icon) at the bottom left and select Transform. Here at the line above and all of your events will prefer the device title where set.