Пример #1
0
    def collect_slave_status(self, priority=2):
        ts = str(int(time.time()))
        if bool(self.mysqldb.get_mysql_ping()):
            if priority == CONS_COLLECT_FOR["CONTINUOUS"] or priority == CONS_COLLECT_FOR["BOOTH"]:

                try:
                    status = self.mysqldb.get_show_slave_status()
                    self.write_key("db.mysql.slave_lagging", status.seconds_behind_master, ts)
                    self.write_key("db.mysql.slave_io_thread", convert_bool_to_int(status.slave_io_running), ts)
                    self.write_key("db.mysql.slave_sql_thread", convert_bool_to_int(status.slave_sql_running), ts)
                    self.write_key("db.mysql.slave_error_number", status.last_errno, ts)
                    self.write_key("db.mysql.slave_error", str(status.last_error).replace("", " "), ts)
                    self.write_key("db.mysql.slave_master_log_file", str(status.master_log_file), ts)
                    self.write_key("db.mysql.slave_read_master_log_pos", str(status.read_master_log_pos), ts)
                    self.write_key("db.mysql.slave_relay_log_file", str(status.relay_log_file), ts)
                    self.write_key("db.mysql.slave_relay_log_pos", str(status.relay_log_pos), ts)
                    self.write_key("db.mysql.slave_relay_master_log_file", str(status.relay_master_log_file), ts)
                    # Log Lagging
                    master_log_file = long(str(status.master_log_file).split('.')[1])
                    relay_master_log_file = long(str(status.relay_master_log_file).split('.')[1])
                    log_laggin = master_log_file - relay_master_log_file
                    self.write_key("db.mysql.slave_relay_log_lagging", log_laggin, ts)
                except:
                    pass
Пример #2
0
 def get_mysql_ping(self):
     try:
         isconnect = self.__my_conn.mysql_isconnected()
         if convert_bool_to_int(isconnect) == 1:
             return 1
         else:
             if not self.double_check:
                 try:
                     self.__my_conn.mysql_connect()
                     self.double_check = True
                     self.get_mysql_ping()
                 except:
                     pass
             else:
                 return 0
     except:
         return 0
Пример #3
0
 def collect_check_host_bigip_pool(self, priority=1):
     if priority == CONS_COLLECT_FOR["INVOKED"]:
         ts = str(int(time.time()))
         self.check_host_bigip_pool()
         self.write_key("net.bigip_f5.exist_in_pool", convert_bool_to_int(self.exist_in_pool), ts)
         self.write_key("net.bigip_f5.enabled_in_poll", convert_bool_to_int(self.enabled_in_poll), ts)