예제 #1
0
    def __init__(self):
        from kafka import SimpleProducer, KafkaClient
        from kafka.common import LeaderNotAvailableError
        self.kafka_client = KafkaClient(config.KAFKA_SERVER)
        self.kafka = SimpleProducer(self.kafka_client)

        self.head = HeadBuilder("db", "type", "tom", config.DB_NAME)
        try:
            self.kafka.send_messages(config.KAFKA_TOPIC, b"creating topic")
        except LeaderNotAvailableError:
            time.sleep(1)
예제 #2
0
    def __init__(self):
        oids = config.SNMP_OIDS
        utils.check_dir()

        self.head = HeadBuilder("_index", "_type", "_id", config.ES_INDEX)

        self.event_id = 1
        self.event_log = open(utils.event_log + ".es", "w", encoding="utf-8")

        for oid in oids:
            file_name = utils.log_dir + "/" + oid._name() + "_log.es"
            log = open(file_name, "w", encoding="utf-8")
            self.files[oid.oid_id] = log
            self.indices[oid._name()] = 0
예제 #3
0
    def __init__(self):
        utils.check_dir()

        self.head = HeadBuilder("_index", "_type", "_id", config.DB_NAME)

        self.session_log = open(utils.session_log + ".es",
                                "w",
                                encoding="utf-8")
        self.session_info()

        self.cpu_sys_id = 1
        self.cpu_system_log = open(utils.cpu_sys_log + ".es",
                                   "w",
                                   encoding="utf-8")
        self.cpu_proc_id = 1
        self.cpu_proc_log = open(utils.cpu_proc_log + ".es",
                                 "w",
                                 encoding="utf-8")

        self.mem_sys_id = 1
        self.mem_system_log = open(utils.mem_sys_log + ".es",
                                   "w",
                                   encoding="utf-8")
        self.mem_proc_id = 1
        self.mem_proc_log = open(utils.mem_proc_log + ".es",
                                 "w",
                                 encoding="utf-8")

        self.io_sys_id = 1
        self.io_system_log = open(utils.io_sys_log + ".es",
                                  "w",
                                  encoding="utf-8")

        self.proc_info_id = 1
        self.proc_info_log = open(utils.proc_info_log + ".es",
                                  "w",
                                  encoding="utf-8")
        self.event_id = 1
        self.event_log = open(utils.event_log + ".es", "w", encoding="utf-8")