Developer's Guide

  • Docs Home
  • Community Home

3. Deleting A Device

Devices can be deleted through the UI but also through a programmatic interface.

3.1. 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 forget to escape the "&" or wrap the URL in single quotes.

$ wget 'http://admin:zenoss@MYHOST:8080/zport/dmd/Devices/\
Server/Linux/devices/MYDEVICE/deleteDevice'

The result of this command will delete the device MYDEVICE.

3.2. 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
>>> cp = 'Devices/Server/Linux/devices'
>>> url = 'http://admin:zenoss@MYHOST:8080/zport/dmd/%s/NEWDEVICE' % cp
>>> serv = ServerProxy(url)
>>> serv.deleteDevice()