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

Class ZenHub

source code

Products.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
Class Variables [hide private]
  totalTime = 0.
  totalEvents = 0
  totalCallTime = 0.
  name = 'zenhub'
Method Details [hide private]

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

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