TECHZEN Zenoss User Community ARCHIVE  

Need to obtain device uuid from TALES in event processing

Subject: Need to obtain device uuid from TALES in event processing
Author: [Not Specified]
Posted: 2014-12-08 14:23

Hello,

Any experts in processing events... I need to get the device uuid field from an event into a notification. It's in the response from the EventsRouter if i use the JSON API but I can't figure out how to get at it in the notification.

Here's a snippet of an event from the JSON EventsRouter:
'events' => [
{
'evid' => '0050569b-1307-8809-11e4-7f14c66ad1a4',
'device' =>
{
'uid' => '/zport/dmd/Devices/Server/Windows/devices/MOOSE',
'text' => 'MOOSE',
'url' => '/zport/dmd/gotoguid=61c6af8f-707f-4af4-95f1-67cf9c5c0045',
'uuid' => '61c6af8f-707f-4af4-95f1-67cf9c5c0045'
},
'message' => 'disk space threshold: 100.0% used (3.8MB free)',
'eventClass' =>
{
'uid' => '/zport/dmd/Events/Perf/Filesystem',
'text' => '/Perf/Filesystem'
},
},
]

What I want is {'events'}->{'device';}->{'uuid'}.

If i refer to $evt/device I get the text field ("MOOSE") or if I refer $evt/eventClass I get the text field for that too.

I tried "$evt/device/uuid" but that doesn't work.

Any ideas



Subject: My workaround.. a transform
Author: [Not Specified]
Posted: 2014-12-08 14:31

My workaround.. a transform which does this:

try:
zdev = dmd.Devices.findDevice(evt.device)
if zdev is not None:
evt.deviceuuid = zdev.getUUID()
except:
evt.deviceuuid = "Not found"

deviceuuid shows up as $evt/deviceuuid after that, but it seems like unnecessary extra code execution for every event.



Subject: (deleted comment)
Author: [Not Specified]
Posted: 2014-12-09 07:25

(deleted comment)



< Previous
Notifications - blank fields and group field
  Next
incorrect time in graphs
>