Routers
A router is an endpoint (URL) that can perform actions and return data. Zenoss API for Collection Zone and Resource Manager endpoints are available through routers. Many routers are available by default in Collection Zone and Resource Manager, and several are added by ZenPacks.
Router reference pages
This section provides procedurally-generated documentation for most of the available Routers available inside Collection Zone and Resource Manager. Some of these routers are available by default, and some have been added by additional ZenPacks.
Note
This documentation has some gaps because it has been generated using code. Not all routers were designed to be used externally, and because of this, not all methods in each router have help text. Always test on a non-production system before executing API calls against a production system.
Arguments
Routers often take positional and keyword arguments.
Positional arguments
Positional arguments are defined by their position in a method invocation. For
example, the addDevice
argument in DeviceRouter
accepts the following arguments:
addDevice(deviceName, deviceClass, **serialNumber, **zWinPassword, **osProductName, **zWinUser, **tag, **rackSlot, **hwManufacturer, **hwProductName, **collector, **zCommandPassword, **title, **manageIp, **comments, **priority, **snmpCommunity, **zCommandUsername, **groupPaths, **snmpPort, **cProperties, **zProperties, **productionState, **systemPaths, **osManufacturer, **model, **locationPath)
The first two arguments, deviceName
and deviceClass
, are defined by
their position and the subsequent arguments are keyword arguments.
Keyword arguments
Keyword arguments or
kwargs
are defined by a keyword in name=value
format. Typically, keyword arguments
have default values and are optional.
UIDs
The UID of a device is its path in the Zope Object Database (ZODB) and
many router methods require a UID to reference a device or other object.
For example, the UID of a device in the /Server/Linux
device class might
be /zport/dmd/Devices/Server/Linux/devices/my_test_device.company.loc
.
Like many others, the getComponents
method of DeviceRouter
requires a UID.
getComponents(**sort, **uid, **keys, **start, **meta_type, **limit, **page, **dir, **name)
How to get router information
The IntrospectionRouter
provides methods for getting detailed descriptions
of the routers and methods available in your Collection Zone or Resource Manager
instance. Not all routers were designed to be used externally, and because
of this, not all methods in each router have help text. Always test a router on a
non-production system before running API calls against a production system.
IntrospectionRouter
getAllRouters()
-
Return a description of all available routers.
from Products.Zuul.routers.introspection import IntrospectionRouter zz = IntrospectionRouter(dmd) pprint(zz.getAllRouters().data)
getRouterInfo(**router)
- Return information about the specified router.
getRouterMethods(**router)
-
Return a JSON list of methods, arguments and documentation.
from Products.Zuul.routers.introspection import IntrospectionRouter zz = IntrospectionRouter(dmd) pprint(zz.getRouterMethods('DeviceRouter').data)