Quantcast
Channel: Zenoss Community: Message List
Viewing all articles
Browse latest Browse all 1118

Re: Transform variable error

$
0
0

I do this kind of thing all the time.

 

First thing to note is that if you are using Zenoss Core4 your attributes have moved to 'evt.details'

 

try this.

 

evt.summary = getattr('evt.details', 'tg1000.2.1.2', '')

if you are still having trouble you can try some logging, dump all the event details as follows.

 

log.warn('EVT DETAILS %s', evt.details._map.keys())

 

Note with this we have to violate the Zenoss Event scema and peer into _map, this is because the event object no longer behaves like a dictinoary. A baffeling omission on the behalf of the developers.

 

If you are still having trouble, you can dump the entire event object and save it as a python pickle. We do this do save events for regression testing of event transforms.

 

from cPickle import dump

with open('/tmp/ev' + evt.evid, 'wb') as f:

    dump(evt, f, -1)

 

Another thing to watch out with core 4 is type, I have found that a lot of event details that were previously integers are now strings and I have to explicity convert them in the transform for my old code to work.

 

Im about to put together a how to convert event transforms from Zenoss 3 to Zenoss 4, as there are many changes under the hood that will stump you.  The absense of evt.keys() for example was almost a "show stopper" for me.

 

I hope this helps,

Rod.


Viewing all articles
Browse latest Browse all 1118

Trending Articles