Discussion:
Put devices in location with zendmd
floyn
2013-05-07 09:57:22 UTC
Permalink
floyn [http://community.zenoss.org/people/floyn] created the discussion

"Put devices in location with zendmd"

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

--------------------------------------------------------------
Hello,

I have create a python script which add devices and locations with reading a file. I don't success to add devices in locations with the program, I tried this but I have no success :


if tab[1] and tab[2]:
                loc=dmd.getDmdRoot("Locations").createOrganizer(tab[1])
                loc.setAddress(tab[2])
                commit()
                for device in dmd.Devices.Network.Switch.getSubDevices():
                        for i in device.os.interfaces():
                                ipaddress = i.getIpAddress()
                                if ip[0] == ipaddress:
                                        device.changeDeviceLocationPath(tab[1])
                                        commit()


The location is added but the device don't move (probably not the good function).
ip[0] is the device ip, tab[1] the name of the location and tab[2] the location definition for the map api.

Thank you if you can help me.
--------------------------------------------------------------

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

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-05-07 12:23:01 UTC
Permalink
Rob Eagle [http://community.zenoss.org/people/reagle] created the discussion

"Re: Put devices in location with zendmd"

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

--------------------------------------------------------------
Floyn - think device.setLocation(tab[1]) would set you device location properly -- Rob
--------------------------------------------------------------

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

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

"Re: Put devices in location with zendmd"

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

--------------------------------------------------------------
I had a problem with my script too :

"i.getIpAddress()" don't give a string so I have add this :

ipSearch = i.getIpAddress()
if ipSearch:
     ipSearch=ipSearch.split('/')
     if ipSearch == ip[0]:

And that works.

Thank you for your help, the function is good.
--------------------------------------------------------------

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

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