Exemple #1
0
    def __init__(self):
        ZCmdBase.__init__(self)

        self.current = IDLE
        self.currentStart = 0
        self.numCalls = 0
        try:
            self.log.debug("establishing SIGUSR2 signal handler")
            signal.signal(signal.SIGUSR2, self.sighandler_USR2)
        except ValueError:
            # If we get called multiple times, this will generate an exception:
            # ValueError: signal only works in main thread
            # Ignore it as we've already set up the signal handler.
            pass

        self.zem = self.dmd.ZenEventManager
        loadPlugins(self.dmd)
        self.pid = os.getpid()
        self.services = {}
        factory = ReconnectingPBClientFactory()
        self.log.debug("Connecting to %s:%d",
                       self.options.hubhost,
                       self.options.hubport)
        reactor.connectTCP(self.options.hubhost, self.options.hubport, factory)
        self.log.debug("Logging in as %s", self.options.username)
        c = credentials.UsernamePassword(self.options.username,
                                         self.options.password)
        factory.gotPerspective = self.gotPerspective
        def stop(*args):
            reactor.callLater(0, reactor.stop)
        factory.clientConnectionLost = stop
        factory.startLogin(c)
Exemple #2
0
    def __init__(self, *args, **kwargs):
        ZCmdBase.__init__(self, *args, **kwargs)
        self.defaults = {}

        self.collectorNames = self.dmd.Monitors.getPerformanceMonitorNames()

        self.loader = self.dmd.DeviceLoader.loadDevice

        self.fqdn = socket.getfqdn()
        self.baseEvent = dict(
            device=self.fqdn,
            component='',
            agent='zenbatchload',
            monitor='localhost',
            manager=self.fqdn,
            severity=SEVERITY_ERROR,
            # Note: Change_Add events get sent to history by the event class' Zen property
            eventClass=Change_Add,
        )

        # Create the list of options we want people to know about
        self.loader_args = dict.fromkeys( self.loader.func_code.co_varnames )
        unsupportable_args = [
            'REQUEST', 'device', 'self', 'xmlrpc', 'e', 'handler',
        ]
        for opt in unsupportable_args:
            if opt in self.loader_args:
                del self.loader_args[opt]
 def __init__(self, Klass):
     ZCmdBase.__init__(self, False, False, False)
     # It's super annoying to try to figure out how to get the
     # zenhub service to drop into debug mode.  Use the following.
     setLogLevel(logging.DEBUG)
     logging.basicConfig()
     self.service = Klass(self.dmd, self.options.monitor)
    def __init__(self, *args, **kwargs):
        ZCmdBase.__init__(self, *args, **kwargs)
        self.defaults = {}

        self.collectorNames = self.dmd.Monitors.getPerformanceMonitorNames()

        self.loader = self.dmd.DeviceLoader.loadDevice

        self.fqdn = socket.getfqdn()
        self.baseEvent = dict(
            device=self.fqdn,
            component='',
            agent='zenbatchload',
            monitor='localhost',
            manager=self.fqdn,
            severity=SEVERITY_ERROR,
            # Note: Change_Add events get sent to history by the event class' Zen property
            eventClass=Change_Add,
        )

        # Create the list of options we want people to know about
        self.loader_args = dict.fromkeys( self.loader.func_code.co_varnames )
        unsupportable_args = [
            'REQUEST', 'device', 'self', 'xmlrpc', 'e', 'handler',
        ]
        for opt in unsupportable_args:
            if opt in self.loader_args:
                del self.loader_args[opt]
Exemple #5
0
    def __init__(self):
        ZCmdBase.__init__(self)

        self.current = IDLE
        self.currentStart = 0
        self.numCalls = 0
        try:
            self.log.debug("establishing SIGUSR2 signal handler")
            signal.signal(signal.SIGUSR2, self.sighandler_USR2)
        except ValueError:
            # If we get called multiple times, this will generate an exception:
            # ValueError: signal only works in main thread
            # Ignore it as we've already set up the signal handler.
            pass

        self.zem = self.dmd.ZenEventManager
        loadPlugins(self.dmd)
        self.pid = os.getpid()
        self.services = {}
        factory = ReconnectingPBClientFactory()
        self.log.debug("Connecting to %s:%d", self.options.hubhost,
                       self.options.hubport)
        reactor.connectTCP(self.options.hubhost, self.options.hubport, factory)
        self.log.debug("Logging in as %s", self.options.username)
        c = credentials.UsernamePassword(self.options.username,
                                         self.options.password)
        factory.gotPerspective = self.gotPerspective

        def stop(*args):
            reactor.callLater(0, reactor.stop)

        factory.clientConnectionLost = stop
        factory.startLogin(c)
 def __init__(self, Klass):
     ZCmdBase.__init__(self, False, False, False)
     # It's super annoying to try to figure out how to get the
     # zenhub service to drop into debug mode.  Use the following.
     setLogLevel(logging.DEBUG)
     logging.basicConfig()
     self.service = Klass(self.dmd, self.options.monitor)
    def __init__(self):
        signal.signal(signal.SIGUSR2, signal.SIG_IGN)
        ZCmdBase.__init__(self)
        if self.options.profiling:
            self.profiler = ContinuousProfiler('zenhubworker', log=self.log)
            self.profiler.start()
        self.current = IDLE
        self.currentStart = 0
        self.numCalls = Metrology.meter("zenhub.workerCalls")
        try:
            self.log.debug("establishing SIGUSR1 signal handler")
            signal.signal(signal.SIGUSR1, self.sighandler_USR1)
            self.log.debug("establishing SIGUSR2 signal handler")
            signal.signal(signal.SIGUSR2, self.sighandler_USR2)
        except ValueError:
            # If we get called multiple times, this will generate an exception:
            # ValueError: signal only works in main thread
            # Ignore it as we've already set up the signal handler.
            pass

        self.zem = self.dmd.ZenEventManager
        loadPlugins(self.dmd)
        self.pid = os.getpid()
        self.services = {}
        factory = ReconnectingPBClientFactory(pingPerspective=False)
        self.log.debug("Connecting to %s:%d", self.options.hubhost,
                       self.options.hubport)
        reactor.connectTCP(self.options.hubhost, self.options.hubport, factory)
        self.log.debug("Logging in as %s", self.options.username)
        c = credentials.UsernamePassword(self.options.username,
                                         self.options.password)
        factory.gotPerspective = self.gotPerspective

        def stop(*args):
            reactor.callLater(0, reactor.stop)

        factory.clientConnectionLost = stop
        factory.setCredentials(c)

        self.log.debug("Creating async MetricReporter")
        daemonTags = {
            'zenoss_daemon': 'zenhub_worker_%s' % self.options.workernum,
            'zenoss_monitor': self.options.monitor,
            'internal': True
        }

        def stopReporter():
            if self.metricreporter:
                return self.metricreporter.stop()

        # Order of the shutdown triggers matter. Want to stop reporter first, calling metricWriter() below
        # registers shutdown triggers for the actual metric http and redis publishers.
        reactor.addSystemEventTrigger('before', 'shutdown', stopReporter)
        self.metricreporter = TwistedMetricReporter(
            metricWriter=metricWriter(), tags=daemonTags)
        self.metricreporter.start()
 def __init__(self):
     """
     Initializer that creates an output file, or if nothing is specified
     with the command-line option --outfile, sends to stdout.
     """
     ZCmdBase.__init__(self)
     if not self.options.outfile:
         self.outfile = sys.stdout
     else:
         self.outfile = open(self.options.outfile, 'w')
Exemple #9
0
 def __init__(self):
     """
     Initializer that creates an output file, or if nothing is specified
     with the command-line option --outfile, sends to stdout.
     """
     ZCmdBase.__init__(self)
     if not self.options.outfile:
         self.outfile = sys.stdout
     else:
         self.outfile = open(self.options.outfile, 'w')
Exemple #10
0
    def __init__(self, noopts=0, app=None, keeproot=False):
        """
        Initializer

        @param noopts: don't use sys.argv for command-line options
        @type noopts: boolean
        @param app: app
        @type app: object
        @param keeproot: keeproot
        @type keeproot: boolean
        """
        ZCmdBase.__init__(self, noopts, app, keeproot)
        ContentHandler.__init__(self)
Exemple #11
0
    def __init__(self, noopts=0, app=None, keeproot=False):
        """
        Initializer

        @param noopts: don't use sys.argv for command-line options
        @type noopts: boolean
        @param app: app
        @type app: object
        @param keeproot: keeproot
        @type keeproot: boolean
        """
        ZCmdBase.__init__(self, noopts, app, keeproot)
        ContentHandler.__init__(self)
Exemple #12
0
    def __init__(self, reactor):
        """Initialize a ZenHubWorker instance."""
        ZCmdBase.__init__(self)

        self.__reactor = reactor

        if self.options.profiling:
            self.profiler = ContinuousProfiler('ZenHubWorker', log=self.log)
            self.profiler.start()
            reactor.addSystemEventTrigger(
                'before', 'shutdown', self.profiler.stop,
            )

        self.instanceId = self.options.workerid
        self.current = IDLE
        self.currentStart = 0
        self.numCalls = Metrology.meter("zenhub.workerCalls")

        self.zem = self.dmd.ZenEventManager
        loadPlugins(self.dmd)

        serviceFactory = ServiceReferenceFactory(self)
        self.__registry = HubServiceRegistry(self.dmd, serviceFactory)

        # Configure/initialize the ZenHub client
        creds = UsernamePassword(
            self.options.hubusername, self.options.hubpassword,
        )
        endpointDescriptor = "tcp:{host}:{port}".format(
            host=self.options.hubhost, port=self.options.hubport,
        )
        endpoint = clientFromString(reactor, endpointDescriptor)
        self.__client = ZenHubClient(reactor, endpoint, creds, self, 10.0)

        # Setup Metric Reporting
        self.log.debug("Creating async MetricReporter")
        self._metric_manager = MetricManager(
            daemon_tags={
                'zenoss_daemon': 'zenhub_worker_%s' % self.options.workerid,
                'zenoss_monitor': self.options.monitor,
                'internal': True,
            },
        )
 def __init__(self, *args, **kwargs):
     ZCmdBase.__init__(self, *args, **kwargs)
     self.defaults = {}
     self.emittedDeviceClasses = set()
 def __init__(self, *args, **kwargs):
     ZCmdBase.__init__(self, *args, **kwargs)
     self.defaults = {}
     self.emittedDeviceClasses = set()
 def __init__(self):
     ZCmdBase.__init__(self)
Exemple #16
0
 def __init__(self):
     ZCmdBase.__init__(self)
     if not self.options.useFileDescriptor:
         self.openPrivilegedPort('--ping')
Exemple #17
0
    def __init__(self):
        """
        Hook ourselves up to the Zeo database and wait for collectors
        to connect.
        """
        # list of remote worker references
        self.workers = []
        self.workTracker = {}
        # zenhub execution stats:
        # [count, idle_total, running_total, last_called_time]
        self.executionTimer = collections.defaultdict(lambda: [0, 0.0, 0.0, 0])
        self.workList = _ZenHubWorklist()
        # set of worker processes
        self.worker_processes = set()
        # map of worker pids -> worker processes
        self.workerprocessmap = {}
        self.shutdown = False
        self.counters = collections.Counter()
        self._invalidations_paused = False

        wl = self.workList
        metricNames = {x[0] for x in registry}

        class EventWorkList(Gauge):
            @property
            def value(self):
                return len(wl.eventworklist)

        if 'zenhub.eventWorkList' not in metricNames:
            Metrology.gauge('zenhub.eventWorkList', EventWorkList())

        class ADMWorkList(Gauge):
            @property
            def value(self):
                return len(wl.applyworklist)

        if 'zenhub.admWorkList' not in metricNames:
            Metrology.gauge('zenhub.admWorkList', ADMWorkList())

        class OtherWorkList(Gauge):
            @property
            def value(self):
                return len(wl.otherworklist)

        if 'zenhub.otherWorkList' not in metricNames:
            Metrology.gauge('zenhub.otherWorkList', OtherWorkList())

        class WorkListTotal(Gauge):
            @property
            def value(self):
                return len(wl)

        if 'zenhub.workList' not in metricNames:
            Metrology.gauge('zenhub.workList', WorkListTotal())

        ZCmdBase.__init__(self)
        import Products.ZenHub
        load_config("hub.zcml", Products.ZenHub)
        notify(HubWillBeCreatedEvent(self))

        if self.options.profiling:
            self.profiler = ContinuousProfiler('zenhub', log=self.log)
            self.profiler.start()

        # Worker selection handler
        self.workerselector = WorkerSelector(self.options)
        self.workList.log = self.log

        # make sure we don't reserve more than n-1 workers for events
        maxReservedEventsWorkers = 0
        if self.options.workers:
            maxReservedEventsWorkers = self.options.workers - 1
        if self.options.workersReservedForEvents > maxReservedEventsWorkers:
            self.options.workersReservedForEvents = maxReservedEventsWorkers
            self.log.info(
                "reduced number of workers reserved for sending events to %d",
                self.options.workersReservedForEvents)

        self.zem = self.dmd.ZenEventManager
        loadPlugins(self.dmd)
        self.services = {}

        er = HubRealm(self)
        checker = self.loadChecker()
        pt = portal.Portal(er, [checker])
        interface = '::' if ipv6_available() else ''
        pbport = reactor.listenTCP(self.options.pbport,
                                   pb.PBServerFactory(pt),
                                   interface=interface)
        self.setKeepAlive(pbport.socket)

        xmlsvc = AuthXmlRpcService(self.dmd, checker)
        reactor.listenTCP(self.options.xmlrpcport,
                          server.Site(xmlsvc),
                          interface=interface)

        # responsible for sending messages to the queues
        import Products.ZenMessaging.queuemessaging
        load_config_override('twistedpublisher.zcml',
                             Products.ZenMessaging.queuemessaging)
        notify(HubCreatedEvent(self))
        self.sendEvent(eventClass=App_Start,
                       summary="%s started" % self.name,
                       severity=0)

        self._initialize_invalidation_filters()
        reactor.callLater(self.options.invalidation_poll_interval,
                          self.processQueue)

        self._metric_writer = metricWriter()
        self.rrdStats = self.getRRDStats()

        if self.options.workers:
            self.workerconfig = zenPath(
                'var', 'zenhub', '{}_worker.conf'.format(self._getConf().id))
            self._createWorkerConf()
            for i in range(self.options.workers):
                self.createWorker(i)

            # start cyclic call to giveWorkToWorkers
            reactor.callLater(2, self.giveWorkToWorkers, True)

        # set up SIGUSR2 handling
        try:
            signal.signal(signal.SIGUSR2, self.sighandler_USR2)
        except ValueError:
            # If we get called multiple times, this will generate an exception:
            # ValueError: signal only works in main thread
            # Ignore it as we've already set up the signal handler.
            pass
        # ZEN-26671 Wait at least this duration in secs
        # before signaling a worker process
        self.SIGUSR_TIMEOUT = 5
Exemple #18
0
    def __init__(self):
        PBDaemon.__init__(self, keeproot=True)
        ZCmdBase.__init__(self)

        wants_ssl = self.options.ssl
        if wants_ssl and not HAVE_SSL:
            self.log.error(
                'SSL was requested for Jabber connection, but pyopenssl is not installed.  Please install it and start the xmppBot again.'
            )
            sys.exit(2)

        if not self.options.jabber_pass:
            self.log.error('--jabber_pass is required')
            sys.exit(2)

        if not self.options.jabber_user:
            self.log.error('--jabber_user is required')
            sys.exit(2)

        if self.options.first_user:
            try:
                zenUser, jabberId = self.options.first_user.split(',')
            except ValueError:
                self.log.error(
                    '--first_user option must contain both zenuser and jabberid separated by a comma.  Example: chudler,[email protected]'
                )
                sys.exit(2)

            if zenUser and jabberId:
                self.setFirstUser(zenUser, jabberId)
            else:
                self.log.error(
                    '--first_user option must contain both zenuser and jabberid separated by a comma.  Example: chudler,[email protected]'
                )
                sys.exit(2)

        # taken from zenactions.py
        self.schedule = Schedule(self.options, self.dmd)
        self.actions = []
        self.loadActionRules()
        self.updateCheck = UpdateCheck()

        self.sendEvent(
            Event.Event(device=self.options.monitor,
                        eventClass=App_Start,
                        summary='Jabber Bot started',
                        severity=0,
                        component='xmppbot'))

        password = self.options.jabber_pass
        chatrooms = self.options.chatrooms
        username = self.options.jabber_user
        server = self.options.jabber_host
        port = self.options.jabber_port
        groupServer = self.options.group_server
        realHost = self.options.im_host
        resource = self.options.resource

        self.client = TwistedJabberClient(server=server,
                                          username=username,
                                          password=password,
                                          port=port,
                                          groupServer=groupServer,
                                          chatrooms=chatrooms,
                                          ssl=wants_ssl,
                                          realHost=realHost,
                                          resource=resource)

        path = os.path.realpath(sys.argv[0])
        pluginPath = os.path.dirname(path) + '/Jabber/plugins'
        self.log.info("xmppBot plugins will be loaded from %s" % pluginPath)

        plugins = [
            pluginFile.split('/')[-1].split('.py')[0]
            for pluginFile in glob.glob(os.path.join(pluginPath, '*.py'))
        ]

        self.log.debug("xmppBot loading pugins  %s" % ', '.join(plugins))
        initPluginSystem(pluginPath=pluginPath,
                         plugins=plugins,
                         jabberClient=self.client)

        # connect to the jabber server
        self.log.info('Connecting to server')
        reactor = self.client.connect()

        # begin looking for zenevents
        self.schedule.start()
        self.runCycle()

        reactor.suggestThreadPoolSize(10)
        reactor.run()
    def __init__(self, reactor):
        """Initialize a ZenHubWorker instance."""
        ZCmdBase.__init__(self)

        self.__reactor = reactor

        if self.options.profiling:
            self.profiler = ContinuousProfiler('ZenHubWorker', log=self.log)
            self.profiler.start()
            reactor.addSystemEventTrigger(
                'before',
                'shutdown',
                self.profiler.stop,
            )

        self.current = IDLE
        self.currentStart = 0
        self.numCalls = Metrology.meter("zenhub.workerCalls")

        self.zem = self.dmd.ZenEventManager
        loadPlugins(self.dmd)

        self.__registry = ServiceRegistry()
        loader = ServiceLoader()
        factory = ServiceReferenceFactory(self)
        self.__manager = ServiceManager(self.__registry, loader, factory)

        # Configure/initialize the ZenHub client
        creds = UsernamePassword(
            self.options.hubusername,
            self.options.hubpassword,
        )
        endpointDescriptor = "tcp:{host}:{port}".format(
            host=self.options.hubhost,
            port=self.options.hubport,
        )
        endpoint = clientFromString(reactor, endpointDescriptor)
        self.__client = ZenHubClient(
            reactor,
            endpoint,
            creds,
            self,
            10.0,
            self.worklistId,
        )

        # Setup Metric Reporting
        self.log.debug("Creating async MetricReporter")
        self._metric_manager = MetricManager(daemon_tags={
            'zenoss_daemon':
            'zenhub_worker_%s' % self.instanceId,
            'zenoss_monitor':
            self.options.monitor,
            'internal':
            True,
        }, )
        # Make the metric manager available via zope.component.getUtility
        getGlobalSiteManager().registerUtility(
            self._metric_manager,
            IMetricManager,
            name='zenhub_worker_metricmanager',
        )
 def __init__(self):
     ZCmdBase.__init__(self)
Exemple #21
0
    def __init__(self):
        PBDaemon.__init__(self, keeproot=True)
        ZCmdBase.__init__(self)

        wants_ssl = self.options.ssl
        if wants_ssl and not HAVE_SSL:
            self.log.error('SSL was requested for Jabber connection, but pyopenssl is not installed.  Please install it and start the xmppBot again.')
            sys.exit(2)

        if not self.options.jabber_pass:
            self.log.error('--jabber_pass is required')
            sys.exit(2)

        if not self.options.jabber_user:
            self.log.error('--jabber_user is required')
            sys.exit(2)

        if self.options.first_user:
            try:
                zenUser, jabberId = self.options.first_user.split(',')
            except ValueError:
                self.log.error('--first_user option must contain both zenuser and jabberid separated by a comma.  Example: chudler,[email protected]')
                sys.exit(2)
                
            if zenUser and jabberId:    
                self.setFirstUser(zenUser, jabberId)
            else:
                self.log.error('--first_user option must contain both zenuser and jabberid separated by a comma.  Example: chudler,[email protected]')
                sys.exit(2)

        # taken from zenactions.py
        self.schedule = Schedule(self.options, self.dmd)
        self.actions = []
        self.loadActionRules()
        self.updateCheck = UpdateCheck()

        self.sendEvent(Event.Event(device=self.options.monitor,
        eventClass=App_Start, summary='Jabber Bot started', severity=0, component='xmppbot'))
        self.adapter = JabberAdapter(True)
        password = self.options.jabber_pass
        chatroom = self.options.chatroom
        username = self.options.jabber_user
        host = self.options.jabber_host
        port = self.options.jabber_port
        groupServer = self.options.group_server
        realHost = self.options.im_host
        server = '%s:%s' % (host, port)

        client = TwistedJabberClient(dialogHandler = self.adapter, 
        server = server,
        userId = username, userPassword = password, 
        firstRoom = chatroom, debug = True, 
        groupServer = groupServer, realHost = realHost, wants_ssl = wants_ssl)

        self.adapter.client = client

        path = os.path.realpath(sys.argv[0])
        pluginPath = os.path.dirname(path) + '/Jabber/plugins'
        self.log.info("xmppBot plugins will be loaded from %s" % pluginPath)

        plugins = [pluginFile.split('/')[-1].split('.py')[0] for pluginFile in glob.glob( os.path.join(pluginPath, '*.py') )]
        initPluginSystem({'pluginPath': pluginPath, 'plugins': plugins})

        self.log.info('started')

        # connect to the jabber server
        jabber_reactor = client.connect()

        # begin looking for zenevents
        self.schedule.start()
        self.runCycle()

        # start event loop which will process jabber messages and zenevents
        jabber_reactor.run()
Exemple #22
0
    def __init__(self):
        PBDaemon.__init__(self, keeproot=True)
        ZCmdBase.__init__(self)

        self.log.info('Starting...')

        wants_ssl = self.options.ssl
        if wants_ssl and not HAVE_SSL:
            self.log.error('SSL was requested for Jabber connection, but pyopenssl is not installed.  Please install it and start the xmppBot again.')
            sys.exit(2)

        if not self.options.jabber_pass:
            self.log.error('--jabber_pass is required')
            sys.exit(2)

        if not self.options.jabber_user:
            self.log.error('--jabber_user is required')
            sys.exit(2)

        if self.options.first_user:
            try:
                zenUser, jabberId = self.options.first_user.split(',')
            except ValueError:
                self.log.error('--first_user option must contain both zenuser and jabberid separated by a comma.  Example: chudler,[email protected]')
                sys.exit(2)

            if zenUser and jabberId:
                self.setFirstUser(zenUser, jabberId)
            else:
                self.log.error('--first_user option must contain both zenuser and jabberid separated by a comma.  Example: chudler,[email protected]')
                sys.exit(2)

        # taken from zenactions.py
        self.schedule = Schedule(self.options, self.dmd)
        self.actions = []
        self.loadActionRules()
        self.updateCheck = UpdateCheck()

        self.sendEvent(Event.Event(device=self.options.monitor,
        eventClass=App_Start, summary='Jabber Bot started', severity=0, component='xmppbot'))
        self.adapter = JabberAdapter(True)
        password = self.options.jabber_pass
        chatroom = self.options.chatroom
        username = self.options.jabber_user
        host = self.options.jabber_host
        port = self.options.jabber_port
        groupServer = self.options.group_server
        realHost = self.options.im_host
        server = '%s:%s' % (host, port)

        client = TwistedJabberClient(dialogHandler = self.adapter,
        server = server,
        userId = username, userPassword = password,
        firstRoom = chatroom, debug = True,
        groupServer = groupServer, realHost = realHost, wants_ssl = wants_ssl)

        self.adapter.client = client

        path = os.path.realpath(sys.argv[0])
        pluginPath = os.path.dirname(path) + '/Jabber/plugins'
        self.log.info("xmppBot plugins will be loaded from %s" % pluginPath)

        plugins = [pluginFile.split('/')[-1].split('.py')[0] for pluginFile in glob.glob( os.path.join(pluginPath, '*.py') )]
        initPluginSystem({'pluginPath': pluginPath, 'plugins': plugins})

        self.log.info('started')

        # connect to the jabber server
        jabber_reactor = client.connect()

        # begin looking for zenevents
        self.schedule.start()
        self.runCycle()

        # start event loop which will process jabber messages and zenevents
        jabber_reactor.run()
    def __init__(self):
        PBDaemon.__init__(self, keeproot=True)
        ZCmdBase.__init__(self)

        wants_ssl = self.options.ssl
        if wants_ssl and not HAVE_SSL:
            self.log.error('SSL was requested for Jabber connection, but pyopenssl is not installed.  Please install it and start the xmppBot again.')
            sys.exit(2)

        if not self.options.jabber_pass:
            self.log.error('--jabber_pass is required')
            sys.exit(2)

        if not self.options.jabber_user:
            self.log.error('--jabber_user is required')
            sys.exit(2)

        if self.options.first_user:
            try:
                zenUser, jabberId = self.options.first_user.split(',')
            except ValueError:
                self.log.error('--first_user option must contain both zenuser and jabberid separated by a comma.  Example: chudler,[email protected]')
                sys.exit(2)

            if zenUser and jabberId:
                self.setFirstUser(zenUser, jabberId)
            else:
                self.log.error('--first_user option must contain both zenuser and jabberid separated by a comma.  Example: chudler,[email protected]')
                sys.exit(2)

        # taken from zenactions.py
        self.schedule = Schedule(self.options, self.dmd)
        self.actions = []
        self.loadActionRules()
        self.updateCheck = UpdateCheck()

        self.sendEvent(Event.Event(device=self.options.monitor,
        eventClass=App_Start, summary='Jabber Bot started', severity=0, component='xmppbot'))

        password = self.options.jabber_pass
        chatrooms = self.options.chatrooms
        username = self.options.jabber_user
        server = self.options.jabber_host
        port = self.options.jabber_port
        groupServer = self.options.group_server
        realHost = self.options.im_host
        resource = self.options.resource

        self.client = TwistedJabberClient(server=server, username=username, password=password,
                                 port=port,
                                 groupServer=groupServer,
                                 chatrooms=chatrooms, ssl=wants_ssl,
                                 realHost=realHost, resource=resource)

        path = os.path.realpath(sys.argv[0])
        pluginPath = os.path.dirname(path) + '/Jabber/plugins'
        self.log.info("xmppBot plugins will be loaded from %s" % pluginPath)

        plugins = [pluginFile.split('/')[-1].split('.py')[0] for pluginFile in glob.glob( os.path.join(pluginPath, '*.py') )]

        self.log.debug("xmppBot loading pugins  %s" % ', '.join(plugins))
        initPluginSystem(pluginPath=pluginPath, plugins=plugins, jabberClient=self.client)

        # connect to the jabber server
        self.log.info('Connecting to server')
        reactor = self.client.connect()

        # begin looking for zenevents
        self.schedule.start()
        self.runCycle()

        reactor.suggestThreadPoolSize(10)
        reactor.run()