Exemplo n.º 1
0
 def __init__(self, service, port=0, status=event.Event.UP):
     """
     type is the name of the handler (subclass)
     service is a dict containing ip, sysname, netboxid, serviceid,
     version and extra arguments to the handler
     status defaults to up, but can be overridden.
     """
     self.response_time = None
     self._conf = config.serviceconf()
     self.serviceid = service['id']
     self.ip = service['ip']
     self.netboxid = service['netboxid']
     self.args = service['args']
     self.version = service['version']
     self._sysname = service['sysname']
     # This is (and should be) used by all subclasses
     self.port = int(service['args'].get('port', port))
     self.status = status
     self.timestamp = 0
     timeout = self.args.get(
         'timeout',
         self._conf.get("%s timeout" % self.get_type(),
                        self._conf.get('timeout', TIMEOUT)),
     )
     self.timeout = int(timeout)
     self.db = db.db()
     _logger.info("New checker instance for %s:%s ", self.sysname,
                  self.get_type())
     self.runcount = 0
     self.runq = RunQueue.RunQueue()
Exemplo n.º 2
0
 def __init__(self, service, port=0, status=event.Event.UP):
     """
     type is the name of the handler (subclass)
     service is a dict containing ip, sysname, netboxid, serviceid,
     version and extra arguments to the handler
     status defaults to up, but can be overridden.
     """
     self._conf = config.serviceconf()
     self.setServiceid(service['id'])
     self.setIp(service['ip'])
     self.setNetboxid(service['netboxid'])
     self.setArgs(service['args'])
     self.setVersion(service['version'])
     self.setSysname(service['sysname'])
     self.setDeviceid(service['deviceid'])
     # This is (and should be) used by all subclasses
     self.setPort(int(service['args'].get('port', port)))
     self.setStatus(status)
     self.setTimestamp(0)
     timeout = self.getArgs().get(
         'timeout',
         self._conf.get("%s timeout" % self.getType(),
                        self._conf.get('timeout', TIMEOUT)))
     self.setTimeout(int(timeout))
     self.db = db.db()
     debug(
         "New checker instance for %s:%s " %
         (self.getSysname(), self.getType()), 6)
     self.runcount = 0
     self.rq = RunQueue.RunQueue()
Exemplo n.º 3
0
 def __init__(self, **kwargs):
     signal.signal(signal.SIGHUP, self.signalhandler)
     signal.signal(signal.SIGTERM, self.signalhandler)
     self.conf = config.serviceconf()
     init_generic_logging(stderr=True, read_config=True)
     self._deamon = kwargs.get("fork", 1)
     self._isrunning = 1
     self._checkers = []
     self._looptime = int(self.conf.get("checkinterval", 60))
     LOGGER.debug("Setting checkinterval=%i", self._looptime)
     self.db = db.db()
     LOGGER.debug("Reading database config")
     LOGGER.debug("Setting up runqueue")
     self._runqueue = RunQueue.RunQueue(controller=self)
     self.dirty = 1
Exemplo n.º 4
0
 def __init__(self, **kwargs):
     signal.signal(signal.SIGHUP, self.signalhandler)
     signal.signal(signal.SIGTERM, self.signalhandler)
     self.conf=config.serviceconf()
     debug.setDebugLevel(int(self.conf.get('debuglevel', 4)))
     self._deamon=kwargs.get("fork", 1)
     self._isrunning=1
     self._checkers=[]
     self._looptime=int(self.conf.get("checkinterval",60))
     debug.debug("Setting checkinterval=%i"% self._looptime)
     self.db=db.db()
     debug.debug("Reading database config")
     debug.debug("Setting up runqueue")
     self._runqueue=RunQueue.RunQueue(controller=self)
     self.dirty = 1
Exemplo n.º 5
0
    def __init__(self, foreground=False):
        if not foreground:
            signal.signal(signal.SIGHUP, self.signalhandler)
        signal.signal(signal.SIGTERM, self.signalhandler)
        signal.signal(signal.SIGINT, self.signalhandler)

        self.conf = config.serviceconf()
        init_generic_logging(stderr=True, read_config=True)
        self._isrunning = 1
        self._checkers = []
        self._looptime = int(self.conf.get("checkinterval", 60))
        _logger.debug("Setting checkinterval=%i", self._looptime)
        self.db = db.db()
        _logger.debug("Reading database config")
        _logger.debug("Setting up runqueue")
        self._runqueue = RunQueue.RunQueue(controller=self)
        self.dirty = 1