예제 #1
0
    def check_max_connections(self):
        """
            In [1]: 1024 / 200.0
            Out[1]: 5.12

            In [2]: 1024 / 300.0
            Out[2]: 3.4133333333333336

            In [3]: 1024 / 400.0
            Out[3]: 2.56
        """
        innodb_buffer_pool_size = self.body.get('innodb_buffer_pool_size')
        innodb_buffer_pool_size_in_M = innodb_buffer_pool_size / 1024 / 1024.0
        low, up = innodb_buffer_pool_size_in_M / 5.12, innodb_buffer_pool_size_in_M / 2.56
        recommend = innodb_buffer_pool_size_in_M / 3.41

        result = CheckResult.get_result_template(self, CheckResult.high)

        max_connections = self.body.get('max_connections')
        if max_connections < low or max_connections > up:
            result.advise = Advise.max_connection_warning.format(
                max_connections, humanize_bytes(innodb_buffer_pool_size),
                int(low), int(up), int(recommend))
            result.score = -result.score

        self.rs.append(result)
예제 #2
0
    def check_max_connections(self):
        """
            In [1]: 1024 / 200.0
            Out[1]: 5.12

            In [2]: 1024 / 300.0
            Out[2]: 3.4133333333333336

            In [3]: 1024 / 400.0
            Out[3]: 2.56
        """
        innodb_buffer_pool_size = self.body.get('innodb_buffer_pool_size')
        innodb_buffer_pool_size_in_M = innodb_buffer_pool_size / 1024 / 1024.0
        low, up = innodb_buffer_pool_size_in_M / 5.12, innodb_buffer_pool_size_in_M / 2.56
        recommend = innodb_buffer_pool_size_in_M / 3.41

        result = CheckResult.get_result_template(self, CheckResult.high)

        max_connections = self.body.get('max_connections')
        if max_connections < low or max_connections > up:
            result.advise = Advise.max_connection_warning.format(max_connections, humanize_bytes(innodb_buffer_pool_size),
                                                                 int(low), int(up), int(recommend))
            result.score = -result.score

        self.rs.append(result)
    def check_sql_thread(self):
        slave_sql_running = self.body.get("slave_sql_running")
        last_sql_error = self.body.get("last_sql_error")

        result = CheckResult.get_result_template(self, CheckResult.middle)
        if slave_sql_running.lower() != "yes":
            result.advise = Advise.slave_sql_running_error
            result.score = -result.score

        self.rs.append(result)

        result = CheckResult.get_result_template(self, CheckResult.middle)
        if last_sql_error:
            result.advise = Advise.last_sql_error
            result.score = -result.score

        self.rs.append(result)
    def check_sql_thread(self):
        slave_sql_running = self.body.get("slave_sql_running")
        last_sql_error = self.body.get("last_sql_error")

        result = CheckResult.get_result_template(self, CheckResult.middle)
        if slave_sql_running.lower() != "yes":
            result.advise = Advise.slave_sql_running_error
            result.score = -result.score

        self.rs.append(result)

        result = CheckResult.get_result_template(self, CheckResult.middle)
        if last_sql_error:
            result.advise = Advise.last_sql_error
            result.score = -result.score

        self.rs.append(result)
예제 #5
0
    def check_flush_method(self):
        flush_method = self.body.get("innodb_flush_method")

        result = CheckResult.get_result_template(self, CheckResult.middle)
        if flush_method != "O_DIRECT":
            result.advise = Advise.innodb_flush_method(flush_method, "O_DIRECT")
            result.score = -result.score

        self.rs.append(result)
    def check_relay_log_recovery(self):
        relay_log_recovery = self.body.get("relay_log_recovery")

        result = CheckResult.get_result_template(self, CheckResult.middle)
        if relay_log_recovery != "ON":
            result.advise = Advise.relay_log_recovery(relay_log_recovery, "ON")
            result.score = -result.score

        self.rs.append(result)
    def check_relay_log_recovery(self):
        relay_log_recovery = self.body.get("relay_log_recovery")

        result = CheckResult.get_result_template(self, CheckResult.middle)
        if relay_log_recovery != "ON":
            result.advise = Advise.relay_log_recovery(relay_log_recovery, "ON")
            result.score = -result.score

        self.rs.append(result)
예제 #8
0
    def check_innodb_flush_log_at_trx_commit(self):
        innodb_flush_log_at_trx_commit = self.body.get('innodb_flush_log_at_trx_commit')

        result = CheckResult.get_result_template(self, CheckResult.high)
        if innodb_flush_log_at_trx_commit != 1 and innodb_flush_log_at_trx_commit != 3:
            result.advise = Advise.innodb_flush_log_at_trx_commit.format(innodb_flush_log_at_trx_commit, 1)
            result.score = -result.score

        self.rs.append(result)
예제 #9
0
    def check_expire_logs_days(self):
        expire_logs_days = self.body.get('expire_logs_days')

        result = CheckResult.get_result_template(self, CheckResult.middle)

        if expire_logs_days == 0 or expire_logs_days > 7:
            result.advise = Advise.expire_binlog_days_warning.format(expire_logs_days, 7)
            result.score = - result.score

        self.rs.append(result)
예제 #10
0
    def check_sync_binlog(self):
        sync_binlog = self.body.get('sync_binlog')

        result = CheckResult.get_result_template(self, CheckResult.high)

        if sync_binlog == 0:
            result.advise = Advise.sync_binlog_warning.format(sync_binlog, 1)
            result.score = -result.score

        self.rs.append(result)
예제 #11
0
    def check_relay_log_info_repository(self):

        relay_log_info_repository = self.body.get("relay_log_info_repository")

        result = CheckResult.get_result_template(self, CheckResult.middle)
        if relay_log_info_repository != "TABLE":
            result.advise = Advise.relay_log_info_repository(relay_log_info_repository, "TABLE")
            result.score = -result.score

        self.rs.append(result)
예제 #12
0
    def check_flush_method(self):
        flush_method = self.body.get("innodb_flush_method")

        result = CheckResult.get_result_template(self, CheckResult.middle)
        if flush_method != "O_DIRECT":
            result.advise = Advise.innodb_flush_method(flush_method,
                                                       "O_DIRECT")
            result.score = -result.score

        self.rs.append(result)
    def check_relay_log_info_repository(self):

        relay_log_info_repository = self.body.get("relay_log_info_repository")

        result = CheckResult.get_result_template(self, CheckResult.middle)
        if relay_log_info_repository != "TABLE":
            result.advise = Advise.relay_log_info_repository(relay_log_info_repository, "TABLE")
            result.score = -result.score

        self.rs.append(result)
예제 #14
0
    def check_binlog_format(self):
        binlog_format = self.body.get('binlog_format')

        result = CheckResult.get_result_template(self, CheckResult.high)

        if binlog_format != 'ROW':
            result.advise = Advise.binlog_format_warning.format(binlog_format, 'ROW')
            result.score = -result.score

        self.rs.append(result)
예제 #15
0
    def check_innodb_flush_log_at_trx_commit(self):
        innodb_flush_log_at_trx_commit = self.body.get(
            'innodb_flush_log_at_trx_commit')

        result = CheckResult.get_result_template(self, CheckResult.high)
        if innodb_flush_log_at_trx_commit != 1 and innodb_flush_log_at_trx_commit != 3:
            result.advise = Advise.innodb_flush_log_at_trx_commit.format(
                innodb_flush_log_at_trx_commit, 1)
            result.score = -result.score

        self.rs.append(result)
예제 #16
0
    def check_redo_log_file_size(self):
        redo_log_file_size = self.body.get('innodb_log_file_size')
        disk_capacity = self.body.get('disk_capacity')

        result = CheckResult.get_result_template(self, CheckResult.high)
        low, up = self._limit_for_redo_log_file_size()
        if redo_log_file_size < low or redo_log_file_size > up:
            result.advise = Advise.innodb_log_file_size.format(humanize_bytes(disk_capacity),
                                                               humanize_bytes(redo_log_file_size),
                                                               humanize_bytes(low),
                                                               humanize_bytes(up))
            result.score = -result.score

        self.rs.append(result)
예제 #17
0
    def check_redo_log_file_size(self):
        redo_log_file_size = self.body.get('innodb_log_file_size')
        disk_capacity = self.body.get('disk_capacity')

        result = CheckResult.get_result_template(self, CheckResult.high)
        low, up = self._limit_for_redo_log_file_size()
        if redo_log_file_size < low or redo_log_file_size > up:
            result.advise = Advise.innodb_log_file_size.format(
                humanize_bytes(disk_capacity),
                humanize_bytes(redo_log_file_size), humanize_bytes(low),
                humanize_bytes(up))
            result.score = -result.score

        self.rs.append(result)
예제 #18
0
    def check_binlog_size(self):
        binlog_size = self.body.get('binlog_size')
        disk_capacity = self.body.get('disk_capacity')
        percent = 20.0

        result = CheckResult.get_result_template(self, CheckResult.high)

        if binlog_size > disk_capacity * percent / 100:
            result.advise = Advise.binlog_size_too_large.format(humanize_bytes(disk_capacity),
                                                                humanize_bytes(binlog_size),
                                                                percent)
            result.score = -result.score

        self.rs.append(result)