Package Products :: Package ZenHub :: Module zenhub :: Class ZenHub |
[hide private]
[frames] | no frames]

# Class ZenHub

source code

                  object --+
                           |
    ZenUtils.CmdBase.CmdBase --+
                               |
    ZenUtils.ZenDaemon.ZenDaemon --+
                                   |
          ZenUtils.ZCmdBase.ZCmdBase --+
                                       |
                                      ZenHub

Listen for changes to objects in the Zeo database and update the collectors' configuration.

The remote collectors connect the ZenHub and request configuration information and stay connected. When changes are detected in the Zeo database, configuration updates are sent out to collectors asynchronously. In this way, changes made in the web GUI can affect collection immediately, instead of waiting for a configuration cycle.

Each collector uses a different, pluggable service within ZenHub to translate objects into configuration and data. ZenPacks can add services for their collectors. Collectors communicate using Twisted's Perspective Broker, which provides authenticated, asynchronous, bidirectional method invocation.

ZenHub also provides an XmlRPC interface to some common services to support collectors written in other languages.

Instance Methods | [hide private]
__init__(self) Hook ourselves up to the Zeo database and wait for collectors to connect. | source code
getRRDStats(self) Return the most recent RRD statistic information. | source code
zeoConnect(self) Override the kind of zeo connection we have so we can listen to Zeo object updates. | source code
processQueue(self) Periodically (once a second) process database changes | source code
doProcessQueue(self) Perform one cycle of update notifications. | source code
sendEvent(self, **kw) Useful method for posting events to the EventManager. | source code
loadChecker(self) Load the password file | source code
getService(self, name, instance) Helper method to load services dynamically for a collector. | source code
deferToWorker(self, args) Take a remote request and queue it for worker processes. | source code
giveWorkToWorkers(self) Parcel out a method invocation to an available worker process | source code
getJobForWorker(self, workerId) | source code
createWorker(self) Start a worker subprocess | source code
heartbeat(self) Since we don't do anything on a regular basis, just push heartbeats regularly. | source code
main(self) Start the main event loop. | source code
buildOptions(self) Adds our command line options to ZCmdBase command line options. | source code
Inherited from `ZenUtils.ZCmdBase.ZCmdBase`: `closeAll`, `closedb`, `findDevice`, `getConnection`, `getContext`, `getDataRoot`, `getDmdObj`, `login`, `logout`, `opendb`, `sigTerm`, `syncdb` 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` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Class Variables | [hide private]
| totalTime = `0.`
| totalEvents = `0`
| totalCallTime = `0.`
| name = `'zenhub'`
Inherited from `ZenUtils.ZenDaemon.ZenDaemon`: `pidfile` Inherited from `ZenUtils.CmdBase.CmdBase`: `doesLogging`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self) (Constructor) | source code
Hook ourselves up to the Zeo database and wait for collectors to connect. Overrides: ZenUtils.ZCmdBase.ZCmdBase.__init__

### zeoConnect(self) | source code
Override the kind of zeo connection we have so we can listen to Zeo object updates. Updates comes as OID invalidations. Returns: None Overrides: ZenUtils.ZCmdBase.ZCmdBase.zeoConnect

### processQueue(self) | source code
Periodically (once a second) process database changes Returns: None

### doProcessQueue(self) | source code
Perform one cycle of update notifications. Returns: None

### sendEvent(self, **kw) | source code
Useful method for posting events to the EventManager. Parameters: `kw` (keywords (dict)) - the values for an event: device, summary, etc. Returns: None

### loadChecker(self) | source code
Load the password file Returns: an object satisfying the ICredentialsChecker interface using a password file or an empty list if the file is not available. Uses the file specified in the --passwd command line option.

### getService(self, name, instance) | source code
Helper method to load services dynamically for a collector. Returned instances are cached: reconnecting collectors will get the same service object. Parameters: `name` (string) - the dotted-name of the module to load (uses @Products.ZenUtils.Utils.importClass) `instance` - string `instance` - each service serves only one specific collector instances (like 'localhost'). instance defines the collector's instance name. Returns: a service loaded from ZenHub/services or one of the zenpacks.

### deferToWorker(self, args) | source code
Take a remote request and queue it for worker processes. Parameters: `args` (tuple) - the arguments to the remote_execute() method in the worker Returns: a Deferred for the eventual results of the method call

### createWorker(self) | source code
Start a worker subprocess Returns: None

### heartbeat(self) | source code
Since we don't do anything on a regular basis, just push heartbeats regularly. Returns: None

### buildOptions(self) | source code
Adds our command line options to ZCmdBase command line options. Overrides: ZenUtils.ZCmdBase.ZCmdBase.buildOptions