#11255 Fixed monitor health in metaconsole

This commit is contained in:
Daniel Maya 2023-05-18 15:28:58 +02:00
parent 03dcf88023
commit 35847a2942
2 changed files with 4 additions and 4 deletions

View File

@ -12095,7 +12095,7 @@ function reporting_get_stats_indicators($data, $width=280, $height=20, $html=tru
$table_ind->data[] = $tdata; $table_ind->data[] = $tdata;
$tdata[0] = '<fieldset class="databox tactical_set"> $tdata[0] = '<fieldset class="databox tactical_set">
<legend>'.__('Module sanityX').ui_print_help_tip(sprintf(__('%d Not inited monitors'), (int) $data['monitor_not_init']), true).'</legend>'.progress_bar($data['module_sanity'], $width, $height, $data['module_sanity'].'% '.__('of total modules inited'), 0).'</fieldset>'; <legend>'.__('Module sanity').ui_print_help_tip(sprintf(__('%d Not inited monitors'), (int) $data['monitor_not_init']), true).'</legend>'.progress_bar($data['module_sanity'], $width, $height, $data['module_sanity'].'% '.__('of total modules inited'), 0).'</fieldset>';
$table_ind->rowclass[] = ''; $table_ind->rowclass[] = '';
$table_ind->data[] = $tdata; $table_ind->data[] = $tdata;

View File

@ -278,8 +278,8 @@ function tactical_get_data(
// Get total count of monitors for this group, except disabled. // Get total count of monitors for this group, except disabled.
$list['_monitor_checks_'] = ($list['_monitors_not_init_'] + $list['_monitors_unknown_'] + $list['_monitors_warning_'] + $list['_monitors_critical_'] + $list['_monitors_ok_']); $list['_monitor_checks_'] = ($list['_monitors_not_init_'] + $list['_monitors_unknown_'] + $list['_monitors_warning_'] + $list['_monitors_critical_'] + $list['_monitors_ok_']);
// Calculate not_normal monitors // Calculate not_normal monitors.
$list['_monitor_not_normal_'] = ($list[$i]['_monitor_checks_'] - $list['_monitors_ok_']); $list['_monitor_not_normal_'] = ($list['_monitor_checks_'] - $list['_monitors_ok_']);
if ($list['_monitor_not_normal_'] > 0 && $list['_monitor_checks_'] > 0) { if ($list['_monitor_not_normal_'] > 0 && $list['_monitor_checks_'] > 0) {
$list['_monitor_health_'] = format_numeric((100 - ($list['_monitor_not_normal_'] / ($list['_monitor_checks_'] / 100))), 1); $list['_monitor_health_'] = format_numeric((100 - ($list['_monitor_not_normal_'] / ($list['_monitor_checks_'] / 100))), 1);
@ -293,7 +293,7 @@ function tactical_get_data(
$list['_module_sanity_'] = 100; $list['_module_sanity_'] = 100;
} }
if (isset($list[$i]['_alerts_'])) { if (isset($list['_alerts_'])) {
if ($list['_monitors_alerts_fired_'] > 0 && $list['_alerts_'] > 0) { if ($list['_monitors_alerts_fired_'] > 0 && $list['_alerts_'] > 0) {
$list['_alert_level_'] = format_numeric((100 - ($list['_monitors_alerts_fired_'] / ($list['_alerts_'] / 100))), 1); $list['_alert_level_'] = format_numeric((100 - ($list['_monitors_alerts_fired_'] / ($list['_alerts_'] / 100))), 1);
} else { } else {