diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 06a3640c7c..c94cf12660 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -12289,3 +12289,7 @@ tr[id^="network_component-plugin-wmi-fields-dynamicMacroRow-"] input, tr[id^="network_component-plugin-snmp-fields-dynamicMacroRow-"] input { width: 100% !important; } + +.group_view_table > tbody > tr > td { + width: 350px !important; +} diff --git a/pandora_console/operation/agentes/group_view.php b/pandora_console/operation/agentes/group_view.php index 34c3fc6936..204f7d937e 100644 --- a/pandora_console/operation/agentes/group_view.php +++ b/pandora_console/operation/agentes/group_view.php @@ -8,7 +8,7 @@ * @version 1.0.0 * @license See below * - * ______ ___ _______ _______ ________ + * ______ ___ _______ _______ ________ * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| * | __/| _ | | _ || _ | _| _ | | ___| |__ | * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| @@ -175,7 +175,182 @@ if ($total_agentes > 0) { $total_not_init = format_numeric((($agents_notinit * 100) / $total_agentes), 2); } -echo ''; +$all_group_id = []; +foreach ($result_groups as $group) { + if ($group['_id_'] !== '0') { + $all_group_id[] = $group['_id_']; + } +} + +$out = ''; +$out .= '
'; +$out .= ''; +$out .= ''; +$out .= ''; +$out .= ''; +$out .= ''; +$out .= ''; +$out .= ''; + +$description = ''; +$odd = false; +$graph_width = 180; +$graph_height = 200; + +foreach ($result_groups as $group) { + if ($group['_id_'] !== '0') { + $description = db_get_value('description', 'tgrupo', 'id_grupo', $group['_id_']); + $icon_url = db_get_value('icon', 'tgrupo', 'id_grupo', $group['_id_']); + $icon = html_print_image( + 'images/'.$icon_url, + true, + [ + 'title' => $group['_name_'], + 'class' => 'main_menu_icon invert_filter', + ] + ); + + $where_event = 'WHERE te.id_grupo = '.$group['_id_']; + $where_os = 'WHERE ta.id_grupo = '.$group['_id_']; + } else { + $description = __('Data view of all groups'); + $icon = ''; + $where_event = 'WHERE te.id_grupo in ('.implode(', ', $all_group_id).')'; + $where_os = 'WHERE ta.id_grupo in ('.implode(', ', $all_group_id).')'; + } + + $group_events = db_get_all_rows_sql( + 'SELECT COUNT(te.id_evento) as count_events, ta.alias + FROM tevento as te + INNER JOIN tagente as ta ON te.id_agente = ta.id_agente '.$where_event.' GROUP BY te.id_agente' + ); + + $group_os = db_get_all_rows_sql( + 'SELECT COUNT(os.name) as count_os, os.name as name_os, ta.id_grupo + FROM tconfig_os as os + INNER JOIN tagente as ta ON ta.id_os = os.id_os '.$where_os.' GROUP by os.name' + ); + + if ($odd === false) { + $out .= ''; + } + + $out .= ''; + $out .= ''; + + if ($odd === true) { + $out .= ''; + $odd = false; + } else { + $odd = true; + } +} + +$out .= ''; +$out .= ''; +$out .= ''; +$out .= '
'.__('Summary of the status groups').'
'; + $out .= '
+ '.$group['_name_'].'   '.$icon.''; + + $out .= ''; + $out .= ''; + $out .= ''; + + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= '
+
+ '.__('Description').''.$description.'
+
'; + if ($group['_id_'] === '0') { + $out .= tactical_groups_get_stats_alerts($all_group_id); + } else { + $out .= tactical_groups_get_stats_alerts($group['_id_']); + } + + $out .= '
'; + if ($group['_id_'] === '0') { + $out .= tactical_groups_get_agents_and_monitoring($all_group_id); + } else { + $out .= tactical_groups_get_agents_and_monitoring($group['_id_']); + } + + $out .= ''; + if ($group['_id_'] === '0') { + $out .= groups_get_stats_modules_status($all_group_id); + } else { + $out .= groups_get_stats_modules_status($group['_id_']); + } + + $out .= '
'.__('Events per agent').''; + + $data = []; + $options = []; + $labels = []; + foreach ($group_events as $value) { + $data[$value['alias']] = $value['count_events']; + $labels[] = io_safe_output($value['alias']); + } + + $options = [ + 'width' => $graph_width, + 'height' => $graph_height, + 'legend' => ['display' => false], + 'labels' => $labels, + ]; + + $out .= '
'.'
'.pie_graph($data, $options).'
'; + $out .= '
'; + $out .= '
'.__('Distribution by so').''; + + $data = []; + $options = []; + $labels = []; + foreach ($group_os as $value) { + $data[$value['name_os']] = $value['count_os']; + $labels[] = io_safe_output($value['name_os']); + } + + $options = [ + 'width' => $graph_width, + 'height' => $graph_height, + 'legend' => ['display' => false], + 'labels' => $labels, + ]; + + $out .= '
'.'
'.pie_graph($data, $options).'
'; + $out .= '
'; + $out .= '
'; + + if (!isset($data['_is_tag_']) && check_acl($config['id_user'], $data['_id_'], 'AW')) { + $out .= ''.html_print_image( + 'images/force@svg.svg', + true, + [ + 'border' => '0', + 'title' => __('Force'), + 'class' => 'main_menu_icon invert_filter', + ] + ).''; + } + + $out .= '
'; + $out .= '
'; + $out .= '
'; + +echo $out; +/* + echo ''; echo ''; echo ''; echo "'; @@ -203,15 +378,15 @@ echo '
".__('Summary of the status groups').'
'; echo ''; echo ''; echo ''; -echo '
'; + echo ''; -if ($count == 1) { + if ($count == 1) { if ($result_groups[0]['_id_'] == 0) { unset($result_groups[0]); } -} + } -if (empty($result_groups) === false) { + if (empty($result_groups) === false) { $pagination = ui_pagination( $count, false, @@ -359,10 +534,10 @@ if (empty($result_groups) === false) { echo ""; if (isset($data['_is_tag_'])) { $link = ""; + href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_']."'>"; } else { - $link = ""; + $link = ""; } if ($data['_id_'] == 0) { @@ -379,10 +554,10 @@ if (empty($result_groups) === false) { echo ""; if (isset($data['_is_tag_'])) { $link = ""; + href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_'].'&status='.AGENT_STATUS_UNKNOWN."'>"; } else { - $link = ""; + $link = ""; } if (($data['_id_'] == 0) && ($agents_unknown != 0)) { @@ -399,10 +574,10 @@ if (empty($result_groups) === false) { echo ""; if (isset($data['_is_tag_'])) { $link = ""; + href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_'].'&status='.AGENT_STATUS_NOT_INIT."'>"; } else { - $link = ""; + $link = ""; } if (($data['_id_'] == 0) && ($agents_notinit != 0)) { @@ -419,10 +594,10 @@ if (empty($result_groups) === false) { echo ""; if (isset($data['_is_tag_'])) { $link = ""; + href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_'].'&status='.AGENT_STATUS_NORMAL."'>"; } else { - $link = ""; + $link = ""; } if (($data['_id_'] == 0) && ($agents_ok != 0)) { @@ -439,10 +614,10 @@ if (empty($result_groups) === false) { echo ""; if (isset($data['_is_tag_'])) { $link = ""; + href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_'].'&status='.AGENT_STATUS_WARNING."'>"; } else { - $link = ""; + $link = ""; } if (($data['_id_'] == 0) && ($agents_warning != 0)) { @@ -459,10 +634,10 @@ if (empty($result_groups) === false) { echo ""; if (isset($data['_is_tag_'])) { $link = ""; + href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_'].'&status='.AGENT_STATUS_CRITICAL."'>"; } else { - $link = ""; + $link = ""; } if (($data['_id_'] == 0) && ($agents_critical != 0)) { @@ -478,11 +653,11 @@ if (empty($result_groups) === false) { // Monitors unknown echo ""; if (!isset($data['_is_tag_'])) { - $link = ""; + $link = ""; } else { - $link = ""; + $link = ""; } if (($data['_id_'] == 0) && ($monitor_unknown != 0)) { @@ -498,11 +673,11 @@ if (empty($result_groups) === false) { // Monitors not init echo ""; if (!isset($data['_is_tag_'])) { - $link = ""; + $link = ""; } else { - $link = ""; + $link = ""; } if (($data['_id_'] == 0) && ($monitor_not_init != 0)) { @@ -518,11 +693,11 @@ if (empty($result_groups) === false) { // Monitors OK echo ""; if (!isset($data['_is_tag_'])) { - $link = ""; + $link = ""; } else { - $link = ""; + $link = ""; } if (($data['_id_'] == 0) && ($monitor_ok != 0)) { @@ -538,11 +713,11 @@ if (empty($result_groups) === false) { // Monitors Warning echo ""; if (!isset($data['_is_tag_'])) { - $link = ""; + $link = ""; } else { - $link = ""; + $link = ""; } if (($data['_id_'] == 0) && ($monitor_warning != 0)) { @@ -558,11 +733,11 @@ if (empty($result_groups) === false) { // Monitors Critical echo ""; if (!isset($data['_is_tag_'])) { - $link = ""; + $link = ""; } else { - $link = ""; + $link = ""; } if (($data['_id_'] == 0) && ($monitor_critical != 0)) { @@ -578,11 +753,11 @@ if (empty($result_groups) === false) { // Alerts fired echo ""; if (!isset($data['_is_tag_'])) { - $link = ""; + $link = ""; } else { - $link = ""; + $link = ""; } if (($data['_id_'] == 0) && ($all_alerts_fired != 0)) { @@ -599,6 +774,7 @@ if (empty($result_groups) === false) { } echo ''; -} else { + } else { ui_print_info_message(__('There are no defined agents')); -} + } +*/