$value) { if ($value === end($user_tag_array)) { $user_tag .= $value; } else { $user_tag .= $value.','; } } $tag_filter = get_parameter('tag_filter', $user_tag); $tag_param_validate = explode(',', $tag_filter); foreach ($tag_param_validate as $key => $value) { if (!in_array($value, $user_tag_array)) { db_pandora_audit( AUDIT_LOG_ACL_VIOLATION, 'Trying to access Alert view' ); include 'general/noaccess.php'; exit; } } } else { $tag_filter = get_parameter('tag_filter', 0); } if ($tag_filter) { if ($id_group && $strict_user) { $tag_filter = 0; } } $action_filter = get_parameter('action', 0); $sec2 = get_parameter_get('sec2'); $sec2 = safe_url_extraclean($sec2); $sec = get_parameter_get('sec'); $sec = safe_url_extraclean($sec); $flag_alert = (bool) get_parameter('force_execution', 0); $alert_validate = (bool) get_parameter('alert_validate', 0); $tab = get_parameter_get('tab', null); $refr = (int) get_parameter('refr', 0); $pure = get_parameter('pure', 0); $url = 'index.php?sec='.$sec.'&sec2='.$sec2.'&refr='.$refr.'&filter='.$filter.'&filter_standby='.$filter_standby.'&ag_group='.$id_group.'&tag_filter='.$tag_filter.'&action_filter='.$action_filter; if ($flag_alert == 1 && check_acl($config['id_user'], $id_group, 'AW')) { forceExecution($id_group); } $idAgent = get_parameter_get('id_agente', 0); // Show alerts for specific agent if ($idAgent != 0) { $url = $url.'&id_agente='.$idAgent; $id_group = agents_get_agent_group($idAgent); // All groups is calculated in ver_agente.php. Avoid to calculate it again. if (!isset($all_groups)) { $all_groups = agents_get_all_groups_agent($idAgent, $id_group); } if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AR') && !check_acl_one_of_groups($config['id_user'], $id_group, 'AW')) { db_pandora_audit( AUDIT_LOG_ACL_VIOLATION, 'Trying to access alert view' ); include 'general/noaccess.php'; exit; } $idGroup = false; $print_agent = false; $tab = get_parameter('tab', 'main'); ob_start(); if ($tab == 'main') { $agent_view_page = true; } } else { $agent_a = check_acl($config['id_user'], 0, 'AR'); $agent_w = check_acl($config['id_user'], 0, 'AW'); $access = ($agent_a == true) ? 'AR' : (($agent_w == true) ? 'AW' : 'AR'); if (!$agent_a && !$agent_w) { db_pandora_audit( AUDIT_LOG_ACL_VIOLATION, 'Trying to access alert view' ); include 'general/noaccess.php'; return; } $agents = array_keys( agents_get_group_agents( array_keys( users_get_groups($config['id_user'], $access, false) ), false, 'lower', true ) ); $idGroup = $id_group; // If there is no agent defined, it means that it cannot search for the secondary groups $all_groups = [$id_group]; $print_agent = true; if (is_metaconsole() === false) { // Header. ui_print_standard_header( __('Alert detail'), 'images/op_alerts.png', false, '', false, [], [ [ 'link' => '', 'label' => __('Monitoring'), ], [ 'link' => '', 'label' => __('Views'), ], ] ); } else { ui_meta_print_header(__('Alerts view')); } } enterprise_hook('open_meta_frame'); $alerts = []; if ($tab != null) { $url = $url.'&tab='.$tab; } if ($pure) { $url .= '&pure='.$pure; } if ($free_search != '') { $url .= '&free_search='.$free_search; } $columns = ['standby']; $column_names = [ [ 'title' => 'Standby', 'text' => 'S.', ], ]; if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { array_unshift( $column_names, [ 'title' => 'Policy', 'text' => 'P.', ], ); $columns = array_merge( ['policy'], $columns ); } if (is_metaconsole() === false) { if (check_acl($config['id_user'], $id_group, 'LW') || check_acl($config['id_user'], $id_group, 'LM')) { array_unshift( $column_names, [ 'title' => 'Validate', 'text' => html_print_checkbox('all_validate', 0, false, true, false), 'class' => 'dt-left', ], ); $columns = array_merge( ['validate'], $columns, ); } if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) { array_push( $column_names, [ 'title' => 'Force execution', 'text' => 'F.', ], ); $columns = array_merge( $columns, ['force'] ); } } if ($print_agent === true) { array_push( $column_names, ['text' => 'Agent'], ); $columns = array_merge( $columns, ['agent'], ); } array_push( $column_names, ['text' => 'Module'], ['text' => 'Template'], ['text' => 'Action'], ['text' => 'Last fired'], ['text' => 'Status'], ); $columns = array_merge( $columns, ['module'], ['template'], ['action'], ['lastFired'], ['status'], ); if (is_metaconsole() === true) { $no_sortable_columns = [ 0, 1, 5, ]; } else { $no_sortable_columns = [ 0, 1, 2, 3, 7, ]; } $alert_action = empty(alerts_get_alert_actions_filter()) === false ? alerts_get_alert_actions_filter() : ['' => __('No actions')]; ob_start(); if ($agent_view_page === true) { ui_print_datatable( [ 'id' => 'alerts_status_datatable', 'class' => 'info_table', 'style' => 'width: 100%', 'columns' => $columns, 'column_names' => $column_names, 'no_sortable_columns' => $no_sortable_columns, 'ajax_url' => 'include/ajax/alert_list.ajax', 'ajax_data' => [ 'get_agent_alerts_datatable' => 1, 'id_agent' => $id_agent, 'url' => $url, 'agent_view_page' => true, 'all_groups' => $all_groups, ], 'drawCallback' => 'alerts_table_controls()', 'order' => [ 'field' => 'module', 'direction' => 'asc', ], 'zeroRecords' => __('No alerts found'), 'emptyTable' => __('No alerts found'), 'search_button_class' => 'sub filter float-right', 'form' => [ 'inputs' => [ [ 'label' => __('Free text for search (*):').ui_print_help_tip( __('Filter by module name, template name or action name'), true ), 'type' => 'text', 'name' => 'free_search_alert', 'value' => $free_search, 'size' => 20, 'maxlength' => 100, ], ], 'no_toggle' => true, ], ], ); } else { ui_print_datatable( [ 'id' => 'alerts_status_datatable', 'class' => 'info_table', 'style' => 'width: 100%', 'columns' => $columns, 'column_names' => $column_names, 'no_sortable_columns' => $no_sortable_columns, 'ajax_url' => 'include/ajax/alert_list.ajax', 'ajax_data' => [ 'get_agent_alerts_datatable' => 1, 'id_agent' => $id_agent, 'url' => $url, ], 'drawCallback' => 'alerts_table_controls()', 'order' => [ 'field' => 'module', 'direction' => 'asc', ], 'zeroRecords' => __('No alerts found'), 'emptyTable' => __('No alerts found'), 'search_button_class' => 'sub filter float-right', 'form' => [ 'html' => printFormFilterAlert( $id_group, $filter, $free_search, $url, $filter_standby, $tag_filter, true, true, $strict_user ), ], ], ); } if (!is_metaconsole()) { if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) { echo '
'; html_print_submit_button(__('Validate'), 'alert_validate', false, 'class="sub ok"', false); echo '
'; } } $html_content = ob_get_clean(); if ($agent_view_page === true) { // Create controlled toggle content. ui_toggle( $html_content, __('Full list of alerts'), 'status_monitor_agent', !$alerts_defined, false, '', 'white_table_graph_content no-padding-imp', 'white_table_graph_content' ); } else { // Dump entire content. echo $html_content; } // strict user hidden echo ''; enterprise_hook('close_meta_frame'); ui_require_css_file('cluetip', 'include/styles/js/'); ui_require_jquery_file('cluetip'); ?>