2006-03-27 05:37:27 +02:00
|
|
|
<?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.
|
|
|
|
* ============================================================================
|
|
|
|
*/
|
2008-08-22 20:07:32 +02:00
|
|
|
|
2010-04-05 17:54:17 +02:00
|
|
|
global $config;
|
2006-03-27 05:37:27 +02:00
|
|
|
|
2022-10-03 10:16:00 +02:00
|
|
|
// Login check.
|
2019-01-30 16:18:44 +01:00
|
|
|
check_login();
|
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()) {
|
2019-01-30 16:18:44 +01:00
|
|
|
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.
|
2019-01-30 16:18:44 +01:00
|
|
|
$data_reporting = reporting_get_group_stats();
|
|
|
|
echo $data_reporting['monitor_alerts_fired'];
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
2012-02-01 11:57:43 +01:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
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';
|
2010-04-05 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php: changed some parts of source code in the
functions "format_alert_row" for show column modules in general view. In the
function "pagination" added the parameter $offset_name with default value
'offset' for to use several paginations in one page.
* include/functions_agents.php: added the parameters $limit, $idGroup,
$count in the function "get_agent_alerts_simple", and now you can limit the
rows, search by id group and return the count of rows (without limit). And
in the function "get_agent_alerts_compound" added the same parameters to
another function $idGroup, $limit, $count for similar uses.
* operation/agentes/alerts_status.php: cleaned more parts of source code,
fixed the mad array_merge of alerts, fixed SQL with the searchs IN
(large large list ids), fixed the pagination before loop all rows, now
only loop the block page rows.
* operation/agentes/alerts_status.functions.php: new file with the functions
"forceExecution", "validateAlert", and "printFormFilterAlert".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2542 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-06 14:46:34 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$isFunctionPolicies = enterprise_include_once('include/functions_policies.php');
|
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');
|
2019-01-30 16:18:44 +01:00
|
|
|
$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
|
|
|
|
2019-01-30 16:18:44 +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) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$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,
|
2019-01-30 16:18:44 +01:00
|
|
|
'Trying to access Alert view'
|
|
|
|
);
|
|
|
|
include 'general/noaccess.php';
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
2018-02-26 13:42:28 +01:00
|
|
|
} else {
|
2019-01-30 16:18:44 +01:00
|
|
|
$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) {
|
2019-01-30 16:18:44 +01:00
|
|
|
if ($id_group && $strict_user) {
|
|
|
|
$tag_filter = 0;
|
|
|
|
}
|
2015-01-15 18:08:58 +01:00
|
|
|
}
|
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
|
|
|
|
2019-01-30 16:18:44 +01: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
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$sec = get_parameter_get('sec');
|
|
|
|
$sec = safe_url_extraclean($sec);
|
2009-01-05 19:41:14 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$flag_alert = (bool) get_parameter('force_execution', 0);
|
|
|
|
$alert_validate = (bool) get_parameter('alert_validate', 0);
|
|
|
|
$tab = get_parameter_get('tab', null);
|
2009-03-27 13:03:41 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$refr = (int) get_parameter('refr', 0);
|
2013-11-12 13:42:46 +01:00
|
|
|
$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;
|
2011-05-05 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.sql, pandoradb.postgreSQL.sql,
extras/pandoradb_migrate_v3.2_to_v4.0.sql: changed the default value for
zero/null date "0000-00-00 00:00:00" to "01-01-1970 00:00:00".
* include/functions_graph.php,include/db/postgresql.php,
include/functions_modules.php, include/functions_agents.php,
operation/agentes/alerts_status.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/exportdata.php,
operation/agentes/ver_agente.php, operation/servers/view_server.php,
operation/gis_maps/ajax.php, godmode/db/db_sanity.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/configurar_agente.php, godmode/servers/plugin.php,
godmode/snmpconsole/snmp_alert.php: small fixeds for the support the
PostgreSQL engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4306 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-05-05 17:20:49 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
if ($flag_alert == 1 && check_acl($config['id_user'], $id_group, 'AW')) {
|
|
|
|
forceExecution($id_group);
|
2009-01-15 11:21:38 +01:00
|
|
|
}
|
2009-03-27 13:03:41 +01:00
|
|
|
|
2013-05-28 17:18:41 +02:00
|
|
|
|
2010-04-05 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php: changed some parts of source code in the
functions "format_alert_row" for show column modules in general view. In the
function "pagination" added the parameter $offset_name with default value
'offset' for to use several paginations in one page.
* include/functions_agents.php: added the parameters $limit, $idGroup,
$count in the function "get_agent_alerts_simple", and now you can limit the
rows, search by id group and return the count of rows (without limit). And
in the function "get_agent_alerts_compound" added the same parameters to
another function $idGroup, $limit, $count for similar uses.
* operation/agentes/alerts_status.php: cleaned more parts of source code,
fixed the mad array_merge of alerts, fixed SQL with the searchs IN
(large large list ids), fixed the pagination before loop all rows, now
only loop the block page rows.
* operation/agentes/alerts_status.functions.php: new file with the functions
"forceExecution", "validateAlert", and "printFormFilterAlert".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2542 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-06 14:46:34 +02:00
|
|
|
$idAgent = get_parameter_get('id_agente', 0);
|
|
|
|
|
2022-11-02 09:41:07 +01:00
|
|
|
// Show alerts for specific agent.
|
2010-04-05 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php: changed some parts of source code in the
functions "format_alert_row" for show column modules in general view. In the
function "pagination" added the parameter $offset_name with default value
'offset' for to use several paginations in one page.
* include/functions_agents.php: added the parameters $limit, $idGroup,
$count in the function "get_agent_alerts_simple", and now you can limit the
rows, search by id group and return the count of rows (without limit). And
in the function "get_agent_alerts_compound" added the same parameters to
another function $idGroup, $limit, $count for similar uses.
* operation/agentes/alerts_status.php: cleaned more parts of source code,
fixed the mad array_merge of alerts, fixed SQL with the searchs IN
(large large list ids), fixed the pagination before loop all rows, now
only loop the block page rows.
* operation/agentes/alerts_status.functions.php: new file with the functions
"forceExecution", "validateAlert", and "printFormFilterAlert".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2542 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-06 14:46:34 +02:00
|
|
|
if ($idAgent != 0) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$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.
|
2019-01-30 16:18:44 +01:00
|
|
|
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'
|
|
|
|
);
|
2019-01-30 16:18:44 +01:00
|
|
|
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();
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
if ($tab == 'main') {
|
2019-05-28 18:03:01 +02:00
|
|
|
$agent_view_page = true;
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
|
|
|
} 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'
|
|
|
|
);
|
2019-01-30 16:18:44 +01:00
|
|
|
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.
|
2019-01-30 16:18:44 +01:00
|
|
|
$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'),
|
|
|
|
],
|
|
|
|
]
|
|
|
|
);
|
2009-01-05 19:41:14 +01:00
|
|
|
}
|
2007-04-19 20:50:07 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$alerts = [];
|
2011-05-05 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.sql, pandoradb.postgreSQL.sql,
extras/pandoradb_migrate_v3.2_to_v4.0.sql: changed the default value for
zero/null date "0000-00-00 00:00:00" to "01-01-1970 00:00:00".
* include/functions_graph.php,include/db/postgresql.php,
include/functions_modules.php, include/functions_agents.php,
operation/agentes/alerts_status.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/exportdata.php,
operation/agentes/ver_agente.php, operation/servers/view_server.php,
operation/gis_maps/ajax.php, godmode/db/db_sanity.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/configurar_agente.php, godmode/servers/plugin.php,
godmode/snmpconsole/snmp_alert.php: small fixeds for the support the
PostgreSQL engine.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4306 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-05-05 17:20:49 +02:00
|
|
|
|
2010-04-05 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php: changed some parts of source code in the
functions "format_alert_row" for show column modules in general view. In the
function "pagination" added the parameter $offset_name with default value
'offset' for to use several paginations in one page.
* include/functions_agents.php: added the parameters $limit, $idGroup,
$count in the function "get_agent_alerts_simple", and now you can limit the
rows, search by id group and return the count of rows (without limit). And
in the function "get_agent_alerts_compound" added the same parameters to
another function $idGroup, $limit, $count for similar uses.
* operation/agentes/alerts_status.php: cleaned more parts of source code,
fixed the mad array_merge of alerts, fixed SQL with the searchs IN
(large large list ids), fixed the pagination before loop all rows, now
only loop the block page rows.
* operation/agentes/alerts_status.functions.php: new file with the functions
"forceExecution", "validateAlert", and "printFormFilterAlert".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2542 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-06 14:46:34 +02:00
|
|
|
if ($tab != null) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$url = $url.'&tab='.$tab;
|
2009-01-05 19:41:14 +01:00
|
|
|
}
|
2010-09-17 14:34:11 +02:00
|
|
|
|
2013-11-12 13:42:46 +01:00
|
|
|
if ($pure) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$url .= '&pure='.$pure;
|
2013-11-12 13:42:46 +01:00
|
|
|
}
|
|
|
|
|
2023-01-16 01:28:53 +01:00
|
|
|
if (empty($free_search) === false) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$url .= '&free_search='.$free_search;
|
2015-08-05 12:32:02 +02:00
|
|
|
}
|
|
|
|
|
2023-01-16 01:28:53 +01:00
|
|
|
$columns = [];
|
|
|
|
$column_names = [];
|
2019-01-30 16:18:44 +01:00
|
|
|
|
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']
|
|
|
|
);
|
2019-04-02 13:42:30 +02:00
|
|
|
|
2023-01-05 13:31:40 +01:00
|
|
|
$columns = array_merge(
|
|
|
|
$columns,
|
|
|
|
['agent_name']
|
|
|
|
);
|
|
|
|
}
|
2019-01-30 16:18:44 +01:00
|
|
|
|
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%;',
|
|
|
|
]
|
|
|
|
);
|
2009-01-05 19:41:14 +01:00
|
|
|
|
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%;',
|
|
|
|
]
|
|
|
|
);
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2023-01-11 13:46:15 +01:00
|
|
|
$columns = array_merge(
|
|
|
|
$columns,
|
|
|
|
['actions']
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2020-03-12 10:47:59 +01:00
|
|
|
|
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,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
2020-03-12 10:47:59 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
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
|
|
|
|
),
|
|
|
|
],
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|
2019-01-30 16:18:44 +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)) {
|
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 11:21:38 +01:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
2022-07-15 12:15:37 +02:00
|
|
|
|
|
|
|
function alerts_table_controls() {
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2023-01-10 10:18:37 +01:00
|
|
|
$("button.template_details").cluetip ({
|
2019-01-30 16:18:44 +01:00
|
|
|
arrows: true,
|
|
|
|
attribute: 'href',
|
|
|
|
cluetipClass: 'default'
|
|
|
|
}).click (function () {
|
2023-01-10 10:18:37 +01:00
|
|
|
console.log('click aqui');
|
2019-01-30 16:18:44 +01:00
|
|
|
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);
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
|
|
|
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();
|
|
|
|
});
|
2019-01-30 16:18:44 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
$('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",
|
2020-03-12 10:47:59 +01:00
|
|
|
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); ?>,
|
2020-03-12 10:47:59 +01:00
|
|
|
},
|
2022-07-15 12:15:37 +02:00
|
|
|
dataType: "json",
|
2020-03-12 10:47:59 +01:00
|
|
|
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();
|
|
|
|
},
|
2020-03-12 10:47:59 +01:00
|
|
|
});
|
2022-07-15 12:15:37 +02:00
|
|
|
|
|
|
|
|
2020-03-12 10:47:59 +01:00
|
|
|
}
|
2019-05-28 18:03:01 +02:00
|
|
|
</script>
|