zenAPIClient

Zenoss API client module


Keywords
zenoss, monitoring, api
License
Other
Install
pip install zenAPIClient==1.0.3

Documentation

Zenoss API Client

Tests badge Documentation Status Coverage Status PyPI - Version GitHub Release TestPyPI - Version

Python module for interacting with the Zenoss API in an object-oriented way. Tested with Zenoss Cloud, no guarantees for earlier versions...

The philosophy here is to use objects to work with everything in the Zenoss API, and to try to normalize the various calls to the different routers. Thus get methods will always return an object, list methods will return data. All methods to add or create start with add, all remove or delete start with delete. As much as possible the methods try to hide the idiosyncrasies of the JSON API, and to do the work for you, for example by letting you use a device name instead of having to provide the full device UID for every call.

Installing

pip install zenAPIClient


## Using

In [1]: from zenossapi import apiclient as zapi

In [2]: zenoss_client = zapi.Client(host=zenurl, collection_zone='cz0', api_key=zenApiKey)
In [3]: device_router = zenoss_client.get_router('device')
In [4]: device_class = device_router.get_device_class('Server/SSH/Linux')
In [5]: my_server = device_class.get_device('my.server.example.com')
In [6]: remodel_job = my_server.remodel()
In [7]: print(remodel_job)
9ba5c8d7-58de-4f18-96fe-d362841910d3

Supports the Zenoss JobsRouter, DeviceRouter, TemplateRouter, EventsRouter, PropertiesRouter, MonitorRouter, CMDBRouter, and DeviceManagementRouter.