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

Class ZenHub

source code

Products.ZenUtils.CmdBase.CmdBase --+        
                                    |        
Products.ZenUtils.ZenDaemon.ZenDaemon --+    
                                        |    
      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
 
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
 
heartbeat(self)
Since we don't do anything on a regular basis, just push heartbeats regularly.
source code
 
sigTerm(self, signum, frame)
Start a controlled shutdown of main loop on interrupt.
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 Products.ZenUtils.ZCmdBase.ZCmdBase: closeAll, closedb, findDevice, getConnection, getContext, getDataRoot, getDmdObj, login, logout, opendb, syncdb

Inherited from Products.ZenUtils.ZenDaemon.ZenDaemon: becomeDaemon, changeUser, setupLogging

Inherited from Products.ZenUtils.CmdBase.CmdBase: buildParser, generate_configs, generate_xml_table, parseOptions, pretty_print_config_comment

Class Variables [hide private]
  totalTime = 0.0
  totalEvents = 0
  maxTime = 0.0
  name = 'zenhub'

Inherited from Products.ZenUtils.ZenDaemon.ZenDaemon: pidfile

Inherited from Products.ZenUtils.CmdBase.CmdBase: doesLogging

Method Details [hide private]

__init__(self)
(Constructor)

source code 
Hook ourselves up to the Zeo database and wait for collectors to connect.
Overrides: Products.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: Products.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.

heartbeat(self)

source code 
Since we don't do anything on a regular basis, just push heartbeats regularly.
Returns:
None

sigTerm(self, signum, frame)

source code 
Start a controlled shutdown of main loop on interrupt.
Parameters:
  • signum - unused.
  • frame - unused.
Returns:
None
Overrides: Products.ZenUtils.ZenDaemon.ZenDaemon.sigTerm

main(self)

source code 
Start the main event loop.
Returns:
None

buildOptions(self)

source code 
Adds our command line options to ZCmdBase command line options.
Returns:
None
Overrides: Products.ZenUtils.ZCmdBase.ZCmdBase.buildOptions