Merge remote-tracking branch 'origin/develop' into ent-8676-consolas-visuales-en-consola-movil
This commit is contained in:
commit
e05d741109
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.760-220308
|
||||
Version: 7.0NG.760-220311
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.760-220308"
|
||||
pandora_version="7.0NG.760-220311"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1015,7 +1015,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.760';
|
||||
use constant AGENT_BUILD => '220308';
|
||||
use constant AGENT_BUILD => '220311';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.760
|
||||
%define release 220308
|
||||
%define release 220311
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.760
|
||||
%define release 220308
|
||||
%define release 220311
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.760"
|
||||
PI_BUILD="220308"
|
||||
PI_BUILD="220311"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{220308}
|
||||
{220311}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.760 Build 220308")
|
||||
#define PANDORA_VERSION ("7.0NG.760 Build 220311")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.760(Build 220308))"
|
||||
VALUE "ProductVersion", "(7.0NG.760(Build 220311))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.760-220308
|
||||
Version: 7.0NG.760-220311
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.760-220308"
|
||||
pandora_version="7.0NG.760-220311"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -36,30 +36,32 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||
).'</div>';
|
||||
|
||||
// ======= Servers List ===============================================
|
||||
$servers_list = '<div id="servers_list">';
|
||||
$servers = [];
|
||||
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
|
||||
if ($servers['all'] != 0) {
|
||||
$servers['up'] = (int) servers_check_status();
|
||||
$servers['down'] = ($servers['all'] - $servers['up']);
|
||||
if ($servers['up'] == 0) {
|
||||
// All Servers down or no servers at all.
|
||||
$servers_check_img = html_print_image('images/header_down_gray.png', true, ['alt' => 'cross', 'class' => 'bot', 'title' => __('All systems').': '.__('Down')]);
|
||||
} else if ($servers['down'] != 0) {
|
||||
// Some servers down.
|
||||
$servers_check_img = html_print_image('images/header_warning_gray.png', true, ['alt' => 'error', 'class' => 'bot', 'title' => $servers['down'].' '.__('servers down')]);
|
||||
} else {
|
||||
// All servers up.
|
||||
$servers_check_img = html_print_image('images/header_ready_gray.png', true, ['alt' => 'ok', 'class' => 'bot', 'title' => __('All systems').': '.__('Ready')]);
|
||||
}
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) {
|
||||
$servers_list = '<div id="servers_list">';
|
||||
$servers = [];
|
||||
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
|
||||
if ($servers['all'] != 0) {
|
||||
$servers['up'] = (int) servers_check_status();
|
||||
$servers['down'] = ($servers['all'] - $servers['up']);
|
||||
if ($servers['up'] == 0) {
|
||||
// All Servers down or no servers at all.
|
||||
$servers_check_img = html_print_image('images/header_down_gray.png', true, ['alt' => 'cross', 'class' => 'bot', 'title' => __('All systems').': '.__('Down')]);
|
||||
} else if ($servers['down'] != 0) {
|
||||
// Some servers down.
|
||||
$servers_check_img = html_print_image('images/header_warning_gray.png', true, ['alt' => 'error', 'class' => 'bot', 'title' => $servers['down'].' '.__('servers down')]);
|
||||
} else {
|
||||
// All servers up.
|
||||
$servers_check_img = html_print_image('images/header_ready_gray.png', true, ['alt' => 'ok', 'class' => 'bot', 'title' => __('All systems').': '.__('Ready')]);
|
||||
}
|
||||
|
||||
unset($servers);
|
||||
// Since this is the header, we don't like to trickle down variables.
|
||||
$servers_check_img_link = '<a class="white" href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60">';
|
||||
$servers_check_img_link .= $servers_check_img;
|
||||
$servers_check_img_link .= '</a>';
|
||||
};
|
||||
$servers_list .= $servers_check_img_link.'</div>';
|
||||
unset($servers);
|
||||
// Since this is the header, we don't like to trickle down variables.
|
||||
$servers_check_img_link = '<a class="white" href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60">';
|
||||
$servers_check_img_link .= $servers_check_img;
|
||||
$servers_check_img_link .= '</a>';
|
||||
};
|
||||
$servers_list .= $servers_check_img_link.'</div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ $(document).ready(function(){
|
|||
var menuType_value = "<?php echo ($_SESSION['menu_type'] ?? ''); ?>";
|
||||
|
||||
if (menuType_value === '' || menuType_value === 'classic') {
|
||||
$('ul.submenu').css('left', '214px');
|
||||
$('ul.submenu').css('left', '214px');
|
||||
}
|
||||
else{
|
||||
$('ul.submenu').css('left', '59px');
|
||||
|
@ -107,7 +107,12 @@ echo '</a></div>';
|
|||
require 'operation/menu.php';
|
||||
require 'godmode/menu.php';
|
||||
|
||||
echo sprintf('<div id="button_collapse" class="button_%s button_collapse"></div>', $menuTypeClass);
|
||||
html_print_div(
|
||||
[
|
||||
'id' => 'button_collapse',
|
||||
'class' => sprintf('button_collapse button_%s', $menuTypeClass),
|
||||
]
|
||||
);
|
||||
|
||||
echo '</div>';
|
||||
// Menu_container.
|
||||
|
@ -122,7 +127,7 @@ if (isset($config['fixed_header']) === true) {
|
|||
<script type="text/javascript" language="javascript">
|
||||
/* <![CDATA[ */
|
||||
|
||||
$('#button_collapse').on('click', function() {
|
||||
$('#button_collapse').on('click', function() {
|
||||
|
||||
if($('#menu_full').hasClass('menu_full_classic')){
|
||||
localStorage.setItem("menuType", "collapsed");
|
||||
|
@ -155,7 +160,7 @@ $('#button_collapse').on('click', function() {
|
|||
|
||||
$('.logo_full').toggle();
|
||||
$('.logo_icon').toggle();
|
||||
$('#menu_full').toggleClass('menu_full_classic menu_full_collapsed');
|
||||
$('#menu_full').toggleClass('menu_full_classic menu_full_collapsed');
|
||||
$('#button_collapse').toggleClass('button_classic button_collapsed');
|
||||
$('div#title_menu').toggleClass('title_menu_classic title_menu_collapsed');
|
||||
$('div#page').toggleClass('page_classic page_collapsed');
|
||||
|
@ -389,9 +394,9 @@ $(document).ready(function() {
|
|||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
});
|
||||
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
});
|
||||
|
||||
$('div.menu>ul>li>ul>li>ul>li>a').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
|
@ -399,7 +404,7 @@ $(document).ready(function() {
|
|||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
|
|
@ -31,6 +31,7 @@ global $config;
|
|||
|
||||
enterprise_include('godmode/agentes/configurar_agente.php');
|
||||
enterprise_include_once('include/functions_modules.php');
|
||||
enterprise_include('include/functions_policies.php');
|
||||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/include/functions_cron.php';
|
||||
ui_require_javascript_file('encode_decode_base64');
|
||||
|
|
|
@ -1,27 +1,53 @@
|
|||
<?php
|
||||
/**
|
||||
* Planned downtimes list.
|
||||
*
|
||||
* @category Planned downtimes
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2022 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// 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.
|
||||
// Load global vars
|
||||
// Load global vars.
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
$read_permisson = check_acl($config['id_user'], 0, 'AR');
|
||||
$write_permisson = check_acl($config['id_user'], 0, 'AD');
|
||||
$manage_permisson = check_acl($config['id_user'], 0, 'AW');
|
||||
$access = ($read_permisson == true) ? 'AR' : (($write_permisson == true) ? 'AD' : (($manage_permisson == true) ? 'AW' : 'AR'));
|
||||
$read_permisson = (bool) check_acl($config['id_user'], 0, 'AR');
|
||||
$write_permisson = (bool) check_acl($config['id_user'], 0, 'AD');
|
||||
$manage_permisson = (bool) check_acl($config['id_user'], 0, 'AW');
|
||||
$access = null;
|
||||
if ($read_permisson === true) {
|
||||
$access = 'AR';
|
||||
}
|
||||
|
||||
if (! $read_permisson && !$manage_permisson) {
|
||||
if ($write_permisson === true) {
|
||||
$access = 'AD';
|
||||
}
|
||||
|
||||
if ($manage_permisson === true) {
|
||||
$access = 'AW';
|
||||
}
|
||||
|
||||
if ($read_permisson === false && $manage_permisson === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access downtime scheduler'
|
||||
|
@ -35,16 +61,109 @@ require_once 'include/functions_events.php';
|
|||
require_once 'include/functions_planned_downtimes.php';
|
||||
require_once 'include/functions_reporting.php';
|
||||
|
||||
$malformed_downtimes = planned_downtimes_get_malformed();
|
||||
$malformed_downtimes_exist = !empty($malformed_downtimes) ? true : false;
|
||||
if (is_ajax() === true) {
|
||||
$show_info_agents_modules_affected = (bool) get_parameter(
|
||||
'show_info_agents_modules_affected',
|
||||
false
|
||||
);
|
||||
|
||||
$get_info_agents_modules_affected = (bool) get_parameter(
|
||||
'get_info_agents_modules_affected',
|
||||
false
|
||||
);
|
||||
|
||||
if ($show_info_agents_modules_affected === true) {
|
||||
$id = (int) get_parameter('id', 0);
|
||||
|
||||
$columns = [
|
||||
'agent_name',
|
||||
'module_name',
|
||||
];
|
||||
|
||||
$column_names = [
|
||||
__('Agents'),
|
||||
__('Modules'),
|
||||
];
|
||||
|
||||
ui_print_datatable(
|
||||
[
|
||||
'id' => 'agent_modules_affected_planned_downtime',
|
||||
'class' => 'info_table',
|
||||
'style' => 'width: 100%',
|
||||
'columns' => $columns,
|
||||
'column_names' => $column_names,
|
||||
'ajax_url' => 'godmode/agentes/planned_downtime.list',
|
||||
'ajax_data' => [
|
||||
'get_info_agents_modules_affected' => 1,
|
||||
'id' => $id,
|
||||
],
|
||||
'order' => [
|
||||
'field' => 'agent_name',
|
||||
'direction' => 'asc',
|
||||
],
|
||||
'search_button_class' => 'sub filter float-right',
|
||||
'form' => [
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => __('Agents'),
|
||||
'type' => 'text',
|
||||
'class' => 'w200px',
|
||||
'id' => 'filter_agents',
|
||||
'name' => 'filter_agents',
|
||||
],
|
||||
[
|
||||
'label' => __('Modules'),
|
||||
'type' => 'text',
|
||||
'class' => 'w200px',
|
||||
'id' => 'filter_modules',
|
||||
'name' => 'filter_modules',
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($get_info_agents_modules_affected === true) {
|
||||
$id = (int) get_parameter('id', 0);
|
||||
|
||||
// Catch post parameters.
|
||||
$options = [
|
||||
'limit' => get_parameter('start', 0),
|
||||
'offset' => get_parameter('length', $config['block_size']),
|
||||
'order' => get_datatable_order(),
|
||||
'filters' => get_parameter('filter', []),
|
||||
];
|
||||
|
||||
$modules = get_agents_modules_planned_dowtime($id, $options);
|
||||
$count = get_agents_modules_planned_dowtime($id, $options, $count);
|
||||
|
||||
echo json_encode(
|
||||
[
|
||||
'data' => $modules,
|
||||
'recordsTotal' => $count[0]['total'],
|
||||
'recordsFiltered' => $count[0]['total'],
|
||||
]
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$malformed_downtimes = planned_downtimes_get_malformed();
|
||||
$malformed_downtimes_exist = (empty($malformed_downtimes) === false) ? true : false;
|
||||
$migrate_malformed = (bool) get_parameter('migrate_malformed');
|
||||
if ($migrate_malformed) {
|
||||
if ($migrate_malformed === true) {
|
||||
$migration_result = planned_downtimes_migrate_malformed_downtimes();
|
||||
|
||||
if ($migration_result['status'] == false) {
|
||||
$str = 'An error occurred while migrating the malformed scheduled downtimes';
|
||||
$str2 = 'Please run the migration again or contact with the administrator';
|
||||
if ((bool) $migration_result['status'] === false) {
|
||||
ui_print_error_message(
|
||||
__('An error occurred while migrating the malformed scheduled downtimes').'. '.__('Please run the migration again or contact with the administrator')
|
||||
__($str).'. '.__($str2)
|
||||
);
|
||||
echo '<br>';
|
||||
}
|
||||
|
@ -63,12 +182,15 @@ ui_print_page_header(
|
|||
$id_downtime = (int) get_parameter('id_downtime', 0);
|
||||
|
||||
$stop_downtime = (bool) get_parameter('stop_downtime');
|
||||
// STOP DOWNTIME
|
||||
if ($stop_downtime) {
|
||||
// STOP DOWNTIME.
|
||||
if ($stop_downtime === true) {
|
||||
$downtime = db_get_row('tplanned_downtime', 'id', $id_downtime);
|
||||
|
||||
// Check AD permission on the downtime
|
||||
if (empty($downtime) || (! check_acl($config['id_user'], $downtime['id_group'], 'AD') && ! check_acl($config['id_user'], $downtime['id_group'], 'AW'))) {
|
||||
// Check AD permission on the downtime.
|
||||
if (empty($downtime) === true
|
||||
|| ((bool) check_acl($config['id_user'], $downtime['id_group'], 'AD') === false
|
||||
&& (bool) check_acl($config['id_user'], $downtime['id_group'], 'AW') === false)
|
||||
) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access downtime scheduler'
|
||||
|
@ -80,7 +202,9 @@ if ($stop_downtime) {
|
|||
$result = planned_downtimes_stop($downtime);
|
||||
|
||||
if ($result === false) {
|
||||
ui_print_error_message(__('An error occurred stopping the scheduled downtime'));
|
||||
ui_print_error_message(
|
||||
__('An error occurred stopping the scheduled downtime')
|
||||
);
|
||||
} else {
|
||||
echo $result['message'];
|
||||
}
|
||||
|
@ -88,11 +212,14 @@ if ($stop_downtime) {
|
|||
|
||||
$delete_downtime = (int) get_parameter('delete_downtime');
|
||||
// DELETE WHOLE DOWNTIME!
|
||||
if ($delete_downtime) {
|
||||
if (empty($delete_downtime) === false) {
|
||||
$downtime = db_get_row('tplanned_downtime', 'id', $id_downtime);
|
||||
|
||||
// Check AD permission on the downtime
|
||||
if (empty($downtime) || (! check_acl($config['id_user'], $downtime['id_group'], 'AD') && ! check_acl($config['id_user'], $downtime['id_group'], 'AW'))) {
|
||||
// Check AD permission on the downtime.
|
||||
if (empty($downtime) === true
|
||||
|| ((bool) check_acl($config['id_user'], $downtime['id_group'], 'AD') === false
|
||||
&& (bool) check_acl($config['id_user'], $downtime['id_group'], 'AW') === false)
|
||||
) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access downtime scheduler'
|
||||
|
@ -102,10 +229,13 @@ if ($delete_downtime) {
|
|||
}
|
||||
|
||||
// The downtime shouldn't be running!!
|
||||
if ($downtime['executed']) {
|
||||
if ((bool) $downtime['executed'] === true) {
|
||||
ui_print_error_message(__('This scheduled downtime is running'));
|
||||
} else {
|
||||
$result = db_process_sql_delete('tplanned_downtime', ['id' => $id_downtime]);
|
||||
$result = db_process_sql_delete(
|
||||
'tplanned_downtime',
|
||||
['id' => $id_downtime]
|
||||
);
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
|
@ -119,15 +249,25 @@ if ($delete_downtime) {
|
|||
$offset = (int) get_parameter('offset');
|
||||
$filter_params = [];
|
||||
|
||||
$search_text = $filter_params['search_text'] = (string) get_parameter('search_text');
|
||||
$date_from = $filter_params['date_from'] = (string) get_parameter('date_from');
|
||||
$date_to = $filter_params['date_to'] = (string) get_parameter('date_to');
|
||||
$execution_type = $filter_params['execution_type'] = (string) get_parameter('execution_type');
|
||||
$show_archived = $filter_params['archived'] = (bool) get_parameter('archived');
|
||||
$agent_id = $filter_params['agent_id'] = (int) get_parameter('agent_id');
|
||||
$agent_name = $filter_params['agent_name'] = (string) (!empty($agent_id) ? get_parameter('agent_name') : '');
|
||||
$module_id = $filter_params['module_id'] = (int) get_parameter('module_name_hidden');
|
||||
$module_name = $filter_params['module_name'] = (string) (!empty($module_id) ? get_parameter('module_name') : '');
|
||||
$search_text = (string) get_parameter('search_text');
|
||||
$date_from = (string) get_parameter('date_from');
|
||||
$date_to = (string) get_parameter('date_to');
|
||||
$execution_type = (string) get_parameter('execution_type');
|
||||
$show_archived = (bool) get_parameter('archived');
|
||||
$agent_id = (int) get_parameter('agent_id');
|
||||
$agent_name = (string) ((empty($agent_id) === false) ? get_parameter('agent_name') : '');
|
||||
$module_id = (int) get_parameter('module_name_hidden');
|
||||
$module_name = (string) ((empty($module_id) === false) ? get_parameter('module_name') : '');
|
||||
|
||||
$filter_params['search_text'] = $search_text;
|
||||
$filter_params['date_from'] = $date_from;
|
||||
$filter_params['date_to'] = $date_to;
|
||||
$filter_params['execution_type'] = $execution_type;
|
||||
$filter_params['archived'] = $show_archived;
|
||||
$filter_params['agent_id'] = $agent_id;
|
||||
$filter_params['agent_name'] = $agent_name;
|
||||
$filter_params['module_id'] = $module_id;
|
||||
$filter_params['module_name'] = $module_name;
|
||||
|
||||
$filter_params_str = http_build_query($filter_params);
|
||||
|
||||
|
@ -141,11 +281,32 @@ $table_form->data = [];
|
|||
$row = [];
|
||||
|
||||
// Search text.
|
||||
$row[] = __('Search').' '.html_print_input_text('search_text', $search_text, '', 50, 250, true);
|
||||
$row[] = __('Search').' '.html_print_input_text(
|
||||
'search_text',
|
||||
$search_text,
|
||||
'',
|
||||
50,
|
||||
250,
|
||||
true
|
||||
);
|
||||
// Dates.
|
||||
$date_inputs = __('From').' '.html_print_input_text('date_from', $date_from, '', 10, 10, true);
|
||||
$date_inputs = __('From').' '.html_print_input_text(
|
||||
'date_from',
|
||||
$date_from,
|
||||
'',
|
||||
10,
|
||||
10,
|
||||
true
|
||||
);
|
||||
$date_inputs .= ' ';
|
||||
$date_inputs .= __('To').' '.html_print_input_text('date_to', $date_to, '', 10, 10, true);
|
||||
$date_inputs .= __('To').' '.html_print_input_text(
|
||||
'date_to',
|
||||
$date_to,
|
||||
'',
|
||||
10,
|
||||
10,
|
||||
true
|
||||
);
|
||||
$row[] = $date_inputs;
|
||||
|
||||
$table_form->data[] = $row;
|
||||
|
@ -157,9 +318,24 @@ $execution_type_fields = [
|
|||
'once' => __('Once'),
|
||||
'periodically' => __('Periodically'),
|
||||
];
|
||||
$row[] = __('Execution type').' '.html_print_select($execution_type_fields, 'execution_type', $execution_type, '', __('Any'), '', true, false, false);
|
||||
$row[] = __('Execution type').' '.html_print_select(
|
||||
$execution_type_fields,
|
||||
'execution_type',
|
||||
$execution_type,
|
||||
'',
|
||||
__('Any'),
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false
|
||||
);
|
||||
// Show past downtimes.
|
||||
$row[] = __('Show past downtimes').' '.html_print_checkbox('archived', 1, $show_archived, true);
|
||||
$row[] = __('Show past downtimes').' '.html_print_checkbox(
|
||||
'archived',
|
||||
1,
|
||||
$show_archived,
|
||||
true
|
||||
);
|
||||
|
||||
$table_form->data[] = $row;
|
||||
|
||||
|
@ -178,48 +354,84 @@ $agent_input = __('Agent').' '.ui_print_agent_autocomplete_input($params);
|
|||
$row[] = $agent_input;
|
||||
|
||||
// Module.
|
||||
$row[] = __('Module').' '.html_print_autocomplete_modules('module_name', $module_name, false, true, '', [], true);
|
||||
$row[] = __('Module').' '.html_print_autocomplete_modules(
|
||||
'module_name',
|
||||
$module_name,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
[],
|
||||
true
|
||||
);
|
||||
|
||||
$row[] = html_print_submit_button(__('Search'), 'search', false, 'class="sub search"', true);
|
||||
$row[] = html_print_submit_button(
|
||||
__('Search'),
|
||||
'search',
|
||||
false,
|
||||
'class="sub search"',
|
||||
true
|
||||
);
|
||||
|
||||
$table_form->data[] = $row;
|
||||
// End of table filter.
|
||||
// Useful to know if the user has done a form filtering.
|
||||
$filter_performed = false;
|
||||
|
||||
$downtimes = [];
|
||||
$groups = users_get_groups(false, $access);
|
||||
if (!empty($groups)) {
|
||||
if (empty($groups) === false) {
|
||||
$where_values = '1=1';
|
||||
|
||||
$groups_string = implode(',', array_keys($groups));
|
||||
$where_values .= " AND id_group IN ($groups_string)";
|
||||
$where_values .= sprintf(' AND id_group IN (%s)', $groups_string);
|
||||
|
||||
// WARNING: add $filter_performed = true; to any future filter.
|
||||
if (!empty($search_text)) {
|
||||
if (empty($search_text) === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$where_values .= " AND (name LIKE '%$search_text%' OR description LIKE '%$search_text%')";
|
||||
$where_values .= sprintf(
|
||||
' AND (name LIKE "%%%s%%" OR description LIKE "%%%s%%")',
|
||||
$search_text,
|
||||
$search_text
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($execution_type)) {
|
||||
if (empty($execution_type) === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$where_values .= " AND type_execution = '$execution_type'";
|
||||
$where_values .= sprintf(' AND type_execution = "%s"', $execution_type);
|
||||
}
|
||||
|
||||
if (!empty($date_from)) {
|
||||
if (empty($date_from) === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$where_values .= " AND (type_execution = 'periodically' OR (type_execution = 'once' AND date_from >= '".strtotime("$date_from 00:00:00")."'))";
|
||||
$where_values .= sprintf(
|
||||
' AND (type_execution = "periodically"
|
||||
OR (type_execution = "once"
|
||||
AND date_from >= "%s")
|
||||
)',
|
||||
strtotime($date_from.' 00:00:00')
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($date_to)) {
|
||||
if (empty($date_to) === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$periodically_monthly_w = "type_periodicity = 'monthly'
|
||||
AND ((periodically_day_from <= '".date('d', strtotime($date_from))."' AND periodically_day_to >= '".date('d', strtotime($date_to))."')
|
||||
OR (periodically_day_from > periodically_day_to
|
||||
AND (periodically_day_from <= '".date('d', strtotime($date_from))."' OR periodically_day_to >= '".date('d', strtotime($date_to))."')))";
|
||||
$periodically_monthly_w = sprintf(
|
||||
'type_periodicity = "monthly" AND (
|
||||
(
|
||||
periodically_day_from <= "%s"
|
||||
AND periodically_day_to >= "%s"
|
||||
)
|
||||
OR (
|
||||
periodically_day_from > periodically_day_to
|
||||
AND (
|
||||
periodically_day_from <= "%s"
|
||||
OR periodically_day_to >= "%s"
|
||||
)
|
||||
)
|
||||
)',
|
||||
date('d', strtotime($date_from)),
|
||||
date('d', strtotime($date_to)),
|
||||
date('d', strtotime($date_from)),
|
||||
date('d', strtotime($date_to))
|
||||
);
|
||||
|
||||
$periodically_weekly_days = [];
|
||||
$date_from_aux = strtotime($date_from);
|
||||
|
@ -229,7 +441,7 @@ if (!empty($groups)) {
|
|||
while ($date_from_aux <= $date_end && $days_number < 7) {
|
||||
$weekday_actual = strtolower(date('l', $date_from_aux));
|
||||
|
||||
$periodically_weekly_days[] = "$weekday_actual = 1";
|
||||
$periodically_weekly_days[] = $weekday_actual.' = 1';
|
||||
|
||||
$date_from_aux = ($date_from_aux + SECONDS_1DAY);
|
||||
$days_number++;
|
||||
|
@ -237,36 +449,60 @@ if (!empty($groups)) {
|
|||
|
||||
$periodically_weekly_w = "type_periodicity = 'weekly' AND (".implode(' OR ', $periodically_weekly_days).')';
|
||||
|
||||
$periodically_w = "type_execution = 'periodically' AND (($periodically_monthly_w) OR ($periodically_weekly_w))";
|
||||
$periodically_w = sprintf(
|
||||
'type_execution = "periodically" AND ((%s) OR (%s))',
|
||||
$periodically_monthly_w,
|
||||
$periodically_weekly_w
|
||||
);
|
||||
|
||||
$once_w = "type_execution = 'once' AND date_to <= '".strtotime("$date_to 23:59:59")."'";
|
||||
$once_w = sprintf(
|
||||
'type_execution = "once" AND date_to <= "%s"',
|
||||
strtotime($date_to.' 23:59:59')
|
||||
);
|
||||
|
||||
$where_values .= " AND (($periodically_w) OR ($once_w))";
|
||||
$where_values .= sprintf(
|
||||
' AND ((%s) OR (%s))',
|
||||
$periodically_w,
|
||||
$once_w
|
||||
);
|
||||
}
|
||||
|
||||
if (!$show_archived) {
|
||||
if ($show_archived === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$where_values .= " AND (type_execution = 'periodically' OR (type_execution = 'once' AND date_to >= '".time()."'))";
|
||||
$where_values .= sprintf(
|
||||
' AND (type_execution = "periodically"
|
||||
OR (type_execution = "once"
|
||||
AND date_to >= "%s"))',
|
||||
time()
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($agent_id)) {
|
||||
if (empty($agent_id) === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$where_values .= " AND id IN (SELECT id_downtime FROM tplanned_downtime_agents WHERE id_agent = $agent_id)";
|
||||
$where_values .= sprintf(
|
||||
' AND id IN (SELECT id_downtime FROM tplanned_downtime_agents WHERE id_agent = %d)',
|
||||
$agent_id
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($module_id)) {
|
||||
if (empty($module_id) === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$where_values .= " AND (id IN (SELECT id_downtime
|
||||
FROM tplanned_downtime_modules
|
||||
WHERE id_agent_module = $module_id)
|
||||
OR id IN (SELECT id_downtime
|
||||
FROM tplanned_downtime_agents tpda, tagente_modulo tam
|
||||
WHERE tpda.id_agent = tam.id_agente
|
||||
AND tam.id_agente_modulo = $module_id
|
||||
AND tpda.all_modules = 1))";
|
||||
$where_values .= sprintf(
|
||||
' AND (id IN (
|
||||
SELECT id_downtime
|
||||
FROM tplanned_downtime_modules
|
||||
WHERE id_agent_module = %d)
|
||||
OR id IN (
|
||||
SELECT id_downtime
|
||||
FROM tplanned_downtime_agents tpda, tagente_modulo tam
|
||||
WHERE tpda.id_agent = tam.id_agente
|
||||
AND tam.id_agente_modulo = %d
|
||||
AND tpda.all_modules = 1
|
||||
)
|
||||
)',
|
||||
$module_id,
|
||||
$module_id
|
||||
);
|
||||
}
|
||||
|
||||
// Columns of the table tplanned_downtime.
|
||||
|
@ -296,68 +532,41 @@ if (!empty($groups)) {
|
|||
'id_user',
|
||||
];
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
$columns_str = implode(',', $columns);
|
||||
$sql = "SELECT $columns_str
|
||||
FROM tplanned_downtime
|
||||
WHERE $where_values
|
||||
ORDER BY type_execution DESC, date_from DESC
|
||||
LIMIT ".$config['block_size']."
|
||||
OFFSET $offset";
|
||||
break;
|
||||
$columns_str = implode(',', $columns);
|
||||
$sql = sprintf(
|
||||
'SELECT %s
|
||||
FROM tplanned_downtime
|
||||
WHERE %s
|
||||
ORDER BY type_execution DESC, date_from DESC
|
||||
LIMIT %d
|
||||
OFFSET %d',
|
||||
$columns_str,
|
||||
$where_values,
|
||||
$config['block_size'],
|
||||
$offset
|
||||
);
|
||||
|
||||
case 'oracle':
|
||||
// Oracle doesn't have TIME type, so we should transform the DATE value
|
||||
$new_time_from = "TO_CHAR(periodically_time_from, 'HH24:MI:SS') AS periodically_time_from";
|
||||
$new_time_to = "TO_CHAR(periodically_time_to, 'HH24:MI:SS') AS periodically_time_to";
|
||||
|
||||
$time_from_key = array_search('periodically_time_from', $columns);
|
||||
$time_to_key = array_search('periodically_time_to', $columns);
|
||||
|
||||
if ($time_from_key !== false) {
|
||||
$columns[$time_from_key] = $new_time_from;
|
||||
}
|
||||
|
||||
if ($time_to_key !== false) {
|
||||
$columns[$time_to_key] = $new_time_to;
|
||||
}
|
||||
|
||||
$columns_str = implode(',', $columns);
|
||||
|
||||
$set = [];
|
||||
$set['limit'] = $config['block_size'];
|
||||
$set['offset'] = $offset;
|
||||
|
||||
$sql = "SELECT $columns_str
|
||||
FROM tplanned_downtime
|
||||
WHERE $where_values
|
||||
ORDER BY type_execution DESC, date_from DESC";
|
||||
|
||||
$sql = oracle_recode_query($sql, $set);
|
||||
break;
|
||||
}
|
||||
|
||||
$sql_count = "SELECT COUNT(id) AS num
|
||||
FROM tplanned_downtime
|
||||
WHERE $where_values";
|
||||
$sql_count = sprintf(
|
||||
'SELECT COUNT(id) AS num
|
||||
FROM tplanned_downtime
|
||||
WHERE %s',
|
||||
$where_values
|
||||
);
|
||||
|
||||
$downtimes = db_get_all_rows_sql($sql);
|
||||
$downtimes_number_res = db_get_all_rows_sql($sql_count);
|
||||
$downtimes_number = $downtimes_number_res != false ? $downtimes_number_res[0]['num'] : 0;
|
||||
} else {
|
||||
$downtimes = [];
|
||||
$downtimes_number = ($downtimes_number_res !== false) ? $downtimes_number_res[0]['num'] : 0;
|
||||
}
|
||||
|
||||
$url_list = 'index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list';
|
||||
$url_editor = 'index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor';
|
||||
// No downtimes cause the user has not anyone.
|
||||
if (!$downtimes && !$filter_performed) {
|
||||
if ($downtimes === false && $filter_performed === false) {
|
||||
include_once $config['homedir'].'/general/first_task/planned_downtime.php';
|
||||
}
|
||||
// No downtimes cause the user performed a search.
|
||||
else if (!$downtimes) {
|
||||
} else if ($downtimes === false) {
|
||||
// No downtimes cause the user performed a search.
|
||||
// Filter form.
|
||||
echo "<form method='post' action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>";
|
||||
echo '<form method="post" action="'.$url_list.'">';
|
||||
html_print_table($table_form);
|
||||
echo '</form>';
|
||||
|
||||
|
@ -367,22 +576,25 @@ else if (!$downtimes) {
|
|||
echo '<div class="action-buttons w100p" >';
|
||||
|
||||
// Create button.
|
||||
if ($write_permisson) {
|
||||
if ($write_permisson === true) {
|
||||
echo ' ';
|
||||
echo '<form method="post" class="display_in" action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor">';
|
||||
echo '<form method="post" class="display_in" action="'.$url_editor.'">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
// Has downtimes.
|
||||
else {
|
||||
echo "<form method='post' action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>";
|
||||
} else {
|
||||
// Has downtimes.
|
||||
echo '<form method="post" action="'.$url_list.'">';
|
||||
html_print_table($table_form);
|
||||
echo '</form>';
|
||||
|
||||
ui_pagination($downtimes_number, "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset);
|
||||
ui_pagination(
|
||||
$downtimes_number,
|
||||
$url_list.'&'.$filter_params_str,
|
||||
$offset
|
||||
);
|
||||
|
||||
// User groups with AR, AD or AW permission.
|
||||
$groupsAD = users_get_groups($config['id_user'], $access);
|
||||
|
@ -402,8 +614,11 @@ else {
|
|||
$table->head['execution'] = __('Execution');
|
||||
$table->head['configuration'] = __('Configuration');
|
||||
$table->head['running'] = __('Running');
|
||||
$table->head['agents_modules'] = __('Affected');
|
||||
|
||||
if ($write_permisson || $manage_permisson) {
|
||||
if ($write_permisson === true
|
||||
|| $manage_permisson === true
|
||||
) {
|
||||
$table->head['stop'] = __('Stop downtime');
|
||||
$table->head['copy'] = __('Copy');
|
||||
$table->head['edit'] = __('Edit');
|
||||
|
@ -414,7 +629,9 @@ else {
|
|||
$table->align['group'] = 'center';
|
||||
$table->align['running'] = 'center';
|
||||
|
||||
if ($write_permisson || $manage_permisson) {
|
||||
if ($write_permisson === true
|
||||
|| $manage_permisson === true
|
||||
) {
|
||||
$table->align['stop'] = 'center';
|
||||
$table->align['edit'] = 'center';
|
||||
$table->align['delete'] = 'center';
|
||||
|
@ -430,7 +647,7 @@ else {
|
|||
WHERE id_downtime = '.$downtime['id']
|
||||
);
|
||||
|
||||
$data['name'] = $downtime['name']." ($total)";
|
||||
$data['name'] = $downtime['name'].' ('.$total.')';
|
||||
$data['description'] = $downtime['description'];
|
||||
$data['group'] = ui_print_group_icon($downtime['id_group'], true);
|
||||
|
||||
|
@ -451,7 +668,7 @@ else {
|
|||
|
||||
$data['configuration'] = reporting_format_planned_downtime_dates($downtime);
|
||||
|
||||
if ($downtime['executed'] == 0) {
|
||||
if ((int) $downtime['executed'] === 0) {
|
||||
$data['running'] = html_print_image(
|
||||
'images/pixel_red.png',
|
||||
true,
|
||||
|
@ -473,44 +690,124 @@ else {
|
|||
);
|
||||
}
|
||||
|
||||
$settings = [
|
||||
'url' => ui_get_full_url('ajax.php', false, false, false),
|
||||
'loadingText' => __('Loading, this operation might take several minutes...'),
|
||||
'title' => __('Agents / Modules affected'),
|
||||
'id' => $downtime['id'],
|
||||
];
|
||||
|
||||
$data['agents_modules'] = '<a href="#" onclick=\'dialogAgentModulesAffected('.json_encode($settings).')\'>';
|
||||
$data['agents_modules'] .= html_print_image(
|
||||
'images/search_big.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Agents and modules affected'),
|
||||
'style' => 'width:22px; height: 22px;',
|
||||
]
|
||||
);
|
||||
$data['agents_modules'] .= '</a>';
|
||||
|
||||
// If user have writting permissions.
|
||||
if (in_array($downtime['id_group'], $groupsAD)) {
|
||||
// Stop button
|
||||
if ($downtime['type_execution'] == 'once' && $downtime['executed'] == 1) {
|
||||
if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW')
|
||||
|| check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD')
|
||||
if (in_array($downtime['id_group'], $groupsAD) === true) {
|
||||
// Stop button.
|
||||
if ($downtime['type_execution'] === 'once'
|
||||
&& (int) $downtime['executed'] === 1
|
||||
) {
|
||||
if ((bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW') === true
|
||||
|| (bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD') === true
|
||||
) {
|
||||
$data['stop'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]);
|
||||
$url_list_params = $url_list.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str;
|
||||
$data['stop'] = '<a href="'.$url_list_params.'">';
|
||||
$data['stop'] .= html_print_image(
|
||||
'images/cancel.png',
|
||||
true,
|
||||
['title' => __('Stop downtime')]
|
||||
);
|
||||
} else {
|
||||
$data['stop'] = html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]);
|
||||
$data['stop'] = html_print_image(
|
||||
'images/cancel.png',
|
||||
true,
|
||||
['title' => __('Stop downtime')]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$data['stop'] = '';
|
||||
}
|
||||
|
||||
// Edit & delete buttons.
|
||||
if ($downtime['executed'] == 0) {
|
||||
if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW')
|
||||
|| check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD')
|
||||
if ((int) $downtime['executed'] === 0) {
|
||||
if ((bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW') === true
|
||||
|| (bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD') === true
|
||||
) {
|
||||
// Copy.
|
||||
$data['copy'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&downtime_copy=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/copy.png', true, ['title' => __('Copy'), 'class' => 'invert_filter']).'</a>';
|
||||
$data['copy'] = '<a href="'.$url_editor.'&downtime_copy=1&id_downtime='.$downtime['id'].'">';
|
||||
$data['copy'] .= html_print_image(
|
||||
'images/copy.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Copy'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$data['copy'] .= '</a>';
|
||||
|
||||
// Edit.
|
||||
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update'), 'class' => 'invert_filter']).'</a>';
|
||||
$data['edit'] = '<a href="'.$url_editor.'&edit_downtime=1&id_downtime='.$downtime['id'].'">';
|
||||
$data['edit'] .= html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Update'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$data['edit'] .= '</a>';
|
||||
|
||||
// Delete.
|
||||
$data['delete'] = '<a id="delete_downtime" href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']);
|
||||
$url_delete = $url_list.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str;
|
||||
$data['delete'] = '<a id="delete_downtime" href="'.$url_delete.'">';
|
||||
$data['delete'] .= html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Delete'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$data['delete'] .= '</a>';
|
||||
} else {
|
||||
$data['edit'] = '';
|
||||
$data['delete'] = '';
|
||||
}
|
||||
} else if ($downtime['executed'] == 1 && $downtime['type_execution'] == 'once') {
|
||||
if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW')
|
||||
|| check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD')
|
||||
} else if ((int) $downtime['executed'] === 1
|
||||
&& $downtime['type_execution'] === 'once'
|
||||
) {
|
||||
if ((bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW') === true
|
||||
|| (bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD') === true
|
||||
) {
|
||||
// Copy.
|
||||
$data['copy'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&downtime_copy=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/copy.png', true, ['title' => __('Copy'), 'class' => 'invert_filter']).'</a>';
|
||||
$data['copy'] = '<a href="'.$url_editor.'&downtime_copy=1&id_downtime='.$downtime['id'].'">';
|
||||
$data['copy'] .= html_print_image(
|
||||
'images/copy.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Copy'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$data['copy'] .= '</a>';
|
||||
// Edit.
|
||||
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update'), 'class' => 'invert_filter']).'</a>';
|
||||
$data['edit'] = '<a href="'.$url_editor.'&edit_downtime=1&id_downtime='.$downtime['id'].'">';
|
||||
$data['edit'] .= html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Update'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$data['edit'] .= '</a>';
|
||||
// Delete.
|
||||
$data['delete'] = __('N/A');
|
||||
} else {
|
||||
|
@ -529,7 +826,9 @@ else {
|
|||
$data['delete'] = '';
|
||||
}
|
||||
|
||||
if (!empty($malformed_downtimes_exist) && isset($malformed_downtimes[$downtime['id']])) {
|
||||
if (empty($malformed_downtimes_exist) === false
|
||||
&& isset($malformed_downtimes[$downtime['id']]) === true
|
||||
) {
|
||||
$next_row_num = count($table->data);
|
||||
$table->cellstyle[$next_row_num][0] = 'color: red';
|
||||
$table->cellstyle[$next_row_num][1] = 'color: red';
|
||||
|
@ -542,7 +841,17 @@ else {
|
|||
}
|
||||
|
||||
html_print_table($table);
|
||||
ui_pagination($downtimes_number, "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom');
|
||||
ui_pagination(
|
||||
$downtimes_number,
|
||||
$url_list.'&'.$filter_params_str,
|
||||
$offset,
|
||||
0,
|
||||
false,
|
||||
'offset',
|
||||
true,
|
||||
'pagination-bottom'
|
||||
);
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
||||
// CSV export button.
|
||||
|
@ -551,32 +860,44 @@ else {
|
|||
__('Export to CSV'),
|
||||
'csv_export',
|
||||
false,
|
||||
"location.href='godmode/agentes/planned_downtime.export_csv.php?$filter_params_str'",
|
||||
'location.href="godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'"',
|
||||
'class="sub next"'
|
||||
);
|
||||
echo '</div>';
|
||||
|
||||
// Create button.
|
||||
if ($write_permisson) {
|
||||
if ($write_permisson === true) {
|
||||
echo ' ';
|
||||
echo '<form method="post" action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor" class="display_in" >';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
echo '<form method="post" action="'.$url_editor.'" class="display_in" >';
|
||||
html_print_submit_button(
|
||||
__('Create'),
|
||||
'create',
|
||||
false,
|
||||
'class="sub next"'
|
||||
);
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');
|
||||
ui_require_jquery_file(
|
||||
'ui.datepicker-'.get_user_language(),
|
||||
'include/javascript/i18n/'
|
||||
);
|
||||
|
||||
ui_require_javascript_file('pandora_planned_downtimes');
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
||||
$("input[name=module_name_hidden]").val(<?php echo (int) $module_id; ?>);
|
||||
|
||||
$(document).ready (function () {
|
||||
$("#text-date_from, #text-date_to").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
|
||||
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
|
||||
$("#text-date_from, #text-date_to")
|
||||
.datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
|
||||
|
||||
$.datepicker
|
||||
.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
|
||||
|
||||
$("a#delete_downtime").click(function (e) {
|
||||
if (!confirm("<?php echo __('WARNING: If you delete this scheduled downtime, it will not be taken into account in future SLA reports'); ?>")) {
|
||||
|
|
|
@ -64,6 +64,40 @@ require_once $config['homedir'].'/include/functions_users.php';
|
|||
|
||||
$create_profiles = (int) get_parameter('create_profiles');
|
||||
|
||||
// Get users and groups user can manage to check and for selectors.
|
||||
$group_um = users_get_groups_UM($config['id_user']);
|
||||
|
||||
$users_profiles = '';
|
||||
$users_order = [
|
||||
'field' => 'id_user',
|
||||
'order' => 'ASC',
|
||||
];
|
||||
|
||||
$info_users = [];
|
||||
// Is admin.
|
||||
if (users_is_admin()) {
|
||||
$info_users = users_get_info($users_order, 'id_user');
|
||||
// has PM permission.
|
||||
} else if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$info_users = users_get_info($users_order, 'id_user');
|
||||
foreach ($info_users as $id_user => $value) {
|
||||
if (users_is_admin($id_user)) {
|
||||
unset($info_users[$value]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$info = [];
|
||||
foreach ($group_um as $group => $value) {
|
||||
$info = array_merge($info, users_get_users_by_group($group, $value));
|
||||
}
|
||||
|
||||
foreach ($info as $key => $value) {
|
||||
if (!$value['is_admin']) {
|
||||
$info_users[$key] = $value['id_user'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($create_profiles) {
|
||||
$profiles_id = get_parameter('profiles_id', -1);
|
||||
$groups_id = get_parameter('groups_id', -1);
|
||||
|
@ -74,8 +108,42 @@ if ($create_profiles) {
|
|||
$result = false;
|
||||
} else {
|
||||
foreach ($profiles_id as $profile) {
|
||||
// Check profiles permissions for non admin user.
|
||||
if (is_user_admin($config['user_id']) === false) {
|
||||
$user_profiles = profile_get_profiles(
|
||||
[
|
||||
'pandora_management' => '<> 1',
|
||||
'db_management' => '<> 1',
|
||||
]
|
||||
);
|
||||
|
||||
if (array_search((int) $profile, array_keys($user_profiles)) === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to add administrator profile whith standar user for user '.io_safe_input($user)
|
||||
);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($groups_id as $group) {
|
||||
if (check_acl($config['id_user'], $group, 'UM') === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to add profile group without permission for user '.io_safe_input($user)
|
||||
);
|
||||
exit;
|
||||
}
|
||||
|
||||
foreach ($users_id as $user) {
|
||||
if (array_search($user, $info_users) === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to edit user without permission for user '.io_safe_input($user)
|
||||
);
|
||||
exit;
|
||||
}
|
||||
|
||||
$profile_data = db_get_row_filter('tusuario_perfil', ['id_usuario' => $user, 'id_perfil' => $profile, 'id_grupo' => $group]);
|
||||
// If the profile doesnt exist, we create it
|
||||
if ($profile_data === false) {
|
||||
|
@ -142,7 +210,6 @@ $table->size[2] = '33%';
|
|||
$data = [];
|
||||
$data[0] = '<form method="post" id="form_profiles" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&tab=massive_users&option=add_profiles">';
|
||||
|
||||
$group_um = users_get_groups_UM($config['id_user']);
|
||||
|
||||
$display_all_group = true;
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
|
@ -205,36 +272,6 @@ $data[1] = html_print_select_groups(
|
|||
$data[2] = '<span id="alerts_loading" class="invisible">';
|
||||
$data[2] .= html_print_image('images/spinner.png', true);
|
||||
$data[2] .= '</span>';
|
||||
$users_profiles = '';
|
||||
$users_order = [
|
||||
'field' => 'id_user',
|
||||
'order' => 'ASC',
|
||||
];
|
||||
|
||||
$info_users = [];
|
||||
// Is admin.
|
||||
if (users_is_admin()) {
|
||||
$info_users = users_get_info($users_order, 'id_user');
|
||||
// has PM permission.
|
||||
} else if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$info_users = users_get_info($users_order, 'id_user');
|
||||
foreach ($info_users as $id_user => $value) {
|
||||
if (users_is_admin($id_user)) {
|
||||
unset($info_users[$value]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$info = [];
|
||||
foreach ($group_um as $group => $value) {
|
||||
$info = array_merge($info, users_get_users_by_group($group, $value));
|
||||
}
|
||||
|
||||
foreach ($info as $key => $value) {
|
||||
if (!$value['is_admin']) {
|
||||
$info_users[$key] = $value['id_user'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$data[2] .= html_print_select(
|
||||
$info_users,
|
||||
|
|
|
@ -743,6 +743,7 @@ switch ($action) {
|
|||
break;
|
||||
|
||||
case 'agent_module':
|
||||
case 'agent_module_status':
|
||||
$description = $item['description'];
|
||||
$es = json_decode($item['external_source'], true);
|
||||
|
||||
|
@ -4744,6 +4745,7 @@ $(document).ready (function () {
|
|||
|
||||
switch (type){
|
||||
case 'agent_module':
|
||||
case 'agent_module_status':
|
||||
case 'alert_report_actions':
|
||||
var agents_multiple = $('#id_agents2').val();
|
||||
var modules_multiple = $('#module').val();
|
||||
|
@ -4878,6 +4880,7 @@ $(document).ready (function () {
|
|||
}
|
||||
switch (type){
|
||||
case 'agent_module':
|
||||
case 'agent_module_status':
|
||||
case 'alert_report_actions':
|
||||
var agents_multiple = $('#id_agents2').val();
|
||||
var modules_multiple = $('#module').val();
|
||||
|
@ -6345,9 +6348,10 @@ function chooseType() {
|
|||
break;
|
||||
|
||||
case 'agent_module':
|
||||
$("#row_module_group").show();
|
||||
case 'agent_module_status':
|
||||
$("#row_description").show();
|
||||
$("#row_group").show();
|
||||
$("#row_module_group").show();
|
||||
$("#select_agent_modules").show();
|
||||
$("#agents_modules_row").show();
|
||||
$("#modules_row").show();
|
||||
|
|
|
@ -1655,6 +1655,7 @@ switch ($action) {
|
|||
break;
|
||||
|
||||
case 'agent_module':
|
||||
case 'agent_module_status':
|
||||
$agents_to_report_text = get_parameter('id_agents2-multiple-text', '');
|
||||
$modules_to_report_text = get_parameter('module-multiple-text', '');
|
||||
|
||||
|
@ -2456,6 +2457,7 @@ switch ($action) {
|
|||
break;
|
||||
|
||||
case 'agent_module':
|
||||
case 'agent_module_status':
|
||||
$agents_to_report_text = get_parameter('id_agents2-multiple-text');
|
||||
$modules_to_report_text = get_parameter('module-multiple-text', '');
|
||||
|
||||
|
|
|
@ -324,6 +324,16 @@ if ($create_user) {
|
|||
|
||||
$user_is_admin = (int) get_parameter('is_admin', 0);
|
||||
|
||||
if (users_is_admin() === false && $user_is_admin !== 0) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to create with administrator privileges to user by non administrator user '.$config['id_user']
|
||||
);
|
||||
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
$values = [];
|
||||
$values['id_user'] = (string) get_parameter('id_user');
|
||||
$values['fullname'] = (string) get_parameter('fullname');
|
||||
|
@ -538,6 +548,16 @@ if ($update_user) {
|
|||
$values['default_event_filter'] = (int) get_parameter('default_event_filter');
|
||||
$values['default_custom_view'] = (int) get_parameter('default_custom_view');
|
||||
|
||||
if (users_is_admin() === false && (bool) $values['is_admin'] !== false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to add administrator privileges to user by non administrator user '.$config['id_user']
|
||||
);
|
||||
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
// eHorus user level conf.
|
||||
$values['ehorus_user_level_enabled'] = (bool) get_parameter('ehorus_user_level_enabled', false);
|
||||
$values['ehorus_user_level_user'] = (string) get_parameter('ehorus_user_level_user');
|
||||
|
|
|
@ -260,9 +260,21 @@ if (is_metaconsole() === true) {
|
|||
|
||||
|
||||
$disable_user = get_parameter('disable_user', false);
|
||||
if ((bool) get_parameter('user_del', false) === true) {
|
||||
$delete_user = (bool) get_parameter('user_del', false);
|
||||
|
||||
if ($delete_user === true) {
|
||||
// Delete user.
|
||||
$id_user = get_parameter('delete_user', 0);
|
||||
if (users_is_admin($id_user) === true && users_is_admin() === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to delete admininstrator user by non administrator user '.$config['id_user']
|
||||
);
|
||||
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
// Only allow delete user if is not the actual user.
|
||||
if ($id_user != $config['id_user']) {
|
||||
$user_row = users_get_user_by_id($id_user);
|
||||
|
@ -332,6 +344,16 @@ if ((bool) get_parameter('user_del', false) === true) {
|
|||
// Disable_user.
|
||||
$id_user = get_parameter('id', 0);
|
||||
|
||||
if (users_is_admin($id_user) === true && users_is_admin() === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to disable admininstrator user by non administrator user '.$config['id_user']
|
||||
);
|
||||
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($id_user !== 0) {
|
||||
$result = users_disable($id_user, $disable_user);
|
||||
} else {
|
||||
|
@ -353,9 +375,9 @@ if ((bool) get_parameter('user_del', false) === true) {
|
|||
}
|
||||
}
|
||||
|
||||
$filter_group = (int) get_parameter('filter_group', 0);
|
||||
$filter_search = get_parameter('filter_search', '');
|
||||
$search = (bool) get_parameter('search', false);
|
||||
$filter_group = (int) get_parameter('filter_group', 0);
|
||||
$filter_search = get_parameter('filter_search', '');
|
||||
$search = (bool) get_parameter('search', false);
|
||||
|
||||
if (($filter_group == 0) && ($filter_search == '')) {
|
||||
$search = false;
|
||||
|
@ -545,6 +567,13 @@ if ($search) {
|
|||
}
|
||||
}
|
||||
|
||||
foreach ($info1 as $user_id => $user_info) {
|
||||
// If user is not admin then don't display admin users.
|
||||
if ($user_is_admin === false && (bool) $user_info['is_admin'] === true) {
|
||||
unset($info1[$user_id]);
|
||||
}
|
||||
}
|
||||
|
||||
$info = $info1;
|
||||
|
||||
// Prepare pagination.
|
||||
|
@ -557,11 +586,6 @@ $rowPair = true;
|
|||
$iterator = 0;
|
||||
$cont = 0;
|
||||
foreach ($info as $user_id => $user_info) {
|
||||
if (!$user_is_admin && $user_info['is_admin']) {
|
||||
// If user is not admin then don't display admin users.
|
||||
continue;
|
||||
}
|
||||
|
||||
// User profiles.
|
||||
if ($user_is_admin || $user_id == $config['id_user'] || isset($group_um[0])) {
|
||||
$user_profiles = db_get_all_rows_field_filter(
|
||||
|
@ -662,7 +686,7 @@ foreach ($info as $user_id => $user_info) {
|
|||
|
||||
if ($total_profile == 0 && count($user_profiles) >= 5) {
|
||||
$data[4] .= '<span onclick="showGroups()" class="pdd_l_15px">
|
||||
'.html_print_image(
|
||||
'.html_print_image(
|
||||
'images/zoom.png',
|
||||
true,
|
||||
[
|
||||
|
@ -853,20 +877,21 @@ if ($is_management_allowed === true) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
echo '</div>';
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
||||
echo '<script type="text/javascript">
|
||||
function showGroups(){
|
||||
var groups_list = document.getElementById("groups_list");
|
||||
var groups_list = document.getElementById("groups_list");
|
||||
|
||||
if(groups_list.style.display == "none"){
|
||||
document.querySelectorAll("[id=groups_list]").forEach(element=>
|
||||
element.style.display = "block");
|
||||
}else{
|
||||
document.querySelectorAll("[id=groups_list]").forEach(element=>
|
||||
element.style.display = "none");
|
||||
};
|
||||
if(groups_list.style.display == "none"){
|
||||
document.querySelectorAll("[id=groups_list]").forEach(element=>
|
||||
element.style.display = "block");
|
||||
}else{
|
||||
document.querySelectorAll("[id=groups_list]").forEach(element=>
|
||||
element.style.display = "none");
|
||||
};
|
||||
}
|
||||
</script>';
|
||||
|
|
|
@ -544,11 +544,6 @@ class AgentWizard extends HTML
|
|||
// Get the servers.
|
||||
$rows = get_proxy_servers();
|
||||
|
||||
// Check if satellite server has remote configuration enabled.
|
||||
$satellite_remote = config_agents_has_remote_configuration(
|
||||
$this->idAgent
|
||||
);
|
||||
|
||||
// Generate a list with allowed servers.
|
||||
if (isset($rows) === true && is_array($rows) === true) {
|
||||
foreach ($rows as $row) {
|
||||
|
|
|
@ -158,7 +158,9 @@ class CredentialStore extends Wizard
|
|||
// Check access.
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AR')) {
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === false
|
||||
|| (bool) check_acl($config['id_user'], 0, 'UM') === false
|
||||
) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access credential store'
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC220308';
|
||||
$build_version = 'PC220311';
|
||||
$pandora_version = 'v7.0NG.760';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -750,6 +750,7 @@ function agents_get_agents_selected($group)
|
|||
'id_tmetaconsole_setup',
|
||||
'id_agente',
|
||||
'alias',
|
||||
'server_name',
|
||||
],
|
||||
'AR',
|
||||
[
|
||||
|
@ -764,7 +765,7 @@ function agents_get_agents_selected($group)
|
|||
$all = array_reduce(
|
||||
$all,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['id_tmetaconsole_setup'].'|'.$item['id_tagente']] = $item['alias'];
|
||||
$carry[$item['id_tmetaconsole_setup'].'|'.$item['id_tagente']] = $item['server_name'].' » '.$item['alias'];
|
||||
return $carry;
|
||||
},
|
||||
[]
|
||||
|
@ -1243,6 +1244,11 @@ function agents_get_group_agents(
|
|||
unset($search['string']);
|
||||
}
|
||||
|
||||
if (isset($search['matchIds']) === true && is_array($search['matchIds']) === true) {
|
||||
$filter[] = sprintf('id_agente IN (%s)', implode(', ', $search['matchIds']));
|
||||
unset($search['matchIds']);
|
||||
}
|
||||
|
||||
if (isset($search['name']) === true) {
|
||||
$name = io_safe_input($search['name']);
|
||||
$filter[] = "nombre LIKE '$name'";
|
||||
|
@ -3223,8 +3229,8 @@ function agents_get_network_interfaces($agents=false, $agents_filter=false)
|
|||
$ni_by_agents = [];
|
||||
foreach ($agents as $agent) {
|
||||
$agent_id = (isset($agent['id_agente'])) ? $agent['id_agente'] : $agent;
|
||||
$agent_group_id = $agent['id_grupo'];
|
||||
$agent_name = $agent['alias'];
|
||||
$agent_group_id = (isset($agent['id_grupo']) === true) ? $agent['id_grupo'] : '';
|
||||
$agent_name = (isset($agent['alias']) === true) ? $agent['alias'] : '';
|
||||
$agent_interfaces = [];
|
||||
|
||||
$accepted_module_types = [];
|
||||
|
@ -4180,3 +4186,78 @@ function get_planned_downtime_agents_list($id_downtime, $filter_cond, $id_groups
|
|||
|
||||
return $agents;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Agent Module status and data
|
||||
*
|
||||
* @param integer $id_group Group
|
||||
* @param array $agents Agents filter.
|
||||
* @param array $modules Modules filter.
|
||||
*
|
||||
* @return array Result.
|
||||
*/
|
||||
function get_status_data_agent_modules($id_group, $agents=[], $modules=[])
|
||||
{
|
||||
$slq_filter_group = '';
|
||||
if (empty($id_group) === false) {
|
||||
$slq_filter_group = sprintf(
|
||||
' AND tagente.id_grupo = %d',
|
||||
$id_group
|
||||
);
|
||||
}
|
||||
|
||||
$slq_filter_agent = '';
|
||||
if (empty($agents) === false) {
|
||||
$slq_filter_agent = sprintf(
|
||||
' AND tagente_modulo.id_agente IN (%s)',
|
||||
implode(',', $agents)
|
||||
);
|
||||
}
|
||||
|
||||
$slq_filter_module = '';
|
||||
if (empty($modules) === false) {
|
||||
$slq_filter_module = sprintf(
|
||||
' AND tagente_modulo.id_agente_modulo IN (%s)',
|
||||
implode(',', $modules)
|
||||
);
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT tagente_modulo.id_agente_modulo as id_agent_module,
|
||||
tagente_modulo.nombre as name_module,
|
||||
tagente_modulo.unit as unit_module,
|
||||
tagente_modulo.id_agente as id_agent,
|
||||
tagente_estado.datos as data_module,
|
||||
tagente_estado.timestamp as data_time_module,
|
||||
tagente_estado.estado as status_module,
|
||||
tagente.alias as name_agent,
|
||||
tagente.id_grupo as id_group,
|
||||
tgrupo.nombre as name_group
|
||||
FROM tagente_modulo
|
||||
INNER JOIN tagente_estado
|
||||
ON tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||
INNER JOIN tagente
|
||||
ON tagente_modulo.id_agente = tagente.id_agente
|
||||
LEFT JOIN tagent_secondary_group
|
||||
ON tagente.id_agente = tagent_secondary_group.id_agent
|
||||
INNER JOIN tgrupo
|
||||
ON tagente.id_grupo = tgrupo.id_grupo
|
||||
WHERE 1=1
|
||||
%s
|
||||
%s
|
||||
%s
|
||||
',
|
||||
$slq_filter_group,
|
||||
$slq_filter_agent,
|
||||
$slq_filter_module
|
||||
);
|
||||
|
||||
$res = db_get_all_rows_sql($sql);
|
||||
|
||||
if ($res === false) {
|
||||
$res = [];
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
|
|
@ -4936,7 +4936,13 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||
((isset($data['size']) === true) ? $data['size'] : false),
|
||||
((isset($data['modal']) === true) ? $data['modal'] : false),
|
||||
((isset($data['message']) === true) ? $data['message'] : ''),
|
||||
((isset($data['select_all']) === true) ? $data['select_all'] : false)
|
||||
((isset($data['select_all']) === true) ? $data['select_all'] : false),
|
||||
((isset($data['simple_multiple_options']) === true) ? $data['simple_multiple_options'] : false),
|
||||
((isset($data['required']) === true) ? $data['required'] : false),
|
||||
((isset($data['truncate_size']) === true) ? $data['truncate_size'] : false),
|
||||
((isset($data['select2_enable']) === true) ? $data['select2_enable'] : true),
|
||||
((isset($data['select2_multiple_enable']) === true) ? $data['select2_multiple_enable'] : false),
|
||||
((isset($data['select2_multiple_enable_all']) === true) ? $data['select2_multiple_enable_all'] : false)
|
||||
);
|
||||
break;
|
||||
|
||||
|
|
|
@ -989,7 +989,7 @@ function planned_downtimes_copy($id_downtime)
|
|||
foreach ($planned_modules as $planned_module) {
|
||||
// Unset id.
|
||||
unset($planned_module['id']);
|
||||
// Set id_planned downtime
|
||||
// Set id_planned downtime.
|
||||
$planned_module['id_downtime'] = $result['id_downtime'];
|
||||
$result['id_modules'][] = db_process_sql_insert(
|
||||
'tplanned_downtime_moduless',
|
||||
|
@ -1004,3 +1004,82 @@ function planned_downtimes_copy($id_downtime)
|
|||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get agentts and modules for planned_downtime.
|
||||
*
|
||||
* @param [type] $id Id planned.
|
||||
*
|
||||
* @return array Result array data.
|
||||
*/
|
||||
function get_agents_modules_planned_dowtime($id, $options, $count=false)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
$filters_agent = '';
|
||||
if (isset($options['filters']['filter_agents']) === true
|
||||
&& empty($options['filters']['filter_agents']) === false
|
||||
) {
|
||||
$filters_agent = sprintf(
|
||||
' AND (tagente.alias LIKE "%%%s%%")',
|
||||
$options['filters']['filter_agents']
|
||||
);
|
||||
}
|
||||
|
||||
$filters_module = '';
|
||||
if (isset($options['filters']['filter_modules']) === true
|
||||
&& empty($options['filters']['filter_modules']) === false
|
||||
) {
|
||||
$filters_module = sprintf(
|
||||
' AND (tagente_modulo.nombre LIKE "%%%s%%")',
|
||||
$options['filters']['filter_modules']
|
||||
);
|
||||
}
|
||||
|
||||
if ($count === false) {
|
||||
$query = sprintf(
|
||||
'SELECT tplanned_downtime_modules.*,
|
||||
tagente.alias as agent_name,
|
||||
tagente_modulo.nombre as module_name
|
||||
FROM tplanned_downtime_modules
|
||||
INNER JOIN tagente
|
||||
ON tplanned_downtime_modules.id_agent = tagente.id_agente
|
||||
INNER JOIN tagente_modulo
|
||||
ON tplanned_downtime_modules.id_agent_module = tagente_modulo.id_agente_modulo
|
||||
WHERE id_downtime = %d
|
||||
%s
|
||||
%s
|
||||
ORDER BY %s
|
||||
LIMIT %d, %d',
|
||||
$id,
|
||||
$filters_agent,
|
||||
$filters_module,
|
||||
$options['order'],
|
||||
$options['limit'],
|
||||
$options['offset']
|
||||
);
|
||||
} else {
|
||||
$query = sprintf(
|
||||
'SELECT count(tplanned_downtime_modules.id) as total
|
||||
FROM tplanned_downtime_modules
|
||||
INNER JOIN tagente
|
||||
ON tplanned_downtime_modules.id_agent = tagente.id_agente
|
||||
INNER JOIN tagente_modulo
|
||||
ON tplanned_downtime_modules.id_agent_module = tagente_modulo.id_agente_modulo
|
||||
WHERE id_downtime = %d
|
||||
%s
|
||||
%s',
|
||||
$id,
|
||||
$filters_agent,
|
||||
$filters_module
|
||||
);
|
||||
}
|
||||
|
||||
$result = db_get_all_rows_sql($query);
|
||||
if ($result === false) {
|
||||
$result = [];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
|
@ -730,6 +730,13 @@ function reporting_make_reporting_data(
|
|||
);
|
||||
break;
|
||||
|
||||
case 'agent_module_status':
|
||||
$report['contents'][] = reporting_agent_module_status(
|
||||
$report,
|
||||
$content
|
||||
);
|
||||
break;
|
||||
|
||||
case 'alert_report_actions':
|
||||
$report['contents'][] = reporting_alert_report_actions(
|
||||
$report,
|
||||
|
@ -2854,6 +2861,136 @@ function reporting_agent_module($report, $content)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Agents module status
|
||||
*
|
||||
* @param array $report Info Report.
|
||||
* @param array $content Info content.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function reporting_agent_module_status($report, $content)
|
||||
{
|
||||
global $config;
|
||||
$return['type'] = 'agent_module_status';
|
||||
|
||||
if (empty($content['name'])) {
|
||||
$content['name'] = __('Agent/Modules Status');
|
||||
}
|
||||
|
||||
$return['title'] = io_safe_output($content['name']);
|
||||
$return['landscape'] = $content['landscape'];
|
||||
$return['pagebreak'] = $content['pagebreak'];
|
||||
$group_name = groups_get_name($content['id_group'], true);
|
||||
if ($content['id_module_group'] == 0) {
|
||||
$module_group_name = __('All');
|
||||
} else {
|
||||
$module_group_name = db_get_value(
|
||||
'name',
|
||||
'tmodule_group',
|
||||
'id_mg',
|
||||
$content['id_module_group']
|
||||
);
|
||||
}
|
||||
|
||||
$return['subtitle'] = $group_name.' - '.$module_group_name;
|
||||
$return['description'] = io_safe_output($content['description']);
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
|
||||
$return['data'] = [];
|
||||
|
||||
$external_source = json_decode(
|
||||
$content['external_source'],
|
||||
true
|
||||
);
|
||||
|
||||
$agents = json_decode(
|
||||
io_safe_output(
|
||||
base64_decode($external_source['id_agents'])
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
$modules = json_decode(
|
||||
io_safe_output(
|
||||
base64_decode($external_source['module'])
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$agents_per_node = [];
|
||||
$modules_per_node = [];
|
||||
|
||||
if (empty($agents) === false) {
|
||||
foreach ($agents as $value) {
|
||||
$agent_array = explode('|', $value);
|
||||
$agents_per_node[$agent_array[0]][] = $agent_array[1];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($modules) === false) {
|
||||
foreach ($modules as $value) {
|
||||
$module_array = explode('|', $value);
|
||||
$modules_per_node[$module_array[0]][] = $module_array[1];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($agents_per_node) === false) {
|
||||
foreach ($agents_per_node as $server => $agents) {
|
||||
$connection = metaconsole_get_connection_by_id($server);
|
||||
if (metaconsole_connect($connection) != NOERR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$res[$connection['server_name']] = get_status_data_agent_modules(
|
||||
$content['id_group'],
|
||||
$agents,
|
||||
$modules_per_node[$server]
|
||||
);
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
} else {
|
||||
$metaconsole_connections = metaconsole_get_connection_names();
|
||||
// For all nodes.
|
||||
if (isset($metaconsole_connections) === true
|
||||
&& is_array($metaconsole_connections) === true
|
||||
) {
|
||||
foreach ($metaconsole_connections as $metaconsole) {
|
||||
// Get server connection data.
|
||||
$server_data = metaconsole_get_connection($metaconsole);
|
||||
|
||||
// Establishes connection.
|
||||
if (metaconsole_load_external_db($server_data) !== NOERR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$res[$server_data['server_name']] = get_status_data_agent_modules(
|
||||
$content['id_group'],
|
||||
$agents,
|
||||
$modules
|
||||
);
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$res['node'] = get_status_data_agent_modules(
|
||||
$content['id_group'],
|
||||
$agents,
|
||||
$modules
|
||||
);
|
||||
}
|
||||
|
||||
$return['data'] = $res;
|
||||
|
||||
return reporting_check_structure_content($return);
|
||||
}
|
||||
|
||||
|
||||
function reporting_exception(
|
||||
$report,
|
||||
$content,
|
||||
|
@ -11049,11 +11186,29 @@ function reporting_get_stats_users($data)
|
|||
|
||||
$tdata = [];
|
||||
$tdata[0] = html_print_image('images/user.png', true, ['title' => __('Defined users'), 'class' => 'invert_filter']);
|
||||
$user_groups = users_get_strict_mode_groups($config['id_user'], false);
|
||||
if (array_key_exists(0, $user_groups)) {
|
||||
$users = users_get_user_users($config['id_user'], 'AR', true);
|
||||
$user_is_admin = users_is_admin();
|
||||
|
||||
$users = [];
|
||||
|
||||
if ($user_is_admin) {
|
||||
$users = get_users('', ['disabled' => 0], ['id_user', 'is_admin']);
|
||||
} else {
|
||||
$users = users_get_user_users($config['id_user'], 'AR', false);
|
||||
$group_um = users_get_groups_UM($config['id_user']);
|
||||
// 0 is the group 'all'.
|
||||
if (isset($group_um[0])) {
|
||||
$users = get_users('', ['disabled' => 0], ['id_user', 'is_admin']);
|
||||
} else {
|
||||
foreach ($group_um as $group => $value) {
|
||||
$users = array_merge($users, users_get_users_by_group($group, $value, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($users as $user_id => $user_info) {
|
||||
// If user is not admin then don't display admin users.
|
||||
if ($user_is_admin === false && (bool) $user_info['is_admin'] === true) {
|
||||
unset($users[$user_id]);
|
||||
}
|
||||
}
|
||||
|
||||
$tdata[1] = count($users);
|
||||
|
|
|
@ -377,6 +377,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
|||
reporting_html_agent_module($table, $item);
|
||||
break;
|
||||
|
||||
case 'agent_module_status':
|
||||
reporting_html_agent_module_status($table, $item);
|
||||
break;
|
||||
|
||||
case 'alert_report_actions':
|
||||
reporting_html_alert_report_actions($table, $item);
|
||||
break;
|
||||
|
@ -1999,6 +2003,125 @@ function reporting_html_agent_module($table, $item)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Html report agent modules status.
|
||||
*
|
||||
* @param object $table Head table or false if it comes from pdf.
|
||||
* @param array $item Items data.
|
||||
* @param integer $pdf Pdf output.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function reporting_html_agent_module_status($table, $item, $pdf=0)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$return_pdf = '';
|
||||
|
||||
if (empty($item['data']) === true) {
|
||||
if ($pdf !== 0) {
|
||||
$return_pdf .= __('No items');
|
||||
} else {
|
||||
$table->colspan['group_report']['cell'] = 3;
|
||||
$table->cellstyle['group_report']['cell'] = 'text-align: center;';
|
||||
$table->data['group_report']['cell'] = __('No items');
|
||||
}
|
||||
} else {
|
||||
$table_info = new stdClass();
|
||||
$table_info->width = '99%';
|
||||
|
||||
$table_info->align = [];
|
||||
if (is_metaconsole() === true) {
|
||||
$table_info->align['server'] = 'left';
|
||||
}
|
||||
|
||||
$table_info->align['name_group'] = 'left';
|
||||
$table_info->align['name_agent'] = 'left';
|
||||
$table_info->align['name_module'] = 'left';
|
||||
$table_info->align['status_module'] = 'left';
|
||||
$table_info->align['data_module'] = 'left';
|
||||
$table_info->align['data_time_module'] = 'left';
|
||||
|
||||
$table_info->headstyle = [];
|
||||
if (is_metaconsole() === true) {
|
||||
$table_info->headstyle['server'] = 'text-align: left';
|
||||
}
|
||||
|
||||
$table_info->headstyle['name_group'] = 'text-align: left';
|
||||
$table_info->headstyle['name_agent'] = 'text-align: left';
|
||||
$table_info->headstyle['name_module'] = 'text-align: left';
|
||||
$table_info->headstyle['status_module'] = 'text-align: left';
|
||||
$table_info->headstyle['data_module'] = 'text-align: left';
|
||||
$table_info->headstyle['data_time_module'] = 'text-align: left';
|
||||
|
||||
$table_info->head = [];
|
||||
if (is_metaconsole() === true) {
|
||||
$table_info->head['server'] = __('Server');
|
||||
}
|
||||
|
||||
$table_info->head['name_agent'] = __('Agent');
|
||||
$table_info->head['name_module'] = __('Module');
|
||||
$table_info->head['name_group'] = __('Group');
|
||||
$table_info->head['status_module'] = __('Status');
|
||||
$table_info->head['data_module'] = __('Data');
|
||||
$table_info->head['data_time_module'] = __('Last time');
|
||||
|
||||
$table_info->data = [];
|
||||
|
||||
foreach ($item['data'] as $server => $info) {
|
||||
foreach ($info as $data) {
|
||||
$row = [];
|
||||
if (is_metaconsole() === true) {
|
||||
$row['server'] = $server;
|
||||
}
|
||||
|
||||
$row['name_agent'] = $data['name_agent'];
|
||||
$row['name_module'] = $data['name_module'];
|
||||
$row['name_group'] = $data['name_group'];
|
||||
$row['status_module'] = ui_print_module_status(
|
||||
$data['status_module'],
|
||||
true,
|
||||
'status_rounded_rectangles',
|
||||
null,
|
||||
($pdf === 1) ? ' ' : ''
|
||||
);
|
||||
|
||||
if (is_numeric($data['data_module']) === true) {
|
||||
$row['data_module'] = remove_right_zeros(
|
||||
number_format(
|
||||
$data['data_module'],
|
||||
$config['graph_precision']
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$row['data_module'] = (empty($data['data_module']) === true) ? '--' : $data['data_module'];
|
||||
}
|
||||
|
||||
$row['data_module'] .= $data['unit_module'];
|
||||
$row['data_time_module'] = $data['data_time_module'];
|
||||
|
||||
$table_info->data[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
if ($pdf !== 0) {
|
||||
$table_info->title = $item['title'];
|
||||
$table_info->titleclass = 'title_table_pdf';
|
||||
$table_info->titlestyle = 'text-align:left;';
|
||||
$return_pdf .= html_print_table($table_info, true);
|
||||
} else {
|
||||
$table->colspan['data']['cell'] = 3;
|
||||
$table->cellstyle['data']['cell'] = 'text-align: center;';
|
||||
$table->data['data']['cell'] = html_print_table($table_info, true);
|
||||
}
|
||||
}
|
||||
|
||||
if ($pdf !== 0) {
|
||||
return $return_pdf;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to print to HTML Exception report.
|
||||
*
|
||||
|
|
|
@ -796,6 +796,11 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||
}
|
||||
}
|
||||
|
||||
$types['agent_module_status'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
'name' => __('Agents/Modules status'),
|
||||
];
|
||||
|
||||
// Only pandora managers have access to the whole database.
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$types['sql'] = [
|
||||
|
|
|
@ -2737,10 +2737,11 @@ function ui_print_status_image(
|
|||
/**
|
||||
* Returns html code to print a shape for a module.
|
||||
*
|
||||
* @param integer $status Module status.
|
||||
* @param boolean $return True or false.
|
||||
* @param string $class Custom class or use defined.
|
||||
* @param string $title Custom title or inherit from module status.
|
||||
* @param integer $status Module status.
|
||||
* @param boolean $return True or false.
|
||||
* @param string $class Custom class or use defined.
|
||||
* @param string $title Custom title or inherit from module status.
|
||||
* @param string $div_content Content.
|
||||
*
|
||||
* @return string HTML code for shape.
|
||||
*/
|
||||
|
@ -2748,7 +2749,8 @@ function ui_print_module_status(
|
|||
$status,
|
||||
$return=false,
|
||||
$class='status_rounded_rectangles',
|
||||
$title=null
|
||||
$title=null,
|
||||
$div_content=''
|
||||
) {
|
||||
$color = modules_get_color_status($status, true);
|
||||
if ($title === null) {
|
||||
|
@ -2758,7 +2760,7 @@ function ui_print_module_status(
|
|||
$output = '<div style="background: '.$color;
|
||||
$output .= '" class="'.$class;
|
||||
$output .= ' forced_title" data-title="'.$title.'" title="';
|
||||
$output .= $title.'" data-use_title_for_force_title="1"></div>';
|
||||
$output .= $title.'" data-use_title_for_force_title="1">'.$div_content.'</div>';
|
||||
|
||||
if ($return === false) {
|
||||
echo $output;
|
||||
|
@ -3618,6 +3620,15 @@ function ui_print_datatable(array $parameters)
|
|||
ui_require_javascript_file('buttons.html5.min');
|
||||
ui_require_javascript_file('buttons.print.min');
|
||||
} else {
|
||||
// Load datatable.min.css.
|
||||
$output .= '<link rel="stylesheet" href="';
|
||||
$output .= ui_get_full_url(
|
||||
'include/styles/js/datatables.min.css',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$output .= '"/>';
|
||||
// Load tables.css.
|
||||
$output .= '<link rel="stylesheet" href="';
|
||||
$output .= ui_get_full_url(
|
||||
|
|
|
@ -777,10 +777,13 @@ function users_get_groups_UM($id_user)
|
|||
/**
|
||||
* Obtiene una matriz con los grupos como clave y si tiene o no permiso UM sobre ese grupo(valor)
|
||||
*
|
||||
* @param string User id
|
||||
* @param string $id_group User id.
|
||||
* @param boolean $um Um.
|
||||
* @param boolean $disabled Reurn also disabled users.
|
||||
*
|
||||
* @return array Return .
|
||||
*/
|
||||
function users_get_users_by_group($id_group, $um=false)
|
||||
function users_get_users_by_group($id_group, $um=false, $disabled=true)
|
||||
{
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.* FROM tusuario
|
||||
|
@ -789,6 +792,10 @@ function users_get_users_by_group($id_group, $um=false)
|
|||
$id_group
|
||||
);
|
||||
|
||||
if ($disabled === false) {
|
||||
$sql .= 'WHERE tusuario.disabled = 0';
|
||||
}
|
||||
|
||||
$users = db_get_all_rows_sql($sql);
|
||||
$return = [];
|
||||
foreach ($users as $key => $user) {
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/* globals $, uniqId, confirmDialog*/
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function dialogAgentModulesAffected(settings) {
|
||||
confirmDialog({
|
||||
title: settings.title,
|
||||
size: 500,
|
||||
message: function() {
|
||||
var id = "div-" + uniqId();
|
||||
var loading = settings.loadingText;
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: settings.url,
|
||||
data: {
|
||||
page: "godmode/agentes/planned_downtime.list",
|
||||
show_info_agents_modules_affected: 1,
|
||||
id: settings.id
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$("#" + id)
|
||||
.empty()
|
||||
.append(data);
|
||||
},
|
||||
error: function(error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
|
||||
return "<div id ='" + id + "'>" + loading + "</div>";
|
||||
}
|
||||
});
|
||||
}
|
|
@ -577,28 +577,34 @@ function confirmDialog(settings) {
|
|||
*/
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function generalShowMsg(data, idMsg) {
|
||||
var title = "Response";
|
||||
var text = data;
|
||||
var failed = false;
|
||||
var title = data.title[data.error];
|
||||
var text = data.text[data.error];
|
||||
var failed = !data.error;
|
||||
|
||||
if (typeof data == "object") {
|
||||
title = data.title || "Response";
|
||||
text = data.text || data.error || data.result;
|
||||
failed = failed || data.error;
|
||||
}
|
||||
if (typeof data.error != "number") {
|
||||
title = "Response";
|
||||
text = data;
|
||||
failed = false;
|
||||
|
||||
if (failed) {
|
||||
title = "Error";
|
||||
text = data.error;
|
||||
}
|
||||
if (typeof data == "object") {
|
||||
title = data.title || "Response";
|
||||
text = data.text || data.error || data.result;
|
||||
failed = data.failed || data.error;
|
||||
}
|
||||
|
||||
if (idMsg == null) {
|
||||
idMsg = uniqId();
|
||||
}
|
||||
if (failed) {
|
||||
title = "Error";
|
||||
text = data.error;
|
||||
}
|
||||
|
||||
if ($("#" + idMsg).length === 0) {
|
||||
$("body").append('<div title="' + title + '" id="' + idMsg + '"></div>');
|
||||
$("#" + idMsg).empty();
|
||||
if (idMsg == null) {
|
||||
idMsg = uniqId();
|
||||
}
|
||||
|
||||
if ($("#" + idMsg).length === 0) {
|
||||
$("body").append('<div title="' + title + '" id="' + idMsg + '"></div>');
|
||||
$("#" + idMsg).empty();
|
||||
}
|
||||
}
|
||||
|
||||
$("#" + idMsg).empty();
|
||||
|
|
|
@ -389,7 +389,7 @@ ul li {
|
|||
|
||||
.button_collapse {
|
||||
margin-top: auto;
|
||||
height: 38px;
|
||||
min-height: 38px;
|
||||
background-color: #505050;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
|
@ -427,7 +427,6 @@ ul li {
|
|||
}
|
||||
|
||||
.button_classic {
|
||||
width: 215px;
|
||||
background-image: url(../../images/button_collapse_menu.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
|
@ -440,7 +439,7 @@ ul li {
|
|||
}
|
||||
|
||||
/* Menu height: 601px, 720px, 735px */
|
||||
@media screen and (max-height: 720px) {
|
||||
@media screen and (max-height: 750px) {
|
||||
.menu li,
|
||||
.menu li a,
|
||||
.menu li div {
|
||||
|
@ -448,7 +447,7 @@ ul li {
|
|||
}
|
||||
}
|
||||
|
||||
@media screen and (max-height: 735px) {
|
||||
@media screen and (max-height: 750px) {
|
||||
.operation {
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
|
|
@ -6038,7 +6038,6 @@ form#modal_form_feedback input[type="email"] {
|
|||
border: none;
|
||||
border-radius: 0;
|
||||
border-bottom: 1px solid #ccc;
|
||||
font-weight: lighter;
|
||||
padding: 0px 0px 2px 0px;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 4px;
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.760';
|
||||
$build = '220308';
|
||||
$build = '220311';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -176,6 +176,7 @@ function load_agents_selector(group) {
|
|||
{
|
||||
"page" : "operation/agentes/ver_agente",
|
||||
"get_agents_group_json" : 1,
|
||||
"get_agents_also_interfaces" : 1,
|
||||
"id_group" : group,
|
||||
"privilege" : "AW",
|
||||
"keys_prefix" : "_",
|
||||
|
@ -216,6 +217,7 @@ $("#checkbox-recursion").change (function () {
|
|||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/agentes/ver_agente",
|
||||
"get_agents_group_json" : 1,
|
||||
"get_agents_also_interfaces" : 1,
|
||||
"id_group" : $("#group_id").val(),
|
||||
"privilege" : "AW",
|
||||
"keys_prefix" : "_",
|
||||
|
@ -226,7 +228,6 @@ $("#checkbox-recursion").change (function () {
|
|||
$("#module").html('');
|
||||
jQuery.each (data, function (id, value) {
|
||||
id = id.substring(1);
|
||||
|
||||
option = $("<option></option>")
|
||||
.attr ("value", value["id_agente"])
|
||||
.html (value["alias"]);
|
||||
|
|
|
@ -49,6 +49,7 @@ if (is_ajax()) {
|
|||
$get_agent_modules_json = (bool) get_parameter('get_agent_modules_json');
|
||||
$get_agent_status_tooltip = (bool) get_parameter('get_agent_status_tooltip');
|
||||
$get_agents_group_json = (bool) get_parameter('get_agents_group_json');
|
||||
$get_agents_also_interfaces = (bool) get_parameter('get_agents_also_interfaces');
|
||||
$get_modules_group_json = (bool) get_parameter('get_modules_group_json');
|
||||
$filter_modules_group_json = (bool) get_parameter('filter_modules_group_json');
|
||||
$get_modules_group_value_name_json = (bool) get_parameter('get_modules_group_value_name_json');
|
||||
|
@ -103,15 +104,15 @@ if (is_ajax()) {
|
|||
// Build filter.
|
||||
$filter = [];
|
||||
|
||||
if (!empty($id_os)) {
|
||||
if (empty($id_os) === false) {
|
||||
$filter['id_os'] = $id_os;
|
||||
}
|
||||
|
||||
if (!empty($agent_name)) {
|
||||
if (empty($agent_name) === false) {
|
||||
$filter['nombre'] = '%'.$agent_name.'%';
|
||||
}
|
||||
|
||||
if (!empty($agent_alias)) {
|
||||
if (empty($agent_alias) === false) {
|
||||
$filter['alias'] = '%'.$agent_alias.'%';
|
||||
}
|
||||
|
||||
|
@ -147,6 +148,20 @@ if (is_ajax()) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($get_agents_also_interfaces === true) {
|
||||
$listAgentsWithIface = db_get_all_rows_sql("SELECT DISTINCT id_agente FROM tagente_modulo WHERE nombre LIKE '%_ifOperStatus'");
|
||||
if (empty($listAgentsWithIface) === false) {
|
||||
$filter['matchIds'] = array_reduce(
|
||||
$listAgentsWithIface,
|
||||
function ($carry, $item) {
|
||||
$carry[] = $item['id_agente'];
|
||||
return $carry;
|
||||
},
|
||||
[]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Perform search.
|
||||
$agents = agents_get_group_agents(
|
||||
// Id_group.
|
||||
|
@ -171,7 +186,7 @@ if (is_ajax()) {
|
|||
(bool) is_metaconsole()
|
||||
);
|
||||
|
||||
if (empty($agents)) {
|
||||
if (empty($agents) === true) {
|
||||
$agents = [];
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.760
|
||||
%define release 220308
|
||||
%define release 220311
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.760
|
||||
%define release 220308
|
||||
%define release 220311
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.760
|
||||
%define release 220308
|
||||
%define release 220311
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.760-220308
|
||||
Version: 7.0NG.760-220311
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.760-220308"
|
||||
pandora_version="7.0NG.760-220311"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -46,7 +46,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.760";
|
||||
my $pandora_build = "220308";
|
||||
my $pandora_build = "220311";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
@ -1388,8 +1388,13 @@ sub pandora_start_log ($){
|
|||
|
||||
# Dump all errors to errorlog
|
||||
open (STDERR, ">> " . $pa_config->{'errorlog_file'}) or die " [ERROR] " . pandora_get_initial_product_name() . " can't write to Errorlog. Aborting : \n $! \n";
|
||||
my $mode = 0664;
|
||||
|
||||
my $file_mode = (stat($pa_config->{'errorlog_file'}))[2] & 0777;
|
||||
my $min_mode = 0664;
|
||||
my $mode = $file_mode | $min_mode;
|
||||
|
||||
chmod $mode, $pa_config->{'errorlog_file'};
|
||||
|
||||
print STDERR strftime ("%Y-%m-%d %H:%M:%S", localtime()) . ' - ' . $pa_config->{'servername'} . " Starting " . pandora_get_initial_product_name() . " Server. Error logging activated.\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.760";
|
||||
my $pandora_build = "220308";
|
||||
my $pandora_build = "220311";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.760
|
||||
%define release 220308
|
||||
%define release 220311
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.760
|
||||
%define release 220308
|
||||
%define release 220311
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.760"
|
||||
PI_BUILD="220308"
|
||||
PI_BUILD="220311"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.760 Build 220308";
|
||||
my $version = "7.0NG.760 Build 220311";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.760 Build 220308";
|
||||
my $version = "7.0NG.760 Build 220311";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
Loading…
Reference in New Issue