#10637 Fix group view
This commit is contained in:
parent
bb3a45050f
commit
6a4e8e9a92
|
@ -2648,14 +2648,16 @@ function groups_get_heat_map_agents(array $id_group, float $width=0, float $heig
|
|||
*
|
||||
* @return string Html
|
||||
*/
|
||||
function tactical_groups_get_agents_and_monitoring($id_groups)
|
||||
function tactical_groups_get_agents_and_monitoring($id_groups, $data='')
|
||||
{
|
||||
global $config;
|
||||
|
||||
$data = [
|
||||
'total_agents' => groups_agents_total_counters($id_groups, false)['total'],
|
||||
'monitor_total' => groups_get_total_monitors($id_groups, [], [], false, false, false, false),
|
||||
];
|
||||
if ($data === '') {
|
||||
$data = [
|
||||
'total_agents' => groups_agents_total_counters($id_groups, false)['total'],
|
||||
'monitor_total' => groups_get_total_monitors($id_groups, [], [], false, false, false, false),
|
||||
];
|
||||
}
|
||||
|
||||
// Link URLS
|
||||
$urls = [];
|
||||
|
@ -2703,16 +2705,18 @@ function tactical_groups_get_agents_and_monitoring($id_groups)
|
|||
* @param [type] $id_groups
|
||||
* @return string Html.
|
||||
*/
|
||||
function tactical_groups_get_stats_alerts($id_groups)
|
||||
function tactical_groups_get_stats_alerts($id_groups, $data='')
|
||||
{
|
||||
global $config;
|
||||
|
||||
$alerts = groups_monitor_alerts_total_counters($id_groups, false);
|
||||
$data = [
|
||||
'monitor_alerts' => $alerts['total'],
|
||||
'monitor_alerts_fired' => $alerts['fired'],
|
||||
if ($data === '') {
|
||||
$alerts = groups_monitor_alerts_total_counters($id_groups, false);
|
||||
$data = [
|
||||
'monitor_alerts' => $alerts['total'],
|
||||
'monitor_alerts_fired' => $alerts['fired'],
|
||||
|
||||
];
|
||||
];
|
||||
}
|
||||
|
||||
$urls = [];
|
||||
$urls['monitor_alerts'] = $config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&ag_group='.$id_groups[0];
|
||||
|
@ -2780,17 +2784,19 @@ function tactical_groups_get_stats_alerts($id_groups)
|
|||
* @param boolean $data_agents
|
||||
* @return void
|
||||
*/
|
||||
function groups_get_stats_modules_status($id_groups, $graph_width=250, $graph_height=150, $links=false, $data_agents=false)
|
||||
function groups_get_stats_modules_status($id_groups, $graph_width=250, $graph_height=150, $links=false, $data_agents=false, $data='')
|
||||
{
|
||||
global $config;
|
||||
|
||||
$data = [
|
||||
'monitor_critical' => groups_get_critical_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_warning' => groups_get_warning_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_ok' => groups_get_normal_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_unknown' => groups_get_unknown_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_not_init' => groups_get_not_init_monitors($id_groups, [], [], false, false, false, false),
|
||||
];
|
||||
if ($data === '') {
|
||||
$data = [
|
||||
'monitor_critical' => groups_get_critical_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_warning' => groups_get_warning_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_ok' => groups_get_normal_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_unknown' => groups_get_unknown_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_not_init' => groups_get_not_init_monitors($id_groups, [], [], false, false, false, false),
|
||||
];
|
||||
}
|
||||
|
||||
// Link URLS.
|
||||
if ($links === false) {
|
||||
|
|
|
@ -2581,6 +2581,13 @@ function reporting_html_group_report($table, $item, $pdf=0)
|
|||
|
||||
$table->colspan['group_report']['cell'] = 3;
|
||||
$table->cellstyle['group_report']['cell'] = 'text-align: center;';
|
||||
$metaconsole_connected = false;
|
||||
if (is_metaconsole() === true) {
|
||||
$connection = metaconsole_get_connection($item['server_name']);
|
||||
if (metaconsole_connect($connection) == NOERR) {
|
||||
$metaconsole_connected = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($item['subtitle'] === 'All') {
|
||||
$group_id = [];
|
||||
|
@ -2649,6 +2656,10 @@ function reporting_html_group_report($table, $item, $pdf=0)
|
|||
);
|
||||
}
|
||||
|
||||
if ($metaconsole_connected === true) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
$graph_width = 280;
|
||||
$graph_height = 250;
|
||||
|
||||
|
@ -2664,19 +2675,39 @@ function reporting_html_group_report($table, $item, $pdf=0)
|
|||
$out .= '<tr>';
|
||||
$out .= '<td style="word-wrap:break-word; text-align: left;">
|
||||
<fieldset>
|
||||
<legend>'.__('Group Description').'</legend>'.$description.'</fieldset>
|
||||
<legend>'.__('Group Description').'</legend> '.$description.'</fieldset>
|
||||
</td>';
|
||||
|
||||
$out .= '<td>';
|
||||
$out .= tactical_groups_get_stats_alerts($group_id);
|
||||
|
||||
$data = [
|
||||
'monitor_alerts' => $item['data']['group_stats']['monitor_alerts'],
|
||||
'monitor_alerts_fired' => $item['data']['group_stats']['monitor_alerts_fired'],
|
||||
|
||||
];
|
||||
|
||||
$out .= tactical_groups_get_stats_alerts($group_id, $data);
|
||||
$out .= '</td>';
|
||||
$out .= '</tr>';
|
||||
$out .= '<tr>';
|
||||
$out .= '<td>';
|
||||
$out .= tactical_groups_get_agents_and_monitoring($group_id);
|
||||
|
||||
$data = [
|
||||
'total_agents' => $item['data']['group_stats']['total_agents'],
|
||||
'monitor_total' => $item['data']['group_stats']['monitor_checks'],
|
||||
];
|
||||
|
||||
$out .= tactical_groups_get_agents_and_monitoring($group_id, $data);
|
||||
$out .= '</td>';
|
||||
$out .= '<td>';
|
||||
$out .= groups_get_stats_modules_status($group_id);
|
||||
|
||||
$data = [
|
||||
'monitor_critical' => $item['data']['group_stats']['monitor_critical'],
|
||||
'monitor_warning' => $item['data']['group_stats']['monitor_warning'],
|
||||
'monitor_ok' => $item['data']['group_stats']['monitor_ok'],
|
||||
'monitor_unknown' => $item['data']['group_stats']['monitor_unknown'],
|
||||
'monitor_not_init' => $item['data']['group_stats']['monitor_not_init'],
|
||||
];
|
||||
$out .= groups_get_stats_modules_status($group_id, 250, 150, false, false, $data);
|
||||
$out .= '</td>';
|
||||
$out .= '</tr>';
|
||||
$out .= '<tr>';
|
||||
|
|
Loading…
Reference in New Issue