Package Products :: Package ZenRRD :: Module zencommand :: Class SshPerformanceCollectionTask
[hide private]
[frames] | no frames]

Class SshPerformanceCollectionTask

source code

ZenCollector.tasks.BaseTask --+
                              |
                             SshPerformanceCollectionTask

A task that performs periodic performance collection for devices providing data via SSH connections.

Instance Methods [hide private]
 
__init__(self, taskName, configId, scheduleIntervalSeconds, taskConfig) source code
 
__str__(self) source code
 
cleanup(self) source code
 
_getPoolKey(self)
Get the key under which the client should be stored in the pool.
source code
 
_cleanUpPool(self)
Close the connection currently associated with this task.
source code
Twisted deferred object
doTask(self)
Contact to one device and return a deferred which gathers data from the device.
source code
 
_connect(self)
If a local datasource executor, do nothing.
source code
 
_close(self)
If a local datasource executor, do nothing.
source code
 
connectionFailed(self, msg)
This method is called by the SSH client when the connection fails.
source code
 
_failure(self, reason)
Twisted errBack to log the exception for a single device.
source code
 
_connectCallback(self, result)
Callback called after a successful connect to the remote device.
source code
 
_addDatasource(self, datasource)
Add a new instantiation of ProcessRunner or SshRunner for every datasource.
source code
 
_fetchPerf(self, ignored)
Get performance data for all the monitored components on a device
source code
 
_parseResults(self, resultList, cacheableDS)
Interpret the results retrieved from the commands and pass on the datapoint values and events.
source code
 
_makeParser(self, datasource, eventList)
Create a parser object to process data
source code
 
_processDatasourceResults(self, datasource, results)
Process a single datasource's results
source code
 
_addDefaultEvent(self, datasource, results)
If there is no event, send one based on the exit code.
source code
 
_addStderrMsg(self, stderrMsg, eventList)
Add the stderr output to error events.
source code
 
_storeResults(self, resultList)
Store the values in RRD files
source code
 
_updateStatus(self, resultList)
Send any accumulated events
source code
 
_clearEvent(self, datasource, eventList)
Ensure that a CLEAR event is sent for any command that successfully completes.
source code
 
_makeCmdEvent(self, datasource, msg, severity=None)
Create an event using the info in the Cmd object.
source code
 
_finished(self, result)
Callback activated when the task is complete
source code
 
displayStatistics(self)
Called by the collector framework scheduler, and allows us to see how each task is doing.
source code
Class Variables [hide private]
  STATE_CONNECTING = 'CONNECTING'
  STATE_FETCH_DATA = 'FETCH_DATA'
  STATE_PARSE_DATA = 'PARSING_DATA'
  STATE_STORE_PERF = 'STORE_PERF_DATA'
Method Details [hide private]

__init__(self, taskName, configId, scheduleIntervalSeconds, taskConfig)
(Constructor)

source code 
Parameters:
  • taskName (string) - the unique identifier for this task
  • configId (string) - configuration to watch
  • scheduleIntervalSeconds (int) - the interval at which this task will be collected
  • taskConfig - the configuration for this task

doTask(self)

source code 

Contact to one device and return a deferred which gathers data from the device.

Returns: Twisted deferred object
Deferred actions to run against a device configuration

_connect(self)

source code 

If a local datasource executor, do nothing.

If an SSH datasource executor, create a connection to object the remote device. Make a new SSH connection object if there isn't one available. This doesn't actually connect to the device.

_close(self)

source code 

If a local datasource executor, do nothing.

If an SSH datasource executor, relinquish a connection to the remote device.

connectionFailed(self, msg)

source code 

This method is called by the SSH client when the connection fails.

Parameters:
  • msg (string) - message indicating the cause of the problem

_failure(self, reason)

source code 

Twisted errBack to log the exception for a single device.

Parameters:
  • reason (Twisted error instance) - explanation of the failure

_fetchPerf(self, ignored)

source code 

Get performance data for all the monitored components on a device

Parameters:
  • ignored (result of previous callback) - required to keep Twisted's callback chain happy

_parseResults(self, resultList, cacheableDS)

source code 

Interpret the results retrieved from the commands and pass on the datapoint values and events.

Parameters:
  • resultList (array of (boolean, datasource)) - results of running the commands in a DeferredList
  • cacheableDS (dictionary of arrays of datasources) - other datasources that can use the same results

_makeParser(self, datasource, eventList)

source code 

Create a parser object to process data

Parameters:
  • datasource (Cmd object) - datasource containg information
  • eventList (list of dictionaries) - list of events

_processDatasourceResults(self, datasource, results)

source code 

Process a single datasource's results

Parameters:
  • datasource (Cmd object) - datasource containg information
  • results (ParsedResults object) - empty results object

_addStderrMsg(self, stderrMsg, eventList)

source code 

Add the stderr output to error events.

Parameters:
  • stderrMsg (string) - stderr output from the command
  • eventList (list of dictionaries) - list of events

_storeResults(self, resultList)

source code 

Store the values in RRD files

Parameters:
  • resultList (array of (datasource, dictionary)) - results of running the commands

_updateStatus(self, resultList)

source code 

Send any accumulated events

Parameters:
  • resultList (array of (datasource, dictionary)) - results of running the commands

_finished(self, result)

source code 

Callback activated when the task is complete

Parameters:
  • result (deferred object) - results of the task