pandorafms/pandora_console/operation/agentes/alerts_status.php

615 lines
17 KiB
PHP
Raw Normal View History

<?php
2021-01-14 19:08:01 +01:00
/**
* Alerts Status
*
* @category Alerts
* @package Pandora FMS
* @subpackage Alert Status View
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
global $config;
2022-10-03 10:16:00 +02:00
// Login check.
check_login();
2007-04-19 Sancho Lerena <slerena@artica.es> * pandora.css: added some classes for graphical input buttons. * languages/language_en.php: More strings to go ! * include/config.php: Deleted from repo, now has no sense. * pandoradb.sql: Added `alert_text` to talerta_agent for new text alerts. Added tables for custom graphs and reporting: tgraph, tgraph_source, treport, and treport_content. * operation/users/user.php: Fixed problem with last Raul's commit. * godmode/usuarios/lista_usuarios.php: Fixed problem with last Raul's commit. * operation/agentes/estado_alertas.php: Code cleanup. Implemented render for text alerts. * operation/agentes/datos_agente.php: Fixed small bug with text output. * operation/agentes/datos_agente_calendar.php: Added contribution from Leandro Doctors. Need to work on it before use several problems detected. * operation/servers/view_server.php: Fixed some bugs. * operation/reporting/graph_viewer.php: Added viewer for custom graphs. * operation/reporting/custom_reporting.php: Initial code, not finished yet. * operation/reporting/graph_builder.php: Work for modules in the same agent, several problems, but works. * operation/menu.php: Updated options for new reporting menu. * reporting/stat_win.php: New menu is great :-) * general/login_page.php: Updated login page. * godmode/agentes/alert_manager.php, configurar_agente.php: New code for text alerts and better user help. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@433 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-19 20:50:07 +02:00
2012-07-10 Miguel de Dios <miguel.dedios@artica.es> * install.php, operation/reporting/reporting_xml.php, operation/netflow/nf_live_view.php, operation/netflow/nf_view.php, operation/tree.php, operation/agentes/gis_view.php, operation/agentes/estado_monitores.php, operation/agentes/networkmap.php, operation/agentes/datos_agente.php, operation/agentes/alerts_status.php, operation/menu.php, operation/snmpconsole/snmp_view.php, operation/users/user_edit.php, godmode/groups/configure_group.php, godmode/groups/configure_modu_group.php, godmode/agentes/module_manager_editor_prediction.php, godmode/servers/manage_recontask.php, godmode/alerts/alert_compounds.php, godmode/alerts/configure_alert_template.php, godmode/alerts/alert_special_days.php, godmode/setup/links.php, godmode/setup/os.php, godmode/users/configure_profile.php, godmode/events/events.php, godmode/massive/massive_delete_modules.php, godmode/massive/massive_edit_modules.php, godmode/massive/massive_standby_alerts.php, godmode/massive/massive_add_action_alerts.php, godmode/massive/massive_enable_disable_alerts.php, godmode/massive/massive_operations.php, godmode/massive/massive_delete_profiles.php, godmode/modules/manage_network_components.php, godmode/modules/manage_nc_groups.php, godmode/reporting/graph_builder.php, godmode/reporting/reporting_builder.item_editor.php, include/functions_menu.php, include/functions_visual_map.php, include/functions_db.php: cleaned source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6759 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-07-10 12:38:02 +02:00
if (is_ajax()) {
include_once 'include/functions_reporting.php';
$get_alert_fired = get_parameter('get_alert_fired', 0);
if ($get_alert_fired) {
2022-10-03 10:16:00 +02:00
// Calculate alerts fired.
$data_reporting = reporting_get_group_stats();
echo $data_reporting['monitor_alerts_fired'];
}
return;
}
require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/operation/agentes/alerts_status.functions.php';
require_once $config['homedir'].'/include/functions_users.php';
$isFunctionPolicies = enterprise_include_once('include/functions_policies.php');
2009-01-15 Esteban Sanchez <estebans@artica.es> * include/styles/menu.css: Changed the z-index property of the menu which was overlapped in some cases. * include/functions.php: format_alert_row() moved to functions_ui.php * include/functions_ui.php: Added format_alert_row() from function.php * include/functions_agents.php: Added to repository. * include/functions_alerts.php: Added new functions get_alerts_agent_module_disabled(), set_alerts_agent_module_force_execution(), get_alerts_agent_module_last_fired(). * include/functions_db.php, operation/agentes/estado_agente.php, operation/agentes/networkmap.php: Style correction. * include/functions_reporting.php: Use new functions_agent.php. Added a bit of documentation and style correction. * godmode/alerts/alert_templates.php: Improved a bit the template tooltip. * operation/agentes/alerts_status.php: Added to repository. New interface to list agent alerts. * operation/agentes/estado_alertas.php: Removed from repository. Replaced by alert_status.php. * operation/agentes/ver_agente.php: Removed flag_alert code snippet. Use new files added. Style correction. * operation/menu.php: Old files references replaced by new ones. * index.php: Removed build and pandora version references. * pandoradb.sql: Removed useless module_type field in talert_templates. * pandoradb_migrate_20_to_21.sql: Removed duplicate fields addition. Fixed some warnings. Added custom_id field to tagente. Style correction. * include/config_process.php: Updated build version. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1344 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-15 11:21:38 +01:00
2015-01-15 18:08:58 +01:00
$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
2023-01-31 11:51:00 +01:00
$disabled = get_parameter('disabled', 'all_enabled');
2022-07-15 12:15:37 +02:00
$filter_standby = get_parameter('standby', 'all');
$id_group = (int) get_parameter('ag_group', 0);
// 0 is the All group (selects all groups)
$free_search = get_parameter('free_search', '');
2017-12-11 16:07:39 +01:00
$user_tag_array = tags_get_user_tags($config['id_user'], 'AR', true);
2017-12-11 16:07:39 +01:00
2018-02-26 13:42:28 +01:00
if ($user_tag_array) {
$user_tag_array = array_values(array_keys($user_tag_array));
$user_tag = '';
foreach ($user_tag_array as $key => $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(
2022-01-20 10:55:23 +01:00
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Alert view'
);
include 'general/noaccess.php';
exit;
}
}
2018-02-26 13:42:28 +01:00
} else {
$tag_filter = get_parameter('tag_filter', 0);
2017-12-11 16:07:39 +01:00
}
2015-01-15 18:08:58 +01:00
if ($tag_filter) {
if ($id_group && $strict_user) {
$tag_filter = 0;
}
2015-01-15 18:08:58 +01:00
}
2007-04-19 Sancho Lerena <slerena@artica.es> * pandora.css: added some classes for graphical input buttons. * languages/language_en.php: More strings to go ! * include/config.php: Deleted from repo, now has no sense. * pandoradb.sql: Added `alert_text` to talerta_agent for new text alerts. Added tables for custom graphs and reporting: tgraph, tgraph_source, treport, and treport_content. * operation/users/user.php: Fixed problem with last Raul's commit. * godmode/usuarios/lista_usuarios.php: Fixed problem with last Raul's commit. * operation/agentes/estado_alertas.php: Code cleanup. Implemented render for text alerts. * operation/agentes/datos_agente.php: Fixed small bug with text output. * operation/agentes/datos_agente_calendar.php: Added contribution from Leandro Doctors. Need to work on it before use several problems detected. * operation/servers/view_server.php: Fixed some bugs. * operation/reporting/graph_viewer.php: Added viewer for custom graphs. * operation/reporting/custom_reporting.php: Initial code, not finished yet. * operation/reporting/graph_builder.php: Work for modules in the same agent, several problems, but works. * operation/menu.php: Updated options for new reporting menu. * reporting/stat_win.php: New menu is great :-) * general/login_page.php: Updated login page. * godmode/agentes/alert_manager.php, configurar_agente.php: New code for text alerts and better user help. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@433 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-19 20:50:07 +02:00
2022-07-15 12:15:37 +02:00
$action_filter = get_parameter('action', 0);
2016-06-28 14:55:13 +02:00
$sec2 = get_parameter_get('sec2');
$sec2 = safe_url_extraclean($sec2);
2012-07-10 Miguel de Dios <miguel.dedios@artica.es> * install.php, operation/reporting/reporting_xml.php, operation/netflow/nf_live_view.php, operation/netflow/nf_view.php, operation/tree.php, operation/agentes/gis_view.php, operation/agentes/estado_monitores.php, operation/agentes/networkmap.php, operation/agentes/datos_agente.php, operation/agentes/alerts_status.php, operation/menu.php, operation/snmpconsole/snmp_view.php, operation/users/user_edit.php, godmode/groups/configure_group.php, godmode/groups/configure_modu_group.php, godmode/agentes/module_manager_editor_prediction.php, godmode/servers/manage_recontask.php, godmode/alerts/alert_compounds.php, godmode/alerts/configure_alert_template.php, godmode/alerts/alert_special_days.php, godmode/setup/links.php, godmode/setup/os.php, godmode/users/configure_profile.php, godmode/events/events.php, godmode/massive/massive_delete_modules.php, godmode/massive/massive_edit_modules.php, godmode/massive/massive_standby_alerts.php, godmode/massive/massive_add_action_alerts.php, godmode/massive/massive_enable_disable_alerts.php, godmode/massive/massive_operations.php, godmode/massive/massive_delete_profiles.php, godmode/modules/manage_network_components.php, godmode/modules/manage_nc_groups.php, godmode/reporting/graph_builder.php, godmode/reporting/reporting_builder.item_editor.php, include/functions_menu.php, include/functions_visual_map.php, include/functions_db.php: cleaned source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6759 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-07-10 12:38:02 +02:00
$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);
2015-01-15 18:08:58 +01:00
2023-01-31 11:51:00 +01:00
$url = 'index.php?sec='.$sec.'&sec2='.$sec2.'&refr='.$refr.'&disabled='.$disabled.'&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);
2009-01-15 Esteban Sanchez <estebans@artica.es> * include/styles/menu.css: Changed the z-index property of the menu which was overlapped in some cases. * include/functions.php: format_alert_row() moved to functions_ui.php * include/functions_ui.php: Added format_alert_row() from function.php * include/functions_agents.php: Added to repository. * include/functions_alerts.php: Added new functions get_alerts_agent_module_disabled(), set_alerts_agent_module_force_execution(), get_alerts_agent_module_last_fired(). * include/functions_db.php, operation/agentes/estado_agente.php, operation/agentes/networkmap.php: Style correction. * include/functions_reporting.php: Use new functions_agent.php. Added a bit of documentation and style correction. * godmode/alerts/alert_templates.php: Improved a bit the template tooltip. * operation/agentes/alerts_status.php: Added to repository. New interface to list agent alerts. * operation/agentes/estado_alertas.php: Removed from repository. Replaced by alert_status.php. * operation/agentes/ver_agente.php: Removed flag_alert code snippet. Use new files added. Style correction. * operation/menu.php: Old files references replaced by new ones. * index.php: Removed build and pandora version references. * pandoradb.sql: Removed useless module_type field in talert_templates. * pandoradb_migrate_20_to_21.sql: Removed duplicate fields addition. Fixed some warnings. Added custom_id field to tagente. Style correction. * include/config_process.php: Updated build version. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1344 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-15 11:21:38 +01:00
}
$idAgent = get_parameter_get('id_agente', 0);
2022-11-02 09:41:07 +01:00
// Show alerts for specific agent.
if ($idAgent != 0) {
$url = $url.'&id_agente='.$idAgent;
$id_group = agents_get_agent_group($idAgent);
2021-06-10 08:45:50 +02:00
// 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);
}
2021-06-10 08:45:50 +02:00
if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AR') && !check_acl_one_of_groups($config['id_user'], $id_group, 'AW')) {
2022-02-01 13:39:18 +01:00
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');
2019-05-28 18:03:01 +02:00
ob_start();
if ($tab == 'main') {
2019-05-28 18:03:01 +02:00
$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) {
2022-02-01 13:39:18 +01:00
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;
2022-11-02 09:41:07 +01:00
// If there is no agent defined, it means that it cannot search for the secondary groups.
$all_groups = [$id_group];
$print_agent = true;
2023-02-28 19:01:37 +01:00
// Header.
ui_print_standard_header(
__('Alert detail'),
'images/op_alerts.png',
false,
'',
false,
[],
[
2021-04-29 13:28:03 +02:00
[
2023-02-28 19:01:37 +01:00
'link' => '',
'label' => __('Monitoring'),
],
[
'link' => '',
'label' => __('Views'),
],
]
);
}
2007-04-19 Sancho Lerena <slerena@artica.es> * pandora.css: added some classes for graphical input buttons. * languages/language_en.php: More strings to go ! * include/config.php: Deleted from repo, now has no sense. * pandoradb.sql: Added `alert_text` to talerta_agent for new text alerts. Added tables for custom graphs and reporting: tgraph, tgraph_source, treport, and treport_content. * operation/users/user.php: Fixed problem with last Raul's commit. * godmode/usuarios/lista_usuarios.php: Fixed problem with last Raul's commit. * operation/agentes/estado_alertas.php: Code cleanup. Implemented render for text alerts. * operation/agentes/datos_agente.php: Fixed small bug with text output. * operation/agentes/datos_agente_calendar.php: Added contribution from Leandro Doctors. Need to work on it before use several problems detected. * operation/servers/view_server.php: Fixed some bugs. * operation/reporting/graph_viewer.php: Added viewer for custom graphs. * operation/reporting/custom_reporting.php: Initial code, not finished yet. * operation/reporting/graph_builder.php: Work for modules in the same agent, several problems, but works. * operation/menu.php: Updated options for new reporting menu. * reporting/stat_win.php: New menu is great :-) * general/login_page.php: Updated login page. * godmode/agentes/alert_manager.php, configurar_agente.php: New code for text alerts and better user help. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@433 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-19 20:50:07 +02:00
$alerts = [];
if ($tab != null) {
$url = $url.'&tab='.$tab;
}
if ($pure) {
$url .= '&pure='.$pure;
}
2023-01-16 01:28:53 +01:00
if (empty($free_search) === false) {
$url .= '&free_search='.$free_search;
}
2023-01-16 01:28:53 +01:00
$columns = [];
$column_names = [];
2023-03-01 13:54:22 +01:00
if ((bool) check_acl($config['id_user'], $id_group, 'LW') === true || (bool) check_acl($config['id_user'], $id_group, 'LM') === true) {
array_unshift(
$column_names,
[
'title' => __('Standby'),
'text' => __('Standby'),
],
);
$columns = array_merge(
['standby'],
$columns
);
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
2023-01-05 13:31:40 +01:00
array_unshift(
$column_names,
2022-07-15 12:15:37 +02:00
[
2023-03-01 13:54:22 +01:00
'title' => __('Policy'),
'text' => __('Policy'),
]
2023-01-05 13:31:40 +01:00
);
2022-07-15 12:15:37 +02:00
2023-01-16 01:28:53 +01:00
$columns = array_merge(
2023-03-01 13:54:22 +01:00
['policy'],
2023-01-16 01:28:53 +01:00
$columns
);
2023-01-05 13:31:40 +01:00
}
2023-01-10 10:18:37 +01:00
2023-03-01 13:54:22 +01:00
if ($print_agent === true) {
2023-01-10 10:18:37 +01:00
array_push(
$column_names,
2023-03-01 13:54:22 +01:00
['text' => 'Agent']
2023-01-10 10:18:37 +01:00
);
$columns = array_merge(
$columns,
2023-03-01 13:54:22 +01:00
['agent_name']
2023-01-10 10:18:37 +01:00
);
2023-01-05 13:31:40 +01:00
}
}
2023-01-10 10:18:37 +01:00
2023-03-01 13:54:22 +01:00
if ((bool) check_acl($config['id_user'], $id_group, 'AW') === true || (bool) check_acl($config['id_user'], $id_group, 'LM') === true) {
array_push(
$column_names,
['text' => 'Module'],
['text' => 'Template'],
['text' => 'Operation'],
['text' => 'Last fired'],
['text' => 'Status']
);
$columns = array_merge(
$columns,
['agent_module_name'],
['template_name'],
['operation'],
['last_fired'],
['status']
);
}
2023-01-05 13:31:40 +01:00
if ($print_agent === true) {
array_push(
$column_names,
['text' => 'Agent']
);
2023-01-05 13:31:40 +01:00
$columns = array_merge(
$columns,
['agent_name']
);
}
2023-01-11 13:46:15 +01:00
if (is_metaconsole() === false) {
if ((bool) check_acl($config['id_user'], $id_group, 'LW') === true || (bool) check_acl($config['id_user'], $id_group, 'LM') === true) {
array_unshift(
$column_names,
[
'title' => __('Validate'),
'text' => html_print_checkbox('all_validate', 0, false, true, false),
'class' => 'dt-left',
'style' => 'max-width: 5%;',
]
);
2023-01-11 13:46:15 +01:00
$columns = array_merge(
['validate'],
$columns
);
}
2019-05-28 18:03:01 +02:00
2023-01-11 13:46:15 +01:00
if ((bool) check_acl($config['id_user'], $id_group, 'AW') === true || (bool) check_acl($config['id_user'], $id_group, 'LM') === true) {
array_push(
$column_names,
[
'title' => __('Actions'),
'text' => __('Actions'),
'style' => 'min-width: 15%;',
]
);
2023-01-11 13:46:15 +01:00
$columns = array_merge(
$columns,
['actions']
);
}
}
2023-01-05 13:31:40 +01:00
if (is_metaconsole() === true) {
$no_sortable_columns = [
0,
1,
5,
];
} else {
if (enterprise_installed() === true) {
$no_sortable_columns = [
0,
1,
2,
3,
7,
];
} else {
$no_sortable_columns = [
0,
1,
2,
6,
];
}
}
2023-01-05 13:31:40 +01:00
$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',
2023-03-10 14:49:38 +01:00
'style' => 'width: 99%',
2023-01-05 13:31:40 +01:00
'columns' => $columns,
'column_names' => $column_names,
'no_sortable_columns' => $no_sortable_columns,
'ajax_url' => 'include/ajax/alert_list.ajax',
2023-03-10 14:49:38 +01:00
'dom_elements' => 'pfrti',
2023-01-05 13:31:40 +01:00
'ajax_data' => [
'get_agent_alerts_datatable' => 1,
'id_agent' => $idAgent,
'url' => $url,
'agent_view_page' => true,
'all_groups' => $all_groups,
],
'drawCallback' => 'alerts_table_controls()',
'order' => [
'field' => 'agent_module_name',
'direction' => 'asc',
],
'zeroRecords' => __('No alerts found'),
'emptyTable' => __('No alerts found'),
'search_button_class' => 'sub filter float-right',
'form' => [
'inputs' => [
2023-01-10 10:18:37 +01:00
[
2023-01-05 13:31:40 +01:00
'label' => __('Free text for search (*):').ui_print_help_tip(
__('Filter by module name, template name or action name'),
2023-01-10 10:18:37 +01:00
true
),
2023-01-05 13:31:40 +01:00
'type' => 'text',
'name' => 'free_search_alert',
'value' => $free_search,
'size' => 20,
'maxlength' => 100,
2022-07-15 12:15:37 +02:00
],
2023-01-05 13:31:40 +01:00
],
'no_toggle' => true,
2023-03-10 14:49:38 +01:00
'class' => 'flex',
2023-01-05 13:31:40 +01:00
],
]
);
} else {
ui_print_datatable(
[
'id' => 'alerts_status_datatable',
'class' => 'info_table',
2023-02-28 19:01:37 +01:00
'style' => 'width: 99%;',
2023-01-05 13:31:40 +01:00
'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' => $idAgent,
'url' => $url,
],
'drawCallback' => 'alerts_table_controls()',
'order' => [
'field' => 'agent_module_name',
'direction' => 'asc',
],
'zeroRecords' => __('No alerts found'),
'emptyTable' => __('No alerts found'),
'search_button_class' => 'sub filter float-right',
2023-02-24 10:46:46 +01:00
'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar',
2023-01-05 13:31:40 +01:00
'form' => [
'html' => printFormFilterAlert(
$id_group,
2023-01-31 11:51:00 +01:00
$disabled,
2023-01-05 13:31:40 +01:00
$free_search,
$url,
$filter_standby,
$tag_filter,
true,
true,
$strict_user
),
],
]
);
}
2023-03-01 13:54:22 +01:00
if (((bool) check_acl($config['id_user'], $id_group, 'AW') === true || (bool) check_acl($config['id_user'], $id_group, 'LM') === true)) {
2023-01-11 13:46:15 +01:00
if ($agent_view_page === true) {
html_print_div(
[
'class' => 'action-buttons pdd_b_10px pdd_r_5px w100p',
'content' => html_print_submit_button(
__('Validate'),
'alert_validate',
false,
[
'icon' => 'wand',
'mode' => 'secondary mini',
],
true
),
]
);
} else {
html_print_action_buttons(
html_print_submit_button(
__('Validate'),
'alert_validate',
false,
[ 'icon' => 'wand' ],
true
),
['type' => 'form_action']
);
2023-01-05 13:31:40 +01:00
}
}
2019-05-28 18:03:01 +02:00
2023-01-11 13:46:15 +01:00
$html_content = ob_get_clean();
2019-05-28 18:03:01 +02:00
2023-01-05 13:31:40 +01:00
if ($agent_view_page === true) {
// Create controlled toggle content.
2023-01-11 13:46:15 +01:00
html_print_div(
[
'class' => 'agent_details_line',
'content' => ui_toggle(
$html_content,
'<span class="subsection_header_title">'.__('Full list of alerts').'</span>',
'status_monitor_agent',
!$alerts_defined,
false,
true,
2023-03-15 17:02:25 +01:00
'',
'',
'box-flat white_table_graph w100p'
2023-01-11 13:46:15 +01:00
),
],
2023-01-05 13:31:40 +01:00
);
} else {
// Dump entire content.
echo $html_content;
}
2019-05-28 18:03:01 +02:00
2023-02-23 17:57:48 +01:00
// Strict user hidden.
echo '<div id="strict_hidden" class="invisible">';
html_print_input_text('strict_user_hidden', $strict_user);
2016-09-08 16:06:12 +02:00
2023-02-23 17:57:48 +01:00
html_print_input_text('is_meta_hidden', (int) is_metaconsole());
echo '</div>';
2015-01-15 18:08:58 +01:00
2023-02-23 17:57:48 +01:00
ui_require_css_file('cluetip', 'include/styles/js/');
ui_require_jquery_file('cluetip');
2023-01-05 13:31:40 +01:00
?>
2009-01-15 Esteban Sanchez <estebans@artica.es> * include/styles/menu.css: Changed the z-index property of the menu which was overlapped in some cases. * include/functions.php: format_alert_row() moved to functions_ui.php * include/functions_ui.php: Added format_alert_row() from function.php * include/functions_agents.php: Added to repository. * include/functions_alerts.php: Added new functions get_alerts_agent_module_disabled(), set_alerts_agent_module_force_execution(), get_alerts_agent_module_last_fired(). * include/functions_db.php, operation/agentes/estado_agente.php, operation/agentes/networkmap.php: Style correction. * include/functions_reporting.php: Use new functions_agent.php. Added a bit of documentation and style correction. * godmode/alerts/alert_templates.php: Improved a bit the template tooltip. * operation/agentes/alerts_status.php: Added to repository. New interface to list agent alerts. * operation/agentes/estado_alertas.php: Removed from repository. Replaced by alert_status.php. * operation/agentes/ver_agente.php: Removed flag_alert code snippet. Use new files added. Style correction. * operation/menu.php: Old files references replaced by new ones. * index.php: Removed build and pandora version references. * pandoradb.sql: Removed useless module_type field in talert_templates. * pandoradb_migrate_20_to_21.sql: Removed duplicate fields addition. Fixed some warnings. Added custom_id field to tagente. Style correction. * include/config_process.php: Updated build version. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1344 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-15 11:21:38 +01:00
<script type="text/javascript">
2022-07-15 12:15:37 +02:00
function alerts_table_controls() {
2023-01-10 10:18:37 +01:00
$("button.template_details").cluetip ({
arrows: true,
attribute: 'href',
cluetipClass: 'default'
}).click (function () {
2023-01-10 10:18:37 +01:00
console.log('click aqui');
return false;
});
$('[id^=checkbox-all_validate]').change(function(){
if ($("#checkbox-all_validate").prop("checked")) {
2022-07-15 12:15:37 +02:00
$("input[id^=checkbox-validate]").prop('checked', true);
}
else{
$('[id^=checkbox-validate]').parent().parent().removeClass('checkselected');
$('[name^=validate]').prop("checked", false);
}
});
2022-07-15 12:15:37 +02:00
}
$(document).ready ( function () {
alerts_table_controls();
2023-03-10 13:02:23 +01:00
$('#button-alert_validate').on('click', function () {
2022-07-15 12:15:37 +02:00
validateAlerts();
});
});
$('table.alert-status-filter #ag_group').change (function () {
var strict_user = $("#text-strict_user_hidden").val();
var is_meta = $("#text-is_meta_hidden").val();
if (($(this).val() != 0) && (strict_user != 0)) {
$("table.alert-status-filter #tag_filter").hide();
if (is_meta) {
$("table.alert-status-filter #table1-0-4").hide();
} else {
$("table.alert-status-filter #table2-0-4").hide();
}
} else {
$("#tag_filter").show();
if (is_meta) {
$("table.alert-status-filter #table1-0-4").show();
} else {
$("table.alert-status-filter #table2-0-4").show();
}
}
}).change();
2022-07-15 12:15:37 +02:00
function validateAlerts() {
var alert_ids = [];
$('[id^=checkbox-validate]:checked').each(function() {
alert_ids.push($(this).val());
});
if (alert_ids.length === 0) {
confirmDialog({
title: "<?php echo __('No alert selected'); ?>",
message: "<?php echo __('You must select at least one alert.'); ?>",
hideCancelButton: true
});
}
$.ajax({
type: "POST",
url: "ajax.php",
data: {
2022-07-15 12:15:37 +02:00
alert_ids: alert_ids,
page: "include/ajax/alert_list.ajax",
alert_validate: 1,
all_groups: <?php echo json_encode($all_groups); ?>,
},
2022-07-15 12:15:37 +02:00
dataType: "json",
success: function (data) {
2022-07-15 12:15:37 +02:00
$("#menu_tab_frame_view").after(data);
var table = $('#alerts_status_datatable').DataTable({
ajax: "data.json"
});
table.ajax.reload();
},
});
2022-07-15 12:15:37 +02:00
}
2019-05-28 18:03:01 +02:00
</script>