Include modules not init in total monitors count on tactical view

This commit is contained in:
Calvo 2021-07-19 13:20:00 +02:00
parent 9183110028
commit a8c0ba8e78
6 changed files with 11 additions and 6 deletions

View File

@ -64,6 +64,8 @@ $data['monitor_critical'] = (int) $all_data['_monitors_critical_'];
$data['monitor_not_normal'] = (int) $all_data['_monitor_not_normal_'];
$data['monitor_alerts'] = (int) $all_data['_monitors_alerts_'];
$data['monitor_alerts_fired'] = (int) $all_data['_monitors_alerts_fired_'];
$data['monitor_total'] = (int) $all_data['_monitor_total_'];
$data['total_agents'] = (int) $all_data['_total_agents_'];

View File

@ -10675,11 +10675,11 @@ function reporting_get_stats_agents_monitors($data)
if ($mobile) {
$urls = [];
$urls['total_agents'] = 'index.php?page=agents';
$urls['monitor_checks'] = 'index.php?page=modules';
$urls['monitor_total'] = 'index.php?page=modules';
} else {
$urls = [];
$urls['total_agents'] = $config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60';
$urls['monitor_checks'] = $config['homeurl'].'index.php?sec=view&sec2=operation/agentes/status_monitor&refr=60&status=-1';
$urls['monitor_total'] = $config['homeurl'].'index.php?sec=view&sec2=operation/agentes/status_monitor&refr=60&status=-1';
}
// Agents and modules table
@ -10701,8 +10701,8 @@ function reporting_get_stats_agents_monitors($data)
}
$tdata[3] = html_print_image('images/module.png', true, ['title' => __('Monitor checks'), 'class' => 'invert_filter'], false, false, false, true);
$tdata[4] = $data['monitor_checks'] <= 0 ? '-' : $data['monitor_checks'];
$tdata[4] = '<a class="big_data" href="'.$urls['monitor_checks'].'">'.$tdata[4].'</a>';
$tdata[4] = $data['monitor_total'] <= 0 ? '-' : $data['monitor_total'];
$tdata[4] = '<a class="big_data" href="'.$urls['monitor_total'].'">'.$tdata[4].'</a>';
/*
Hello there! :)
@ -10710,7 +10710,7 @@ function reporting_get_stats_agents_monitors($data)
You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
*/
if ($data['total_agents']) {
if (($data['monitor_checks'] / $data['total_agents'] > 100) && !enterprise_installed()) {
if (($data['monitor_total'] / $data['total_agents'] > 100) && !enterprise_installed()) {
$tdata[5] = "<div id='monitorcheckmodal' class='publienterprise' title='Community version' ><img data-title='".__('Enterprise version not installed')."' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
}
}

View File

@ -415,7 +415,7 @@ function tactical_get_data($id_user=false, $user_strict=false, $acltags, $return
$total_agentes = agents_get_agents(false, ['count(DISTINCT id_agente) as total_agents'], 'AR', false, false, 1);
$list['_total_agents_'] = $total_agentes[0]['total_agents'];
$list['_monitor_total_'] = ($list['_monitors_not_init_'] + $list['_monitors_unknown_'] + $list['_monitors_warning_'] + $list['_monitors_critical_'] + $list['_monitors_ok_']);
$list['_monitor_checks_'] = ($list['_monitors_unknown_'] + $list['_monitors_warning_'] + $list['_monitors_critical_'] + $list['_monitors_ok_']);
// Calculate not_normal monitors

View File

@ -339,6 +339,7 @@ class TacticalWidget extends Widget
$data['monitor_not_normal'] = (int) $all_data['_monitor_not_normal_'];
$data['monitor_alerts'] = (int) $all_data['_monitors_alerts_'];
$data['monitor_alerts_fired'] = (int) $all_data['_monitors_alerts_fired_'];
$data['monitor_total'] = (int) $all_data['_monitor_total_'];
$data['total_agents'] = (int) $all_data['_total_agents_'];

View File

@ -120,6 +120,7 @@ class Tactical
$data['monitor_not_normal'] = (int) $all_data['_monitor_not_normal_'];
$data['monitor_alerts'] = (int) $all_data['_monitors_alerts_'];
$data['monitor_alerts_fired'] = (int) $all_data['_monitors_alerts_fired_'];
$data['monitor_total'] = (int) $all_data['_monitor_total_'];
$data['total_agents'] = (int) $all_data['_total_agents_'];

View File

@ -98,6 +98,7 @@ $data['monitor_critical'] = (int) $all_data['_monitors_critical_'];
$data['monitor_not_normal'] = (int) $all_data['_monitor_not_normal_'];
$data['monitor_alerts'] = (int) $all_data['_monitors_alerts_'];
$data['monitor_alerts_fired'] = (int) $all_data['_monitors_alerts_fired_'];
$data['monitor_total'] = (int) $all_data['_monitor_total_'];
$data['total_agents'] = (int) $all_data['_total_agents_'];