Zenoss::Router::Device - A JSON/ExtDirect interface to operations on devices
use Zenoss; my $api = Zenoss->connect( { username => 'zenoss username', password => 'zenoss password', url => 'http://zenossinstance:8080', } ); # Replace SOMEMETHOD with one of the available methods provided by this module my $response = $api->device_SOMEMETHOD( { parameter1 => 'value', parameter2 => 'value', } );
This module is NOT instantiated directly. To call methods from this module create an instance of Zenoss. This document serves as a resource of available Zenoss API calls to Zenoss.
The following is a list of available methods available for interaction with the Zenoss API. Please take note of the argument requirements, defaults and return content.
The documentation for this module was mostly taken from the Zenoss JSON API docs. Keep in mind that their (Zenoss Monitoring System) programming is based around python, so descriptions such as dictionaries will be represented as hashes in Perl.
Adds a new location organizer specified by the parameter id to the parent organizer specified by contextUid. contextUid must be a path to a Location.
type (string) - Node type (always 'organizer' in this case)
contextUid (string) - Path to the location organizer that will be the new node's parent (ex. /zport/dmd/Devices/Locations)
id (string) - The identifier of the new node
description (string) - Describes the new location
address (string) - Physical address of the new location
type
contextUid
id
N/A
success: (bool) Success of node creation
nodeConfig: (dictionary) The new location's properties
Returns the tree structure of an organizer hierarchy where the root node is the organizer identified by the id parameter.
id (string) - Id of the root node of the tree to be returned
Object representing the tree
Retrieves all of the components at a given UID. This method allows for pagination.
uid (string) - Unique identifier of the device whose components are being retrieved
meta_type (string) - The meta type of the components to be retrieved
keys (list) - List of keys to include in the returned dictionary. If None then all keys will be returned
start (integer) - Offset to return the results from; used in pagination
limit (integer) - Number of items to return; used in pagination
sort (string) - Key on which to sort the return results;
dir (string) - Sort order; can be either 'ASC' or 'DESC'
name (regex) - Used to filter the results
uid
{start => 0, limit => 50, sort => 'name', dir => 'ASC'}
data: (dictionary) The components returned
totalCount: (integer) Number of items returned
hash: (string) Hashcheck of the current component state (to check whether components have changed since last query)
Retrieves all of the components set up to be used in a tree.
uid (string) - Unique identifier of the root of the tree to retrieve
Component properties in tree form
Given a component uid and the component search criteria, this retrieves the position of the component in the results.
componentUid (string) - Unique identifier of the component whose index to return
uid (string) - Unique identifier of the device queried for components
meta_type (string) - The meta type of the components to retrieve
sort (string) - Key on which to sort the return results
componentUid
{sort => 'name', dir => 'ASC'}
index: (integer) Index of the component
Given an object identifier, this returns all of the editable fields on that object as well as their ExtJs xtype that one would use on a client side form.
uid (string) - Unique identifier of an object
form: (dictionary) form fields for the object
Get the properties of a device or device organizer
data: (dictionary) Object properties
disabled: (bool) If current user doesn't have permission to use setInfo
Set attributes on a device or device organizer.
This method accepts any keyword argument for the property that you wish to set.
DirectResponse
Sets the ProductInfo on a device. This method has the following valid keyword arguments:
uid (string) - Unique identifier of a device
hwManufacturer (string) - Hardware manufacturer
hwProductName (string) - Hardware product name
osManufacturer (string) - Operating system manufacturer
osProductName (string) - Operating system product name
Not documented
Retrieves a list of devices. This method supports pagination.
uid (string) - Unique identifier of the organizer to get devices from
params (dictionary) - Key-value pair of filters for this search. Can be one of the following: name, ipAddress, deviceClass, or productionState
devices: (list) Dictionaries of device properties
totalCount: (integer) Number of devices returned
hash: (string) Hashcheck of the current device state (to check whether devices have changed since last query)
Moves the devices specified by uids to the organizer specified by 'target'.
uids ([string]) - List of device uids to move
target (string) - Uid of the organizer to move the devices to
hashcheck (string) - Hashcheck for the devices (from getDevices())
ranges ([integer]) - List of two integers that are the min/max values of a range of uids to include
uid (string) - Organizer to use when using ranges to get additional uids
sort (string) - Key on which to sort the return result
uids
target
hashcheck
tree: ([dictionary]) Object representing the new device tree
exports: (integer) Number of devices moved
Push changes on device(s) configuration to collectors.
uids ([string]) - List of device uids to push changes
Success message
Lock device(s) from changes.
uids ([string]) - List of device uids to lock
updates (boolean) - True to lock device from updates
deletion (boolean) - True to lock device from deletion
sendEvent (boolean) - True to send an event when an action is blocked by locking
{updates => JSON::false, deletion => JSON::false, sendevent => JSON::false, sort => 'name', dir => 'ASC'}
Success or failure message
Reset IP address(es) of device(s) to the results of a DNS lookup or a manually set address
uids ([string]) - List of device uids with IP's to reset
ip (string) - IP to set device to. Empty string causes DNS lookup
{sort => 'name', dir => 'ASC', ip => ''}
Reset community string of device(s)
uids ([string]) - List of device uids to reset
Set the production state of device(s)
uids ([string]) - List of device uids to set
prodState (integer) - Production state to set device(s) to.
params (dictionary) - Key-value pair of filters for this search. Can be one of the following: name, ipAddress, deviceClass, or
productionState
prodState
Set device(s) priority.
priority (integer) - Priority to set device(s) to.
priority
Set device(s) collector.
collector (string) - Collector to set devices to
collector
Set the monitoring flag for component(s)
uids ([string]) - List of component uids to set
hashcheck (string) - Hashcheck for the components (from getComponents())
monitor (boolean) - True to monitor component
uid (string) - Device to use when using ranges to get additional uids
name (string) - Component name to search for when loading ranges
{monitor => JSON::false, start => 0, limit => 50, sort => 'name', dir => 'ASC'}
Lock component(s) from changes.
uids ([string]) - List of component uids to lock
updates (boolean) - True to lock component from updates
deletion (boolean) - True to lock component from deletion
{updates => JSON::false, deletion => JSON::false, sendEvent => JSON::false, start => 0, limit => 50, sort => 'name', dir => 'ASC'}
Delete device component(s).
uids ([string]) - List of component uids to delete
Remove/delete device(s).
uids ([string]) - List of device uids to remove
action (string) - Action to take. 'remove' to remove devices from organizer uid, and 'delete' to delete the device from Zenoss.
uid (string) - Organizer to use when using ranges to get additional uids and/or to remove device
{action => 'remove', sort => 'name', dir => 'ASC'}
devtree: ([dictionary]) Object representing the new device tree
grptree: ([dictionary]) Object representing the new group tree
systree: ([dictionary]) Object representing the new system tree
loctree: ([dictionary]) Object representing the new location tree
Get events for a device.
uid ([string]) - Device to get events for
data: ([dictionary]) List of events for a device
Get a range of device uids.
ranges ([integer]) - List of two integers that are the min/max values of a range of uids
uid (string) - Organizer to use to get uids
ranges
A list of device uids
Get a range of component uids.
hashcheck (string) - not used
uid (string) - Device to use to get uids
types ([string]) - The types of components to retrieve
{start => 0, sort => 'name', dir => 'ASC'}
A list of component uids
Get a list of user commands for a device uid.
uid (string) - Device to use to get user commands
List of objects representing user commands
Get a list of available production states.
NONE
List of name/value pairs of available production states
Get a list of available device priorities.
List of name/value pairs of available device priorities
Get a list of available collectors.
List of collectors
Get a list of all device classes.
deviceClasses: ([dictionary]) List of device classes
totalCount: (integer) Total number of device classes
Get a list of all manufacturer names.
manufacturers: ([dictionary]) List of manufacturer names
totalCount: (integer) Total number of manufacturer names
Get a list of all hardware product names from a manufacturer.
manufacturer (string) - Manufacturer name
{manufacturer => ''}
productNames: ([dictionary]) List of hardware product names
totalCount: (integer) Total number of hardware product names
Get a list of all OS product names from a manufacturer.
productNames: ([dictionary]) List of OS product names
totalCount: (integer) Total number of OS product names
Add a device.
deviceName (string) - Name or IP of the new device
deviceClass (string) - The device class to add new device to
title (string) - The title of the new device
snmpCommunity (string) - A specific community string to use for this device.
snmpPort (integer) - SNMP port on new device
model (boolean) - True to model device at add time
collector (string) - Collector to use for new device
rackSlot (string) - Rack slot description
productionState (integer) - Production state of the new device
comments (string) - Comments on this device
hwManufacturer (string) - Hardware manufacturer name
osManufacturer (string) - OS manufacturer name
osProductName (string) - OS product name
priority (integer) - Priority of this device
tag (string) - Tag number of this device
serialNumber (string) - Serial number of this device
deviceName
deviceClass
{snmpCommunity => '', snmpPort => '161', collector => 'localhost', rackSlot => 0, productionState => 1000, comments => '', hwManufacturer => '', hwProductName => '', osManufacturer => '', osProductName => '', priority => 3, tag => '', serialNumber => ''}
jobId: (string) ID of the add device job
Adds a local template on a device.
deviceUid (string) - Device uid to have local template
templateId (string) - Name of the new template
deviceUid
templateId
Removes a locally defined template on a device.
deviceUid (string) - Device uid that has local template
templateUid (string) - Name of the template to remove
templateUid
Get a list of locally defined templates on a device.
uid (string) - Device uid to query for templates
data: ([dictionary]) List of objects representing local templates
Get a list of available templates for a device.
id (string) - Device uid to query for templates
data: ([dictionary]) List of objects representing templates
Get a list of unbound templates for a device.
Get a list of bound templates for a device.
Set a list of templates as bound to a device.
uid (string) - Device uid to bind templates to
templateIds ([string]) - List of template uids to bind to device
templateIds
Remove all bound templates from a device.
uid (string) - Device uid to remove bound templates from
Bind an unbound template or unbind a bound template from a device.
uid (string) - Device uid to bind/unbind template
templateUid (string) - Template uid to bind/unbind
Get a list of available templates on a device that can be overridden.
uid (string) - Device to query for overridable templates
Clear the Google Maps geocode cache.
Returns the url and title for each graph for the object passed in.
uid (string) - uid of the device
drange (unknown) - I assume this is some type of date range, but the API doesnt document how to specify.
data: ([dictionary]) List of objects representing urls / titles for each graph
Get a list of all groups
systems: ([dictionary]) List of groups
totalCount: (integer) Total number of groups
Get a list of all locations
systems: ([dictionary]) List of locations
totalCount: (integer) Total number of locations
Given a uid this method returns meta data about when it was modified.
id (string) - uid of a device
types (dictionary) - Not sure what this really is. Python code says it sorts by this?
{types => JSON::null}
data: ([dictionary]) List of device modifications
Get a list of all systems
systems: ([dictionary]) List of systems
totalCount: (integer) Total number of systems
Returns the definition and values of all the zen properties for this context
uid (string) - Unique identifier of the device
params (dictionary) - Key-value pair of filters for this search
{start => 0, dir => 'ASC'}
data: ([dictionary]) List of zProperties
totalCount: (integer) Total number of properties
Returns information about a zProperty for a given context, including its value
zProperty (string) - Name of the zProperty
zProperty
data: ([dictionary]) zProperty information/data
Removes the local instance of the each property in properties. Note that the property will only be deleted if a hasProperty is true
Sets the zProperty value
value (type) - Value to set the zProperty to
value
data: ([dictionary]) zProperty information/data response
Zenoss
Zenoss::Response
Patrick Baker <patricksbaker@gmail.com>
Copyright (C) 2010 by Patrick Baker <patricksbaker@gmail.com>
This module is free software: you can redistribute it and/or modify it under the terms of the Artistic License 2.0.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
You can obtain the Artistic License 2.0 by either viewing the LICENSE file provided with this distribution or by navigating to http://opensource.org/licenses/artistic-license-2.0.php.
To install Zenoss, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Zenoss
CPAN shell
perl -MCPAN -e shell install Zenoss
For more information on module installation, please visit the detailed CPAN module installation guide.