I think mwcotton is correct in that the _details attribute has not been created 
at the point of transformation.

However, I believe you could use the getattr function as follows:

Code:
evt.summary = getattr(evt, 'enterprises.19444.6.2.1.1.23', '')



Note that the second parameter is the name of an evt attribute or the first 
value in one of the _details elements. The third parameter is optional but 
provides a default value if the second parameter is not found. The third value 
is made up of two single quotes, not a double quote.

The way I understand zentrap event attributes is as follows. If you open to the 
details tab of a trap event, you will see a list of Fields and Values. I 
believe that during the mapping process, each field in the list is assigned as 
an attribute to the evt object. Attributes with simple names can be accessed 
with the syntax evt.<attributeName>. However, when attributes have names like 
the one above (invalid Python object attribute names), they must be accessed by 
the getattr function.

The value returned is normally a string. However, in your case, you have some 
values listed in _details that are tuples as in the case of the field named 
'enterprises.19444.6.2.1.1.10' - I think the value returned would be a tuple: 
(1, 2, 826, 0, 1, 1578918, 6, 2, 1, 2, 40, 213, 16, 1, 698622552). In this case 
you could probably access the sixth value (1578918) by using:

Code:
x = getattr(evt, 'enterprises.19444.6.2.1.1.10', '')
if x:
   val = x[5]







-------------------- m2f --------------------

Read this topic online here:
http://forums.zenoss.com/viewtopic.php?p=35855#35855

-------------------- m2f --------------------



_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to