Discussion:
Event transform failure when attr does not exist.
guyverix
2011-12-07 18:05:06 UTC
Permalink
guyverix [http://community.zenoss.org/people/guyverix] created the discussion

"Event transform failure when attr does not exist."

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

--------------------------------------------------------------
I have been attempting to do some more advanced transofrms and running into a few issues..

In the transform I get this error message:
AttributeError: Event instance has no attribute '1.3.6.1.4.1.111.15.1.1.1.2.1'

However my transform has this:
if hasattr(evt, '1.3.6.1.4.1.111.15.1.1.1.2.1'):
  evt.eventClassKey = str(getattr(evt, '1.3.6.1.4.1.111.15.1.1.1.2.1'))
else:
  evt.eventClassKey = 'Oracle'

Did I miss something in the transform when the OID itself does not exist, or is my bug elsewhere?
--------------------------------------------------------------

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

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]
jcurry
2011-12-08 11:40:11 UTC
Permalink
jcurry [http://community.zenoss.org/people/jcurry] created the discussion

"Re: Event transform failure when attr does not exist."

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

--------------------------------------------------------------
I would have thought that this would work as you are explicitly checking whether the attribute exists with the hasattr() statement.  This should return a true/false.  Given the error, one has to assume that it returns a true value and then tries to execute the getattr.  Did you cut and paste your transform to here???  I can't see any typos / spaces / extra dots /  but it looks like it should be that sort of gotcha....

In desperation, you might try the Python try / except syntax in your true leg to help debug further.....

Cheers,
Jane
--------------------------------------------------------------

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

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