2006-03-27 05:37:27 +02:00
|
|
|
<?php
|
2008-08-22 20:07:32 +02:00
|
|
|
|
2009-06-08 20:15:58 +02:00
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
2020-11-27 13:52:35 +01:00
|
|
|
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
2009-06-08 20:15:58 +02:00
|
|
|
// Please see http://pandorafms.org for full contribution list
|
2006-07-09 16:20:10 +02:00
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
2008-04-03 17:43:34 +02:00
|
|
|
// as published by the Free Software Foundation for version 2.
|
2006-07-09 16:20:10 +02:00
|
|
|
// 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.
|
2010-04-05 17:54:17 +02:00
|
|
|
global $config;
|
2006-03-27 05:37:27 +02:00
|
|
|
|
2010-04-05 17:54:17 +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) {
|
|
|
|
// Calculate alerts fired
|
|
|
|
$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']);
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$filter = get_parameter('filter', 'all_enabled');
|
|
|
|
$filter_standby = get_parameter('filter_standby', 'all');
|
|
|
|
$offset_simple = (int) get_parameter_get('offset_simple', 0);
|
|
|
|
$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(
|
|
|
|
'ACL Violation',
|
|
|
|
'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
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$action_filter = get_parameter('action_filter', 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
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$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;
|
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);
|
|
|
|
|
2009-01-05 19:41:14 +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);
|
|
|
|
|
|
|
|
$is_extra = enterprise_hook(
|
|
|
|
'policies_is_agent_extra_policy',
|
|
|
|
[$id_agente]
|
|
|
|
);
|
|
|
|
|
|
|
|
if ($is_extra === ENTERPRISE_NOT_HOOK) {
|
|
|
|
$is_extra = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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') && !$is_extra) {
|
|
|
|
db_pandora_audit('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();
|
|
|
|
|
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) {
|
|
|
|
db_pandora_audit('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()) {
|
2020-05-29 11:37:06 +02:00
|
|
|
ui_print_page_header(
|
|
|
|
__('Alert detail'),
|
|
|
|
'images/op_alerts.png',
|
|
|
|
false,
|
|
|
|
''
|
|
|
|
);
|
2019-01-30 16:18:44 +01:00
|
|
|
} else {
|
|
|
|
ui_meta_print_header(__('Alerts view'));
|
|
|
|
}
|
2009-01-05 19:41:14 +01:00
|
|
|
}
|
2007-04-19 20:50:07 +02:00
|
|
|
|
2010-05-03 11:02:18 +02:00
|
|
|
if ($alert_validate) {
|
2019-01-30 16:18:44 +01:00
|
|
|
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') || check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) {
|
|
|
|
validateAlert();
|
|
|
|
} else {
|
|
|
|
ui_print_error_message(__('Insufficient permissions to validate alerts'));
|
|
|
|
}
|
2010-05-03 11:02:18 +02:00
|
|
|
}
|
|
|
|
|
2013-05-28 17:18:41 +02:00
|
|
|
enterprise_hook('open_meta_frame');
|
|
|
|
|
2010-04-06 17:08:08 +02:00
|
|
|
if ($free_search != '') {
|
2019-01-30 16:18:44 +01:00
|
|
|
$whereAlertSimple = 'AND ('.'id_alert_template IN (
|
2018-09-13 16:25:53 +02:00
|
|
|
SELECT id
|
|
|
|
FROM talert_templates
|
2019-01-30 16:18:44 +01:00
|
|
|
WHERE name LIKE "%'.$free_search.'%") OR '.'id_alert_template IN (
|
2018-09-13 16:25:53 +02:00
|
|
|
SELECT id
|
|
|
|
FROM talert_templates
|
|
|
|
WHERE id_alert_action IN (
|
|
|
|
SELECT id
|
|
|
|
FROM talert_actions
|
2019-01-30 16:18:44 +01:00
|
|
|
WHERE name LIKE "%'.$free_search.'%")) OR '.'talert_template_modules.id IN (
|
2018-09-13 16:25:53 +02:00
|
|
|
SELECT id_alert_template_module
|
|
|
|
FROM talert_template_module_actions
|
|
|
|
WHERE id_alert_action IN (
|
|
|
|
SELECT id
|
|
|
|
FROM talert_actions
|
2019-01-30 16:18:44 +01:00
|
|
|
WHERE name LIKE "%'.$free_search.'%")) OR '.'id_agent_module IN (
|
2018-09-13 16:25:53 +02:00
|
|
|
SELECT id_agente_modulo
|
|
|
|
FROM tagente_modulo
|
2019-01-30 16:18:44 +01:00
|
|
|
WHERE nombre LIKE "%'.$free_search.'%") OR '.'id_agent_module IN (
|
2018-09-13 16:25:53 +02:00
|
|
|
SELECT id_agente_modulo
|
|
|
|
FROM tagente_modulo
|
|
|
|
WHERE id_agente IN (
|
|
|
|
SELECT id_agente
|
|
|
|
FROM tagente
|
2019-01-30 16:18:44 +01:00
|
|
|
WHERE nombre LIKE "%'.$free_search.'%") OR alias LIKE "%'.$free_search.'%")'.')';
|
|
|
|
} else {
|
|
|
|
$whereAlertSimple = '';
|
2010-04-06 17:08:08 +02:00
|
|
|
}
|
|
|
|
|
2010-07-21 13:10:58 +02:00
|
|
|
$sortField = get_parameter('sort_field');
|
|
|
|
$sort = get_parameter('sort', 'none');
|
2019-04-05 13:18:38 +02:00
|
|
|
$selected = true;
|
|
|
|
$selectAgentUp = false;
|
|
|
|
$selectAgentDown = false;
|
|
|
|
$selectModuleUp = false;
|
|
|
|
$selectModuleDown = false;
|
|
|
|
$selectTemplateUp = false;
|
|
|
|
$selectTemplateDown = false;
|
2019-06-14 12:54:03 +02:00
|
|
|
$selectLastFiredUp = false;
|
|
|
|
$selectLastFiredDown = false;
|
|
|
|
|
2010-07-21 13:10:58 +02:00
|
|
|
switch ($sortField) {
|
2019-01-30 16:18:44 +01:00
|
|
|
case 'agent':
|
|
|
|
switch ($sort) {
|
|
|
|
case 'up':
|
|
|
|
$selectAgentUp = $selected;
|
|
|
|
$order = [
|
|
|
|
'field' => 'agent_name',
|
|
|
|
'order' => 'ASC',
|
|
|
|
];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'down':
|
|
|
|
$selectAgentDown = $selected;
|
|
|
|
$order = [
|
|
|
|
'field' => 'agent_name',
|
|
|
|
'order' => 'DESC',
|
|
|
|
];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'module':
|
|
|
|
switch ($sort) {
|
|
|
|
case 'up':
|
|
|
|
$selectModuleUp = $selected;
|
|
|
|
$order = [
|
|
|
|
'field' => 'agent_module_name',
|
|
|
|
'order' => 'ASC',
|
|
|
|
];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'down':
|
|
|
|
$selectModuleDown = $selected;
|
|
|
|
$order = [
|
|
|
|
'field' => 'agent_module_name',
|
|
|
|
'order' => 'DESC',
|
|
|
|
];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'template':
|
|
|
|
switch ($sort) {
|
|
|
|
case 'up':
|
|
|
|
$selectTemplateUp = $selected;
|
|
|
|
$order = [
|
|
|
|
'field' => 'template_name',
|
|
|
|
'order' => 'ASC',
|
|
|
|
];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'down':
|
|
|
|
$selectTemplateDown = $selected;
|
|
|
|
$order = [
|
|
|
|
'field' => 'template_name',
|
|
|
|
'order' => 'DESC',
|
|
|
|
];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2019-06-14 12:54:03 +02:00
|
|
|
case 'last_fired':
|
|
|
|
switch ($sort) {
|
|
|
|
case 'up':
|
|
|
|
$selectLastFiredUp = $selected;
|
|
|
|
$order = [
|
|
|
|
'field' => 'last_fired',
|
|
|
|
'order' => 'ASC',
|
|
|
|
];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'down':
|
|
|
|
$selectLastFiredDown = $selected;
|
|
|
|
$order = [
|
|
|
|
'field' => 'last_fired',
|
|
|
|
'order' => 'DESC',
|
|
|
|
];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
default:
|
|
|
|
if ($print_agent) {
|
|
|
|
$selectDisabledUp = '';
|
|
|
|
$selectDisabledDown = '';
|
2019-04-05 13:18:38 +02:00
|
|
|
$selectAgentUp = false;
|
|
|
|
$selectAgentDown = false;
|
2019-01-30 16:18:44 +01:00
|
|
|
$selectModuleUp = $selected;
|
2019-04-05 13:18:38 +02:00
|
|
|
$selectModuleDown = false;
|
|
|
|
$selectTemplateUp = false;
|
|
|
|
$selectTemplateDown = false;
|
2019-06-14 12:54:03 +02:00
|
|
|
$selectLastFiredUp = false;
|
|
|
|
$selectLastFiredDown = false;
|
2019-01-30 16:18:44 +01:00
|
|
|
$order = [
|
|
|
|
'field' => 'agent_module_name',
|
|
|
|
'order' => 'ASC',
|
|
|
|
];
|
|
|
|
} else {
|
|
|
|
$selectDisabledUp = '';
|
|
|
|
$selectDisabledDown = '';
|
2019-04-05 13:18:38 +02:00
|
|
|
$selectAgentUp = false;
|
|
|
|
$selectAgentDown = false;
|
2019-01-30 16:18:44 +01:00
|
|
|
$selectModuleUp = $selected;
|
2019-04-05 13:18:38 +02:00
|
|
|
$selectModuleDown = false;
|
|
|
|
$selectTemplateUp = false;
|
|
|
|
$selectTemplateDown = false;
|
2019-06-14 12:54:03 +02:00
|
|
|
$selectLastFiredUp = false;
|
|
|
|
$selectLastFiredDown = false;
|
2019-01-30 16:18:44 +01:00
|
|
|
$order = [
|
|
|
|
'field' => 'agent_module_name',
|
|
|
|
'order' => 'ASC',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
break;
|
2010-07-21 13:10:58 +02:00
|
|
|
}
|
|
|
|
|
2012-02-08 16:15:20 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
// Add checks for user ACL
|
|
|
|
$groups = users_get_groups($config['id_user'], $access);
|
2012-02-08 16:15:20 +01:00
|
|
|
$id_groups = array_keys($groups);
|
|
|
|
|
|
|
|
if (empty($id_groups)) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$whereAlertSimple .= ' AND (1 = 0) ';
|
|
|
|
} else {
|
|
|
|
$whereAlertSimple .= sprintf(
|
|
|
|
' AND id_agent_module IN (
|
2012-02-08 16:15:20 +01:00
|
|
|
SELECT tam.id_agente_modulo
|
2015-04-30 12:35:42 +02:00
|
|
|
FROM tagente_modulo tam
|
2012-02-08 16:15:20 +01:00
|
|
|
WHERE tam.id_agente IN (SELECT ta.id_agente
|
2018-03-26 12:52:37 +02:00
|
|
|
FROM tagente ta LEFT JOIN tagent_secondary_group tasg ON
|
|
|
|
ta.id_agente = tasg.id_agent
|
|
|
|
WHERE (ta.id_grupo IN (%s) OR tasg.id_group IN (%s)))) ',
|
2019-01-30 16:18:44 +01:00
|
|
|
implode(',', $id_groups),
|
|
|
|
implode(',', $id_groups)
|
|
|
|
);
|
2012-02-08 16:15:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$alerts = [];
|
2020-03-12 10:47:59 +01:00
|
|
|
if ($agent_view_page === true) {
|
|
|
|
$options_simple = ['order' => $order];
|
|
|
|
} else {
|
|
|
|
$options_simple = [
|
|
|
|
'offset' => $offset_simple,
|
|
|
|
'limit' => $config['block_size'],
|
|
|
|
'order' => $order,
|
|
|
|
];
|
|
|
|
}
|
2010-09-17 14:34:11 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$filter_alert = [];
|
2015-06-16 17:53:27 +02:00
|
|
|
if ($filter_standby == 'standby_on') {
|
2019-01-30 16:18:44 +01:00
|
|
|
$filter_alert['disabled'] = $filter;
|
|
|
|
$filter_alert['standby'] = '1';
|
|
|
|
} else if ($filter_standby == 'standby_off') {
|
|
|
|
$filter_alert['disabled'] = $filter;
|
|
|
|
$filter_alert['standby'] = '0';
|
|
|
|
} else {
|
|
|
|
$filter_alert['disabled'] = $filter;
|
2010-09-17 14:34:11 +02:00
|
|
|
}
|
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
|
|
|
|
2016-09-08 16:06:12 +02:00
|
|
|
if (is_metaconsole()) {
|
2019-01-30 16:18:44 +01:00
|
|
|
include_once $config['homedir'].'/enterprise/meta/include/functions_alerts_meta.php';
|
|
|
|
if ($idAgent != 0) {
|
|
|
|
$alerts['alerts_simple'] = alerts_meta_get_alerts($agents, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user);
|
|
|
|
|
|
|
|
$countAlertsSimple = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user);
|
|
|
|
} else {
|
|
|
|
$id_groups = array_keys(
|
|
|
|
users_get_groups($config['id_user'], 'AR', false)
|
|
|
|
);
|
|
|
|
|
|
|
|
$alerts['alerts_simple'] = alerts_meta_get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter);
|
|
|
|
|
|
|
|
$countAlertsSimple = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ($idAgent != 0) {
|
|
|
|
$alerts['alerts_simple'] = agents_get_alerts_simple($idAgent, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter);
|
|
|
|
|
|
|
|
$countAlertsSimple = agents_get_alerts_simple($idAgent, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter);
|
|
|
|
} else {
|
|
|
|
$id_groups = array_keys(
|
|
|
|
users_get_groups($config['id_user'], $access, false)
|
|
|
|
);
|
|
|
|
|
|
|
|
$alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter);
|
|
|
|
|
|
|
|
$countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter);
|
|
|
|
}
|
2013-05-28 17:18:41 +02:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
if ($free_search != '') {
|
|
|
|
$url .= '&free_search='.$free_search;
|
2015-08-05 12:32:02 +02:00
|
|
|
}
|
|
|
|
|
2010-02-19 Sancho Lerena <slerena@artica.es>
* functions_events.php: Fixed typo (switched meaning) in two labels.
* include/styles/pandora.css: Changed background color of th default style.
* include/functions_reporting.php: Improved function get_group_stats(). Now
supports stats from batch-mode and get realtime stats in a more efficient
way. Fixed get_fired_alerts_reporting_table() to avoid problems in external
reporting (PDF & XML).
* include/functions_servers.php: get_server_performance() now uses batch mode
stats reporting, and improved also the realtime stats generation. Same with
function get_server_info().
* include/functions_config.php: Added new config tokens (not fully
implemented yet) for event, trap, strings and audit automatic purge.
* include/functions_ui.php: Added new print_page_header() function to set
the new standard header in all pages, using the "tabbed" format to show
the title, subtitle and other options like help, or custom-tabs for the page
* pandoradb.sql: Added tserver.stat_utimestamp field. Added indexes to
tsession table. Fixed typo in field name in tgroup_stat: agents_uknown to
agents_unknown.
* extensions/ext_backup: New directory to place "deleted" extensions.
* extensions/dbmanager/dbmanager.css: Table names now are in it's original
lowercase/uppercase format.
* extensions/dbmanager.php: Updated headers, and now return "empty" when
a search is empty, instead "error" as before.
* extensions/users_connected.php
extensions/module_groups.php
extensions/plugin_registration.php
extensions/pandora_logs.php
operation/incidents/incident.php
operation/snmpconsole/snmp_view.php
operation/users/user.php
operation/users/user_edit.php
godmode/agentes/planned_downtime.php
operation/events/events.php
operation/visual_console/index.php
operation/agentes/estado_generalagente.php
operation/agentes/estado_agente.php
operation/agentes/exportdata.php
operation/agentes/ver_agente.php
operation/agentes/status_monitor.php
operation/agentes/alerts_status.php
operation/users/user_statistics.php: Added new header format.
* operation/agentes/estado_grupo.php: Removed old group view.
* operation/agentes/tactical.php: Adapted to use new realtime/batch
statistical system. Placed events above server info. Showing only pending
events and other minor changes.
* operation/agentes/group_view.php: NEW screen, replacing old one. Probably
most ugly, but much more useful than before.
* operation/agentes/networkmap.php: Added title.
* operation/messages/message.php: Added title and adding some exists in
code was missing before.
* operation/reporting/reporting_viewer.php: Added title.
* operation/reporting/graph_viewer.php: Added title.
* operation/reporting/custom_reporting.php: Added title.
* operation/servers/view_server.php:
* operation/menu.php: Replaced old group view with new (this has english
name). Removed autorefresh "by default" in server view.
* extras/pandoradb_migrate_v3.0_to_v3.1.sql: Fixed typo.
* extras/pandora_diag.php: Minor changes, removed some info and added other.
* general/logon_ok.php: Minor aesthetic changes.
* general/header.php: Fixed missing ";"
* operation/extensions.php,
godmode/extensions.php: Added support for delete extensions.
* godmode/menu.php: New setup items.
* godmode/setup/setup.php,
godmode/setup/performance.php,
godmode/setup/setup_visuals.php: Reordered setup options, new setup section
"Performance", added new performance options to set "realtime" statistics
or "batchmode" with it's own interval. Some setup info is now shared with
the servers (but it it's any change in setup, servers should be restarted
anyway).
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2390 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-02-19 16:16:03 +01:00
|
|
|
// Filter form
|
2009-01-15 11:21:38 +01:00
|
|
|
if ($print_agent) {
|
2019-01-30 16:18:44 +01:00
|
|
|
if (is_metaconsole()) {
|
|
|
|
ui_toggle(
|
|
|
|
printFormFilterAlert(
|
|
|
|
$id_group,
|
|
|
|
$filter,
|
|
|
|
$free_search,
|
|
|
|
$url,
|
|
|
|
$filter_standby,
|
|
|
|
$tag_filter,
|
|
|
|
false,
|
|
|
|
true,
|
|
|
|
$strict_user
|
|
|
|
),
|
|
|
|
__('Show Options')
|
|
|
|
);
|
|
|
|
;
|
|
|
|
} else {
|
|
|
|
ui_toggle(
|
|
|
|
printFormFilterAlert(
|
|
|
|
$id_group,
|
|
|
|
$filter,
|
|
|
|
$free_search,
|
|
|
|
$url,
|
|
|
|
$filter_standby,
|
|
|
|
$tag_filter,
|
|
|
|
$action_filter,
|
|
|
|
true,
|
|
|
|
$strict_user
|
|
|
|
),
|
|
|
|
__('Alert control filter'),
|
|
|
|
__('Toggle filter(s)'),
|
|
|
|
$access
|
|
|
|
);
|
|
|
|
}
|
2009-01-05 19:41:14 +01:00
|
|
|
}
|
|
|
|
|
2019-04-05 13:18:38 +02:00
|
|
|
// Urls to sort the table.
|
|
|
|
$url_up_agente = $url.'&sort_field=agent&sort=up';
|
|
|
|
$url_down_agente = $url.'&sort_field=agent&sort=down';
|
|
|
|
$url_up_module = $url.'&sort_field=module&sort=up';
|
|
|
|
$url_down_module = $url.'&sort_field=module&sort=down';
|
|
|
|
$url_up_template = $url.'&sort_field=template&sort=up';
|
|
|
|
$url_down_template = $url.'&sort_field=template&sort=down';
|
2019-06-14 12:54:03 +02:00
|
|
|
$url_up_lastfired = $url.'&sort_field=last_fired&sort=up';
|
|
|
|
$url_down_lastfired = $url.'&sort_field=last_fired&sort=down';
|
2019-04-05 13:18:38 +02:00
|
|
|
|
2015-05-25 13:31:10 +02:00
|
|
|
$table = new stdClass();
|
2013-01-10 17:00:30 +01:00
|
|
|
$table->width = '100%';
|
2019-03-27 17:03:55 +01:00
|
|
|
$table->class = 'info_table';
|
2015-04-21 17:26:20 +02:00
|
|
|
$table->cellpadding = '0';
|
|
|
|
$table->cellspacing = '0';
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->size = [];
|
|
|
|
$table->head = [];
|
|
|
|
$table->align = [];
|
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
|
|
|
|
2009-10-21 22:25:26 +02:00
|
|
|
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
2019-01-30 16:18:44 +01:00
|
|
|
if ($print_agent) {
|
2019-04-02 13:42:30 +02:00
|
|
|
if (!is_metaconsole()) {
|
|
|
|
$table->size[8] = '4%';
|
|
|
|
if (check_acl($config['id_user'], $id_group, 'LW') || check_acl($config['id_user'], $id_group, 'LM')) {
|
|
|
|
$table->head[9] = html_print_checkbox('all_validate', 0, false, true, false);
|
|
|
|
$table->align[9] = 'left';
|
|
|
|
$table->size[9] = '5%';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->head[0] = "<span title='".__('Policy')."'>".__('P.').'</span>';
|
|
|
|
|
|
|
|
$table->head[1] = "<span title='".__('Standby')."'>".__('S.').'</span>';
|
|
|
|
|
|
|
|
if (!is_metaconsole()) {
|
|
|
|
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
|
|
|
|
$table->head[2] = "<span title='".__('Force execution')."'>".__('F.').'</span>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$table->head[3] = __('Agent');
|
|
|
|
$table->head[4] = __('Module');
|
|
|
|
$table->head[5] = __('Template');
|
|
|
|
$table->head[6] = __('Action');
|
|
|
|
$table->head[7] = __('Last fired');
|
|
|
|
$table->head[8] = __('Status');
|
|
|
|
|
|
|
|
$table->align[8] = 'center';
|
|
|
|
|
|
|
|
// Sort buttons are only for normal console
|
|
|
|
if (!is_metaconsole()) {
|
2019-04-05 13:18:38 +02:00
|
|
|
$table->head[3] .= ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown);
|
|
|
|
$table->head[4] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
|
|
|
|
$table->head[5] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
|
2019-06-14 12:54:03 +02:00
|
|
|
$table->head[7] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown);
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
|
|
|
} else {
|
2019-04-02 13:42:30 +02:00
|
|
|
if (!is_metaconsole()) {
|
|
|
|
$table->size[7] = '5%';
|
|
|
|
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW') || check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) {
|
2019-04-17 12:57:45 +02:00
|
|
|
$table->head[8] = __('Validate');
|
2019-04-02 13:42:30 +02:00
|
|
|
$table->align[8] = 'left';
|
|
|
|
$table->size[8] = '5%';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->head[0] = "<span title='".__('Policy')."'>".__('P.').'</span>';
|
|
|
|
|
|
|
|
$table->head[1] = "<span title='".__('Standby')."'>".__('S.').'</span>';
|
|
|
|
|
|
|
|
if (!is_metaconsole()) {
|
|
|
|
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') || check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) {
|
|
|
|
$table->head[2] = "<span title='".__('Force execution')."'>".__('F.').'</span>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$table->head[3] = __('Module');
|
|
|
|
$table->head[4] = __('Template');
|
|
|
|
$table->head[5] = __('Action');
|
|
|
|
$table->head[6] = __('Last fired');
|
|
|
|
$table->head[7] = __('Status');
|
2019-04-02 13:42:30 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
$table->align[7] = 'center';
|
|
|
|
|
|
|
|
// Sort buttons are only for normal console
|
|
|
|
if (!is_metaconsole()) {
|
2019-04-05 13:18:38 +02:00
|
|
|
$table->head[3] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
|
|
|
|
$table->head[4] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
|
2019-06-14 12:54:03 +02:00
|
|
|
$table->head[6] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown);
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ($print_agent) {
|
2019-04-02 13:42:30 +02:00
|
|
|
if (!is_metaconsole()) {
|
|
|
|
$table->size[7] = '5%';
|
|
|
|
if (check_acl($config['id_user'], $id_group, 'LW') || check_acl($config['id_user'], $id_group, 'LM')) {
|
2019-04-17 12:57:45 +02:00
|
|
|
$table->head[8] = __('Validate');
|
2019-04-02 13:42:30 +02:00
|
|
|
$table->align[8] = 'left';
|
|
|
|
$table->size[8] = '5%';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->head[0] = "<span title='".__('Standby')."'>".__('S.').'</span>';
|
|
|
|
if (!is_metaconsole()) {
|
|
|
|
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
|
|
|
|
$table->head[1] = "<span title='".__('Force execution')."'>".__('F.').'</span>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$table->head[2] = __('Agent');
|
|
|
|
$table->head[3] = __('Module');
|
|
|
|
$table->head[4] = __('Template');
|
|
|
|
$table->head[5] = __('Action');
|
|
|
|
$table->head[6] = __('Last fired');
|
|
|
|
$table->head[7] = __('Status');
|
|
|
|
|
|
|
|
$table->align[7] = 'center';
|
|
|
|
|
|
|
|
// Sort buttons are only for normal console
|
|
|
|
if (!is_metaconsole()) {
|
2019-04-05 13:18:38 +02:00
|
|
|
$table->head[3] .= ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown);
|
|
|
|
$table->head[4] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
|
|
|
|
$table->head[5] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
|
2019-06-14 12:54:03 +02:00
|
|
|
$table->head[6] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown);
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
|
|
|
} else {
|
2019-04-02 13:42:30 +02:00
|
|
|
if (!is_metaconsole()) {
|
|
|
|
$table->size[6] = '5%';
|
|
|
|
if (check_acl($config['id_user'], $id_group, 'LW') || check_acl($config['id_user'], $id_group, 'LM')) {
|
2019-04-17 12:57:45 +02:00
|
|
|
$table->head[7] = __('Validate');
|
2019-04-02 13:42:30 +02:00
|
|
|
$table->align[7] = 'left';
|
|
|
|
$table->size[7] = '5%';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->head[0] = "<span title='".__('Standby')."'>".__('S.').'</span>';
|
|
|
|
if (!is_metaconsole()) {
|
|
|
|
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
|
|
|
|
$table->head[1] = "<span title='".__('Force execution')."'>".__('F.').'</span>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$table->head[2] = __('Module');
|
|
|
|
$table->head[3] = __('Template');
|
|
|
|
$table->head[4] = __('Action');
|
|
|
|
$table->head[5] = __('Last fired');
|
|
|
|
$table->head[6] = __('Status');
|
|
|
|
|
|
|
|
$table->align[6] = 'center';
|
|
|
|
|
|
|
|
// Sort buttons are only for normal console
|
|
|
|
if (!is_metaconsole()) {
|
2019-04-05 13:18:38 +02:00
|
|
|
$table->head[2] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
|
|
|
|
$table->head[3] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
|
2019-06-14 12:54:03 +02:00
|
|
|
$table->head[5] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown);
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
|
|
|
}
|
2009-10-21 22:25:26 +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
|
|
|
|
2014-07-07 11:55:04 +02:00
|
|
|
|
|
|
|
if ($sortField) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$url .= '&sort_field='.$sortField;
|
|
|
|
$url .= '&sort='.$sort;
|
2014-07-07 11:55:04 +02:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data = [];
|
2009-01-05 19:41:14 +01:00
|
|
|
|
2009-08-07 Miguel de Dios <miguel.dedios@artica.es>
* operation/visual_console/index.php,
pandora_console/operation/users/user.php, operation/incidents/incident.php,
operation/agentes/status_monitor.php, operation/agentes/estado_agente.php,
operation/agentes/alerts_status.php, include/styles/pandora.css,
include/styles/pandora_black.css,include/styles/pandora_blackmetal.css,
include/styles/pandora_width.css, include/styles/pandora_minimal.css,
include/styles/pandora_red.css: the table list now has rows with alternate
colours for easy see the data.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1833 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-10 11:55:53 +02:00
|
|
|
$rowPair = true;
|
|
|
|
$iterator = 0;
|
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
|
|
|
foreach ($alerts['alerts_simple'] as $alert) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$row = ui_format_alert_row($alert, $print_agent, $url, 'font-size: 7pt;');
|
|
|
|
$table->data[] = $row;
|
2009-01-05 19:41:14 +01:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
if (!empty($table->data)) {
|
2019-05-28 18:03:01 +02:00
|
|
|
$class = '';
|
|
|
|
if ($agent_view_page === true) {
|
2019-06-03 10:46:52 +02:00
|
|
|
$class = 'w100p no-padding-imp';
|
2020-03-12 10:47:59 +01:00
|
|
|
printFormFilterAlertAgent($agent_view_page, $free_search, $idAgent);
|
2019-05-28 18:03:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
echo '<form class="'.$class.'" method="post" action="'.$url.'">';
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2020-03-12 10:47:59 +01:00
|
|
|
if ($agent_view_page !== true) {
|
|
|
|
ui_pagination(
|
|
|
|
$countAlertsSimple,
|
|
|
|
$url,
|
|
|
|
$offset_simple,
|
|
|
|
0,
|
|
|
|
false,
|
|
|
|
'offset_simple'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '<div id="alerts_list" style="width:100%;">';
|
2019-01-30 16:18:44 +01:00
|
|
|
html_print_table($table);
|
2020-03-12 10:47:59 +01:00
|
|
|
echo '</div>';
|
|
|
|
|
|
|
|
if ($agent_view_page !== true) {
|
|
|
|
ui_pagination(
|
|
|
|
$countAlertsSimple,
|
|
|
|
$url,
|
|
|
|
$offset_simple,
|
|
|
|
0,
|
|
|
|
false,
|
|
|
|
'offset_simple',
|
|
|
|
true,
|
|
|
|
'pagination-bottom'
|
|
|
|
);
|
|
|
|
}
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
if (!is_metaconsole()) {
|
|
|
|
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
|
|
|
|
if (count($alerts['alerts_simple']) > 0) {
|
|
|
|
echo '<div class="action-buttons" style="width: '.$table->width.';">';
|
|
|
|
html_print_submit_button(__('Validate'), 'alert_validate', false, 'class="sub ok"', false);
|
|
|
|
echo '</div>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '</form>';
|
2019-05-29 18:13:21 +02:00
|
|
|
$alerts_defined = true;
|
2019-01-30 16:18:44 +01:00
|
|
|
} else {
|
|
|
|
ui_print_info_message(['no_close' => true, 'message' => __('No alerts found') ]);
|
2019-05-29 18:13:21 +02:00
|
|
|
$alerts_defined = false;
|
2009-01-05 19:41:14 +01:00
|
|
|
}
|
|
|
|
|
2019-05-28 18:03:01 +02:00
|
|
|
$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',
|
2019-05-29 18:13:21 +02:00
|
|
|
!$alerts_defined,
|
|
|
|
false,
|
|
|
|
'',
|
|
|
|
'white_table_graph_content no-padding-imp'
|
2019-05-28 18:03:01 +02:00
|
|
|
);
|
|
|
|
} else {
|
2020-03-12 10:47:59 +01:00
|
|
|
if (!$print_agent) {
|
|
|
|
printFormFilterAlertAgent($agent_view_page, $free_search, $idAgent);
|
|
|
|
}
|
|
|
|
|
2019-05-28 18:03:01 +02:00
|
|
|
// Dump entire content.
|
|
|
|
echo $html_content;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
// strict user hidden
|
2015-01-15 18:08:58 +01:00
|
|
|
echo '<div id="strict_hidden" style="display:none;">';
|
|
|
|
html_print_input_text('strict_user_hidden', $strict_user);
|
2016-09-08 16:06:12 +02:00
|
|
|
|
|
|
|
html_print_input_text('is_meta_hidden', (int) is_metaconsole());
|
2015-01-15 18:08:58 +01:00
|
|
|
echo '</div>';
|
|
|
|
|
2013-05-28 17:18:41 +02:00
|
|
|
enterprise_hook('close_meta_frame');
|
|
|
|
|
|
|
|
|
2019-02-07 08:59:45 +01:00
|
|
|
ui_require_css_file('cluetip', 'include/styles/js/');
|
2011-04-13 18:11:02 +02:00
|
|
|
ui_require_jquery_file('cluetip');
|
2007-05-21 15:24:17 +02:00
|
|
|
?>
|
2009-01-15 11:21:38 +01:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
$(document).ready (function () {
|
|
|
|
$("a.template_details").cluetip ({
|
|
|
|
arrows: true,
|
|
|
|
attribute: 'href',
|
|
|
|
cluetipClass: 'default'
|
|
|
|
}).click (function () {
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$('[id^=checkbox-validate]').change(function(){
|
|
|
|
if($(this).parent().parent().hasClass('checkselected')){
|
|
|
|
$(this).parent().parent().removeClass('checkselected');
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$(this).parent().parent().addClass('checkselected');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$('[id^=checkbox-all_validate]').change(function(){
|
|
|
|
if ($("#checkbox-all_validate").prop("checked")) {
|
|
|
|
$('[id^=checkbox-validate]').parent().parent().addClass('checkselected');
|
|
|
|
$('[name^=validate]').prop("checked", true);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$('[id^=checkbox-validate]').parent().parent().removeClass('checkselected');
|
|
|
|
$('[name^=validate]').prop("checked", false);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$('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();
|
|
|
|
|
2020-03-12 10:47:59 +01:00
|
|
|
function filter_agent_alerts(){
|
|
|
|
var free_search_alert = $("input[name='free_search_alert']").val();
|
|
|
|
$("#alerts_list").empty();
|
|
|
|
|
|
|
|
jQuery.ajax ({
|
|
|
|
data: {
|
|
|
|
get_agent_alerts_agent_view: 1,
|
|
|
|
id_agent: '<?php echo $idAgent; ?>',
|
|
|
|
free_search_alert: free_search_alert,
|
|
|
|
all_groups: '<?php echo json_encode($all_groups); ?>',
|
|
|
|
sort_field: '<?php echo $sortField; ?>',
|
|
|
|
sort: '<?php echo $sort; ?>',
|
|
|
|
page: 'include/ajax/alert_list.ajax'
|
|
|
|
},
|
|
|
|
type: 'POST',
|
|
|
|
url: "ajax.php",
|
|
|
|
dataType: 'html',
|
|
|
|
success: function (data) {
|
|
|
|
$("#alerts_list").empty();
|
|
|
|
$("#alerts_list").html(data);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-05-28 18:03:01 +02:00
|
|
|
</script>
|