Delete Device
by
zenoss
—
last modified
2007-06-08 09:35
How to delete a device using a REST or XML-RPC call
Devices can be deleted through the UI but also through a programmatic
interface. This how to will describe deleting a device using that
interface.
Using a REST call
Deleting a device through a rest call can be done by a simple web
get. In this example we will use wget to delete a device. If you use
wget don't for get to escape the "&" or wrap the URL in single
quotes.
[zenos@zenoss $] wget 'http://admin:zenoss@MYHOST:8080/zport/dmd/Devices/Server/Linux/devices/MYDEVICE/deleteDevice'
The result of this command will delete the device: MYDEVICE.
Using an XML-RPC Call from Python
This is an example of how to delete a device using python. Because
XML-RPC can be used from any language feel free to use your favorite.
What is important here is the base URL in ServerProxy, passing named
parameters, and calling "deleteDevice" on your proxy object.
>>> from xmlrpclib import ServerProxy
>>> serv = ServerProxy('http://admin:zenoss@MYHOST:8080/zport/dmd/Devices/Server/Linux/devices/MYDEVICE')
>>> serv.deleteDevice()