Discussion:
Transform doesn't work on DeviceGroups field
szogu
2013-12-04 08:43:23 UTC
Permalink
szogu [http://community.zenoss.org/people/szogu] created the discussion

"Transform doesn't work on DeviceGroups field"

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

--------------------------------------------------------------
Hi,
I receive events from my python script using zensendevent and try to use transform to add DeviceGroups field but it doesn't work.

My transform is simple:

if evt.eventClassMapping.find("StatystykiViaSyslog") != -1:
   evt.DeviceGroups = "BM"

If i set:

if evt.eventClassMapping.find("StatystykiViaSyslog") != -1:
   evt.summary = "BM"

it works fine.

Someone could tell me why I cannot set DeviceGroups field?

Regards,
Tommy
--------------------------------------------------------------

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

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Rob Eagle
2013-12-04 13:13:19 UTC
Permalink
Rob Eagle [http://community.zenoss.org/people/reagle] created the discussion

"Re: Transform doesn't work on DeviceGroups field"

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

--------------------------------------------------------------
Tommy,
Not sure DeviceGroups is something that you can set like you do summary for an event.  A device group is a structure that the device sits in.  This would be the same problem you would have if you tried to set the device class.  In theory you are trying to move a device to a Device Group that might or might not exist in the system.

What are you trying to accomplish, there might be a better way?
--Rob
--------------------------------------------------------------

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

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Rob Eagle
2013-12-04 13:17:24 UTC
Permalink
Rob Eagle [http://community.zenoss.org/people/reagle] created the discussion

"Re: Transform doesn't work on DeviceGroups field"

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

--------------------------------------------------------------
Well, right after i sent that reply, I came across this discussion.  Seems if you want to actually join a device to a group in a transform, it is definately an option:

http://community.zenoss.org/message/42609#42609#42609 http://community.zenoss.org/message/42609#42609

--Rob
--------------------------------------------------------------

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

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
szogu
2013-12-04 14:15:10 UTC
Permalink
szogu [http://community.zenoss.org/people/szogu] created the discussion

"Re: Transform doesn't work on DeviceGroups field"

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

--------------------------------------------------------------
Rob,
Thanks for the reply. I don't know if you understand me as well as I would like. My english is a little poor (google translator is my friend ;) )

This is only an example:
if evt.eventClassMapping.find("StatystykiViaSyslog") != -1:
   evt.summary = "BM"

but it work. So the condition is met.

I send events from linux shell using '/opt/zenoss/bin/zensendevent' command and I receive them in the Zenoss console. But I need to set a field named 'DeviceGroups' field in the 'Device State' part. I'm trying to do it by transform. The group "BM" exist, I have some devices in this group. Why I need to do it? Because I have some users which are monitoring the events of its devices. These users have permissions to see the 'BM' group only.

Regards,
Tommy
--------------------------------------------------------------

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

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Rob Eagle
2013-12-04 16:05:08 UTC
Permalink
Rob Eagle [http://community.zenoss.org/people/reagle] created the discussion

"Re: Transform doesn't work on DeviceGroups field"

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

--------------------------------------------------------------
Tommy,
Cannot get the evt.DeviceGroups updated in the event itself (keep getting 'AttributeError: can't set attribute'), the best I could come up with is updated the actual group of the device but the groups will not show up in the event.

from transaction import commit
if "/BM" not in device.getDeviceGroupNames():
    grplist = device.getDeviceGroupNames()
    grplist.append('/BM')
    device.setGroups(grplist)
    commit()

Now not sure how the security works, but would give this a shot to see if it allows users to see the events.
--Rob
--------------------------------------------------------------

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

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Loading...