def execute(self): local_connection = LocalConnection() row = local_connection.query_row( "GET status\nColumns: helper_usage_generic average_latency_generic\n" ) helper_usage_perc = 100 * row[0] check_latency_generic = row[1] usage_warn, usage_crit = 85, 95 if helper_usage_perc >= usage_crit: cls = ACResultCRIT elif helper_usage_perc >= usage_warn: cls = ACResultWARN else: cls = ACResultOK yield cls( _("The current check helper usage is %.2f%%") % helper_usage_perc) if check_latency_generic > 1: cls = ACResultCRIT else: cls = ACResultOK yield cls( _("The active check services have an average check latency of %.3fs." ) % (check_latency_generic))
def execute(self): local_connection = LocalConnection() row = local_connection.query_row( "GET status\nColumns: helper_usage_cmk average_latency_cmk\n") helper_usage_perc = 100 * row[0] check_latecy_cmk = row[1] usage_warn, usage_crit = 85, 95 if helper_usage_perc >= usage_crit: cls = ACResultCRIT elif helper_usage_perc >= usage_warn: cls = ACResultWARN else: cls = ACResultOK yield cls( _("The current Check_MK helper usage is %.2f%%. The Check_MK services have an " "average check latency of %.3fs.") % (helper_usage_perc, check_latecy_cmk)) # Only report this as warning in case the user increased the default helper configuration default_values = watolib.ABCConfigDomain.get_all_default_globals() if self._get_effective_global_setting( "cmc_cmk_helpers" ) > default_values["cmc_cmk_helpers"] and helper_usage_perc < 50: yield ACResultWARN( _("The helper usage is below 50%, you may decrease the number of " "Check_MK helpers to reduce the memory consumption."))
def execute(self) -> Iterator[ACResult]: local_connection = LocalConnection() row = local_connection.query_row( "GET status\nColumns: helper_usage_checker average_latency_fetcher\n" ) checker_usage_perc = 100 * row[0] fetcher_latency = row[1] usage_warn, usage_crit = 85, 95 if checker_usage_perc >= usage_crit: cls: Type[ACResult] = ACResultCRIT elif checker_usage_perc >= usage_warn: cls = ACResultWARN else: cls = ACResultOK yield cls( _("The current checker usage is %.2f%%," " The checks have an average check latency of %.3fs.") % (checker_usage_perc, fetcher_latency)) # Only report this as warning in case the user increased the default helper configuration default_values = watolib.ABCConfigDomain.get_all_default_globals() if self._get_effective_global_setting( "cmc_checker_helpers" ) > default_values["cmc_checker_helpers"] and checker_usage_perc < 50: yield ACResultWARN( _("The checker usage is below 50%, you may decrease the number of " "checkers to reduce the memory consumption."))
def execute(self): local_connection = LocalConnection() site_status = local_connection.query_row( "GET status\n" "Columns: livestatus_usage livestatus_threads livestatus_active_connections livestatus_overflows_rate" ) usage, threads, active_connections, overflows_rate = site_status # Microcore has an averaged usage pre-calculated. The Nagios core does not have this column. # Calculate a non averaged usage instead if usage is None: usage = float(active_connections) / float(threads) usage_perc = 100 * usage usage_warn, usage_crit = 80, 95 if usage_perc >= usage_crit: cls = ACResultCRIT elif usage_perc >= usage_warn: cls = ACResultWARN else: cls = ACResultOK yield cls(_("The current livestatus usage is %.2f%%") % usage_perc) yield cls( _("%d of %d connections used") % (active_connections, threads)) # Only available with Microcore if overflows_rate is not None: yield cls( _("You have a connection overflow rate of %.2f/s") % overflows_rate)
def execute(self) -> Iterator[ACResult]: local_connection = LocalConnection() row = local_connection.query_row( "GET status\nColumns: helper_usage_cmk average_latency_cmk\n") helper_usage_perc = 100 * row[0] check_latecy_cmk = row[1] usage_warn, usage_crit = 85, 95 if helper_usage_perc >= usage_crit: cls: Type[ACResult] = ACResultCRIT elif helper_usage_perc >= usage_warn: cls = ACResultWARN else: cls = ACResultOK yield cls( _("The current Checkmk helper usage is %.2f%%. The Checkmk services have an " "average check latency of %.3fs.") % (helper_usage_perc, check_latecy_cmk))