Esempio n. 1
0
 def _init(self, mType="lld"):
     self._name = "zbx"
     self.data = protobix.DataContainer(
         mType,
         self.config.get("zabbix-server").get("host"), 10051)
     self.hostname = Facter()["hostname"]
     self.logger = logging.getLogger(self.__module__)
Esempio n. 2
0
 def __init__(self, run=None, timeout=None, *args, **kwargs):
     super(DiscoveryBase, self).__init__(run=run, *args, **kwargs)
     basepath = os.path.dirname(__file__).rstrip(__name__)
     self.logger = logging.getLogger(self.__module__)
     configfile = ".".join([
         os.path.join(basepath, "conf",
                      kwargs.get("conf", self.__module__.lstrip("_"))),
         "yaml"
     ])
     self.logger.debug("concat configfile: %s", configfile)
     if not os.path.exists(configfile):
         configfile = os.path.join(basepath, "conf",
                                   "discovery.default.yaml")
     self.config = yaml.load(open(configfile, "r"))
     self.interval = self.config.get("interval", 60)
     self.logger.info(
         "Discoverier: %s 's , use config file: %s , interval is: %s",
         __name__, configfile, self.interval)
     if not timeout is None:
         self.timeout = gevent.Timeout(timeout)
     else:
         self.timeout = gevent.Timeout(3)
     self.chanel = Chanels()
     if not self.chanel["discovery"]:
         self.logger.debug("add queue: discovery")
         self.chanel.append("discovery")
     if not self.chanel["discovery-sender"]:
         self.logger.debug("add queue: discovery-sender")
         self.chanel.append("discovery-sender")
     self.data = None
     self._init(*args, **kwargs)
Esempio n. 3
0
 def __init__(self, *args, **kwargs):
     self.logger = logging.getLogger(self.__module__)
     if self.__class__ == SenderBase:
         self.logger.error("class Sender not implemented")
         raise NotImplementedError, "class Sender not implemented"
     basepath = os.path.dirname(__file__).rstrip(__name__)
     configfile = ".".join([
         os.path.join(basepath, "conf", kwargs.get("conf",
                                                   self.__module__)), "yaml"
     ])
     self.config = yaml.load(open(configfile, "r"))
     self._init(**kwargs)
Esempio n. 4
0
 def __init__(self,*args, **kwargs):
     self.logger=logging.getLogger(self.__module__)
     self.suffix=""
     if self.__class__ == CheckerBase:
         raise NotImplementedError,"can not create object of CheckerBase"
     run=kwargs.pop("run",None)
     super(CheckerBase,self).__init__(run=run,*args,**kwargs)
     self._name=kwargs.get("_name")
     if kwargs.get("interval",None):
         self.interval=kwargs.pop("interval")
         self.logger.debug("set new checker interval: %s"%self.interval)
     else:
         self.interval=60
     if kwargs.get("timeout",None):
         t = kwargs.pop("timeout")
         self.logger.info("set timeout to %s s"%t)
         self.timeout=gevent.Timeout(t)
     else:
         self.timeout=gevent.Timeout(3)
     self._init(*args,**kwargs)
Esempio n. 5
0
 def __init__(self, *args, **kwargs):
     self.logger = logging.getLogger(self.__module__)
     super(FacterBase, self).__init__(run=None, *args, **kwargs)
     self._init(*args, **kwargs)
Esempio n. 6
0
 def __init__(self, successor=None):
     self.__successor = successor
     self.logger = logging.getLogger(self.__module__)
Esempio n. 7
0
 def __init__(self, *args, **kwargs):
     self.logger = logging.getLogger(self.__module__)
     self._init(*args, **kwargs)
Esempio n. 8
0
 def __init__(self, *args, **kwargs):
     super(ResultsSender, self).__init__(*args, **kwargs)
     self.logger = logging.getLogger(self.__module__)
Esempio n. 9
0
 def __init__(self, socket=None, data=None):
     self.data = json.dumps(data)
     self.data_len = struct.pack('<Q', len(self.data))
     self.header = "ZBXD\1"
     self.socket = socket
     self.logger = logging.getLogger(__name__)