Package Products :: Package DataCollector :: Module zenmodeler :: Class ZenModeler |
[hide private]
[frames] | no frames]

# Class ZenModeler

source code

                     object --+
                              |
       ZenUtils.CmdBase.CmdBase --+
                                  |
       ZenUtils.ZenDaemon.ZenDaemon --+
                                      |
    twisted.spread.pb.Referenceable --+
                                      |
               ZenHub.PBDaemon.PBDaemon --+
                                          |
                                         ZenModeler

Known Subclasses:
  - zendisc.ZenDisc

Daemon class to attach to zenhub and pass along device configuration information.

Instance Methods | [hide private]
__init__(self, single=False) Initalizer | source code
reportError(self, error) Log errors that have occurred | source code
connected(self) Called after connected to the zenhub service | source code
configure(self) Get our configuration from zenhub | source code
config(self) Get the ModelerService | source code
selectPlugins(self, device, transport) Build a list of active plugins for a device, based on: | source code
collectDevice(self, device) Collect data from a single device. | source code
wmiCollect(self, device, ip, timeout) Start the Windows Management Instrumentation (WMI) collector | source code
pythonCollect(self, device, ip, timeout) Start local Python collection client. | source code
cmdCollect(self, device, ip, timeout) Start shell command collection client. | source code
snmpCollect(self, device, ip, timeout) Start SNMP collection client. | source code
addClient(self, device, timeout, clientType, name) If device is not None, schedule the device to be collected. | source code
portscanCollect(self, device, ip, timeout) Start portscan collection client. | source code
checkCollection(self, device) See how old the data is that we've collected | source code
clientFinished(self, collectorClient) Callback that processes the return values from a device. | source code
fillError(self, reason) Twisted errback routine to log an error when unable to collect some data | source code
integer |
cycleTime(self) Return our cycle time (in minutes) | source code
heartbeat(self, ignored=None) Twisted keep-alive mechanism to ensure that we're still connected to zenhub | source code
checkStop(self, unused=None) Check to see if there's anything to do. | source code
fillCollectionSlots(self, driver) An iterator which either returns a device to collect or calls checkStop() | source code
buildOptions(self) Build our list of command-line options | source code
processOptions(self) Check what the user gave us vs what we'll accept for command-line options | source code
_timeoutClients(self) The guts of the timeoutClients method (minus the twisted reactor stuff). | source code
timeoutClients(self, unused=None) Check to see which clients have timed out and which ones haven't. | source code
reactorLoop(self) Twisted main loop | source code
getDeviceList(self) Get the list of devices for which we are collecting: * if -d devicename was used, use the devicename * if a class path flag was supplied, gather the devices along that organizer * otherwise get all of the devices associated with our collector | source code
Twisted deferred object |
mainLoop(self, driver) Main collection loop, a Python iterable | source code
Twisted deferred object |
main(self, unused=None) Wrapper around the mainLoop | source code
remote_deleteDevice(self, device) Stub function | source code
Inherited from `ZenHub.PBDaemon.PBDaemon`: `connect`, `connectTimeout`, `eventService`, `getInitialServices`, `getService`, `getServiceNow`, `gotPerspective`, `pushEvents`, `pushEventsLoop`, `remote_getName`, `remote_setPropertyItems`, `remote_shutdown`, `remote_updateThresholdClasses`, `run`, `sendEvent`, `sendEvents`, `setExitCode`, `sigTerm`, `stop` Inherited from `ZenUtils.ZenDaemon.ZenDaemon`: `becomeDaemon`, `becomeWatchdog`, `changeUser`, `niceDoggie`, `openPrivilegedPort`, `setupLogging`, `sighandler_USR1`, `watchdogCycleTime`, `watchdogMaxRestartTime`, `watchdogStartTimeout`, `writePidFile` Inherited from `ZenUtils.CmdBase.CmdBase`: `buildParser`, `checkLogpath`, `generate_configs`, `generate_xml_configs`, `generate_xml_table`, `getConfigFileDefaults`, `parseOptions`, `pretty_print_config_comment`

Class Variables | [hide private]
| name = `'zenmodeler'`
| initialServices = `PBDaemon.initialServices+ ['ModelerService']`
| generateEvents = `True`
| configCycleInterval = `360`
| classCollectorPlugins = `()`
Inherited from `ZenHub.PBDaemon.PBDaemon`: `heartbeatEvent`, `heartbeatTimeout` Inherited from `ZenHub.PBDaemon.PBDaemon` (private): `_customexitcode`, `_sendingEvents` Inherited from `ZenUtils.ZenDaemon.ZenDaemon`: `pidfile` Inherited from `ZenUtils.CmdBase.CmdBase`: `doesLogging`

Method Details | [hide private]

### __init__(self, single=False) (Constructor) | source code
Initalizer Parameters: `single` (boolean) - collect from a single device? Overrides: ZenUtils.CmdBase.CmdBase.__init__

### reportError(self, error) | source code
Log errors that have occurred Parameters: `error` (string) - error message

### connected(self) | source code
Called after connected to the zenhub service Overrides: ZenHub.PBDaemon.PBDaemon.connected

### selectPlugins(self, device, transport) | source code
Build a list of active plugins for a device, based on: * the --collect command-line option which is a regex * the --ignore command-line option which is a regex * transport which is a string describing the type of plugin Parameters: `device` (string) - device to collect against `transport` (string) - python, ssh, snmp, telnet, cmd Returns: results of the plugin To Do: determine if an event for the collector AND the device should be sent

### collectDevice(self, device) | source code
Collect data from a single device. Parameters: `device` (string) - device to collect against

### wmiCollect(self, device, ip, timeout) | source code
Start the Windows Management Instrumentation (WMI) collector Parameters: `device` (string) - device to collect against `ip` (string) - IP address of device to collect against `timeout` (integer) - timeout before failing the connection

### pythonCollect(self, device, ip, timeout) | source code
Start local Python collection client. Parameters: `device` (string) - device to collect against `ip` (string) - IP address of device to collect against `timeout` (integer) - timeout before failing the connection

### cmdCollect(self, device, ip, timeout) | source code
Start shell command collection client. Parameters: `device` (string) - device to collect against `ip` (string) - IP address of device to collect against `timeout` (integer) - timeout before failing the connection

### snmpCollect(self, device, ip, timeout) | source code
Start SNMP collection client. Parameters: `device` (string) - device to collect against `ip` (string) - IP address of device to collect against `timeout` (integer) - timeout before failing the connection

### addClient(self, device, timeout, clientType, name) | source code
If device is not None, schedule the device to be collected. Otherwise log an error. Parameters: `device` (string) - device to collect against `timeout` (integer) - timeout before failing the connection `clientType` (string) - description of the plugin type `name` (string) - plugin name

### portscanCollect(self, device, ip, timeout) | source code
Start portscan collection client. Parameters: `device` (string) - device to collect against `ip` (string) - IP address of device to collect against `timeout` (integer) - timeout before failing the connection

### checkCollection(self, device) | source code
See how old the data is that we've collected Parameters: `device` (string) - device to collect against Returns: is the SNMP status number > 0 and is the last collection time + collage older than now?

### clientFinished(self, collectorClient) | source code
Callback that processes the return values from a device. Python iterable. Parameters: `collectorClient` (collector class) - collector instance Returns: Twisted deferred object

### fillError(self, reason) | source code
Twisted errback routine to log an error when unable to collect some data Parameters: `reason` (string) - error message

### cycleTime(self) | source code
Return our cycle time (in minutes) Returns: integer cycle time

### heartbeat(self, ignored=None) | source code
Twisted keep-alive mechanism to ensure that we're still connected to zenhub Parameters: `ignored` (object) - object (unused) Overrides: ZenHub.PBDaemon.PBDaemon.heartbeat

### checkStop(self, unused=None) | source code
Check to see if there's anything to do. If there isn't, report our statistics and exit. Parameters: `unused` (string) - unused (unused)

### fillCollectionSlots(self, driver) | source code
An iterator which either returns a device to collect or calls checkStop() Parameters: `driver` (driver object) - driver object

### buildOptions(self) | source code
Build our list of command-line options Overrides: ZenUtils.CmdBase.CmdBase.buildOptions

### _timeoutClients(self) | source code
The guts of the timeoutClients method (minus the twisted reactor stuff). Breaking this part out as a separate method facilitates unit testing.

### timeoutClients(self, unused=None) | source code
Check to see which clients have timed out and which ones haven't. Stop processing anything that's timed out. Parameters: `unused` (string) - unused (unused)

### getDeviceList(self) | source code
    Get the list of devices for which we are collecting:
    * if -d devicename was used, use the devicename
    * if a class path flag was supplied, gather the devices
      along that organizer
    * otherwise get all of the devices associated with our collector

    @return: list of devices
    @rtype: list

### mainLoop(self, driver) | source code
Main collection loop, a Python iterable Parameters: `driver` (driver object) - driver object Returns: Twisted deferred object Twisted deferred object

### main(self, unused=None) | source code
Wrapper around the mainLoop Parameters: `unused` (string) - unused (unused) Returns: Twisted deferred object Twisted deferred object

### remote_deleteDevice(self, device) | source code
Stub function Parameters: `device` (string) - device name (unused) To Do: implement