TECHZEN Zenoss User Community ARCHIVE  

How to edit and delete "Locations" using a XML-RPC call

Subject: How to edit and delete "Locations" using a XML-RPC call
Author: [Not Specified]
Posted: 2014-02-17 18:26

Actually I know how to create a Location, but I can't delete or modify it.

serv = ServerProxy(url + '/zport/dmd/DeviceLoader')
serv.addLocation("Australia/NSW/Sydney")

Thanks heaps!

http://ivan.moyano.cl



Subject: Imoyano,
Author: Andrew Kirch
Posted: 2014-02-18 11:46

Imoyano,

The call would be the same call as used from zendmd. That said we don't actually have documentation for doing this. Finding the API call you need is EASY though. Use firebug and delete a location from the webui, and you will capture the code you need to do it via RPC, or JSON.

Andrew Kirch

akirch@gvit.com

Need Zenoss support, consulting or custom development Look no further. Email or PM me!

Ready for Distributed Topology (collectors) for Zenoss 5 Coming May 1st from GoVanguard



Subject: SOLUTION
Author: [Not Specified]
Posted: 2014-02-18 18:29

Thanks Trelane

I got the solution to my question... Here:

*** Create a location ***
dmd = ServerProxy('http://user:pass@localhost:8080/zport/dmd')
dmd.Locations.createOrganizer("YOUR_LOCATION")

*** Edit a location ***
dmd_loc = ServerProxy('http://user:pass@localhost:8080/zport/dmd/Locations/YOUR_LOCATION')
dmd_loc.setZenProperty("description","YOUR DESCRIPTION")
dmd_loc.setZenProperty("address","YOUR ADDR")

*** Delete a location ***
dmd = ServerProxy('http://user:pass@localhost:8080/zport/dmd')
dmd.Locations.manage_deleteOrganizer("YOUR_LOCATION")

http://ivan.moyano.cl



< Previous
5.x feedback
  Next
How to create email alerts in 4.2.4?
>