diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index d165592662..74e0af2009 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-agent-unix
-Version: 7.0NG.770-230328
+Version: 7.0NG.770-230329
Architecture: all
Priority: optional
Section: admin
diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh
index ca1b28074c..b811cd3723 100644
--- a/pandora_agents/unix/DEBIAN/make_deb_package.sh
+++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-pandora_version="7.0NG.770-230328"
+pandora_version="7.0NG.770-230329"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent
index 198ce93a98..dab99b4711 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -1023,7 +1023,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.770';
-use constant AGENT_BUILD => '230328';
+use constant AGENT_BUILD => '230329';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec
index f7a6557826..df2f094194 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.770
-%define release 230328
+%define release 230329
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index 8463d27509..06fe72b342 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.770
-%define release 230328
+%define release 230329
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer
index 17bd442365..fbcef5e8ad 100755
--- a/pandora_agents/unix/pandora_agent_installer
+++ b/pandora_agents/unix/pandora_agent_installer
@@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.770"
-PI_BUILD="230328"
+PI_BUILD="230329"
OS_NAME=`uname -s`
FORCE=0
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index 91d152f1ca..30df9148e5 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
-{230328}
+{230329}
ViewReadme
{Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index dc40c0314b..3b69dd0af1 100644
--- a/pandora_agents/win32/pandora.cc
+++ b/pandora_agents/win32/pandora.cc
@@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
-#define PANDORA_VERSION ("7.0NG.770 Build 230328")
+#define PANDORA_VERSION ("7.0NG.770 Build 230329")
string pandora_path;
string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index 934cd7e37e..9786f5bb3a 100644
--- a/pandora_agents/win32/versioninfo.rc
+++ b/pandora_agents/win32/versioninfo.rc
@@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
- VALUE "ProductVersion", "(7.0NG.770(Build 230328))"
+ VALUE "ProductVersion", "(7.0NG.770(Build 230329))"
VALUE "FileVersion", "1.0.0.0"
END
END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index d30c602a99..2035eda646 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-console
-Version: 7.0NG.770-230328
+Version: 7.0NG.770-230329
Architecture: all
Priority: optional
Section: admin
diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh
index dcda7cf218..884edecb5b 100644
--- a/pandora_console/DEBIAN/make_deb_package.sh
+++ b/pandora_console/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-pandora_version="7.0NG.770-230328"
+pandora_version="7.0NG.770-230329"
package_pear=0
package_pandora=1
diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php
index d3467b846c..5bf3d18ab5 100644
--- a/pandora_console/extensions/agents_modules.php
+++ b/pandora_console/extensions/agents_modules.php
@@ -729,16 +729,31 @@ function mainAgentsModules()
if (isset($modules_selected[0]) === true && $modules_selected[0]) {
$all_modules = [];
foreach ($modules_selected as $key => $value) {
- $name = modules_get_agentmodule_name($value);
- $sql = "SELECT id_agente_modulo
- FROM tagente_modulo
- WHERE nombre = '".$name."';";
+ if (is_int($value)) {
+ $name = modules_get_agentmodule_name($value);
+ $sql = "SELECT id_agente_modulo
+ FROM tagente_modulo
+ WHERE nombre = '".$name."';";
- $result_sql = db_get_all_rows_sql($sql);
+ $result_sql = db_get_all_rows_sql($sql);
- if (is_array($result_sql)) {
- foreach ($result_sql as $key => $value) {
- $all_modules[$value['id_agente_modulo']] = io_safe_output($name);
+ if (is_array($result_sql)) {
+ foreach ($result_sql as $key => $value) {
+ $all_modules[$value['id_agente_modulo']] = io_safe_output($name);
+ }
+ }
+ } else {
+ $name = $value;
+ $sql = "SELECT id_agente_modulo
+ FROM tagente_modulo
+ WHERE nombre = '".$name."';";
+
+ $result_sql = db_get_all_rows_sql($sql);
+
+ if (is_array($result_sql)) {
+ foreach ($result_sql as $key => $value) {
+ $all_modules[$value['id_agente_modulo']] = io_safe_output($name);
+ }
}
}
}
@@ -838,7 +853,7 @@ function mainAgentsModules()
echo '
';
- echo "".__('Agents').' / '.__('Modules').' | ';
+ echo "".__('Agents').' / '.__('Modules').' | ';
if ($hor_offset > 0) {
$new_hor_offset = ($hor_offset - $block);
@@ -958,7 +973,7 @@ function mainAgentsModules()
foreach ($module['id'] as $module_id) {
if (!$match && array_key_exists($module_id, $agent_modules)) {
- echo "";
+ echo " | ";
$win_handle = dechex(crc32($module_id.$module['name']));
$graph_type = return_graphtype(modules_get_agentmodule_type($module_id));
$link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&'.'id='.$module_id.'&'.'refresh='.SECONDS_10MINUTES."', 'day_".$win_handle."', 800, 480)";
diff --git a/pandora_console/extras/mr/62.sql b/pandora_console/extras/mr/62.sql
index eaef394fcc..de8ff4c9d2 100644
--- a/pandora_console/extras/mr/62.sql
+++ b/pandora_console/extras/mr/62.sql
@@ -1,5 +1,19 @@
START TRANSACTION;
+CREATE TABLE IF NOT EXISTS `tconsole` (
+ `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
+ `id_console` BIGINT NOT NULL DEFAULT 0,
+ `description` TEXT,
+ `version` TINYTEXT,
+ `last_execution` INT UNSIGNED NOT NULL DEFAULT 0,
+ `console_type` TINYINT NOT NULL DEFAULT 0,
+ `timezone` TINYTEXT,
+ `public_url` TEXT,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
+
+ALTER TABLE `tuser_task_scheduled` ADD COLUMN `id_console` BIGINT NOT NULL DEFAULT 0;
+
ALTER TABLE `tdatabase` ADD COLUMN `ssh_status` TINYINT UNSIGNED DEFAULT 0;
ALTER TABLE `tdatabase` ADD COLUMN `db_status` TINYINT UNSIGNED DEFAULT 0;
ALTER TABLE `tdatabase` ADD COLUMN `replication_status` TINYINT UNSIGNED DEFAULT 0;
diff --git a/pandora_console/godmode/consoles/consoles.php b/pandora_console/godmode/consoles/consoles.php
new file mode 100644
index 0000000000..02bbe981aa
--- /dev/null
+++ b/pandora_console/godmode/consoles/consoles.php
@@ -0,0 +1,69 @@
+ $ajax_url,
+ 'message' => $message,
+ ]
+);
diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php
index e7408759a0..20a977f7fe 100644
--- a/pandora_console/godmode/menu.php
+++ b/pandora_console/godmode/menu.php
@@ -308,6 +308,13 @@ if ($access_console_node === true) {
$sub['godmode/servers/modificar_server']['id'] = 'Manage_servers';
}
+ if ((bool) check_acl($config['id_user'], 0, 'PM') === true
+ || is_user_admin($config['id_user']) === true
+ ) {
+ $sub['godmode/consoles/consoles']['text'] = __('Manage consoles');
+ $sub['godmode/consoles/consoles']['id'] = 'Manage consoles';
+ }
+
// This subtabs are only for Pandora Admin.
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
enterprise_hook('ha_cluster');
diff --git a/pandora_console/include/ajax/consoles.ajax.php b/pandora_console/include/ajax/consoles.ajax.php
new file mode 100644
index 0000000000..bb20320c75
--- /dev/null
+++ b/pandora_console/include/ajax/consoles.ajax.php
@@ -0,0 +1,96 @@
+ $data,
+ 'recordsTotal' => $count,
+ 'recordsFiltered' => $count,
+ ]
+ );
+
+ return;
+}
+
+if ($delete === true) {
+ $id = get_parameter('id');
+
+ try {
+ $console = new Console($id);
+ $console->delete();
+ $console->save();
+ echo json_encode(['result' => __('Console successfully deleted')]);
+ } catch (Exception $e) {
+ echo json_encode(['result' => $e->getMessage()]);
+ }
+
+ return;
+}
diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php
index fd138f7fbe..ed7b095f55 100644
--- a/pandora_console/include/auth/mysql.php
+++ b/pandora_console/include/auth/mysql.php
@@ -393,6 +393,10 @@ function process_user_login_remote($login, $pass, $api=false)
$user_info['metaconsole_access_node'] = $config['ldap_adv_user_node'];
}
+ if (isset($config['timezonevisual']) === true) {
+ $user_info['timezone'] = $config['timezonevisual'];
+ }
+
$permissions = fill_permissions_ldap($sr);
if (empty($permissions) === true) {
$config['auth_error'] = __('User not found in database or incorrect password');
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index 191fb8e151..bd150fc852 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
-$build_version = 'PC230328';
+$build_version = 'PC230329';
$pandora_version = 'v7.0NG.770';
// Do not overwrite default timezone set if defined.
diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php
index 9c10d5b8ba..505c160411 100644
--- a/pandora_console/include/functions_config.php
+++ b/pandora_console/include/functions_config.php
@@ -579,6 +579,10 @@ function config_update_config()
$error_update[] = __('Automatically assigned no hierarchy');
}
+ if (config_update_value('timezonevisual', (string) get_parameter('timezonevisual'), true) === false) {
+ $error_update[] = __('Automatically timezone visual');
+ }
+
if (config_update_value('autocreate_blacklist', get_parameter('autocreate_blacklist'), true) === false) {
$error_update[] = __('Autocreate blacklist');
}
diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php
index 6363958e09..8afc257399 100644
--- a/pandora_console/include/functions_events.php
+++ b/pandora_console/include/functions_events.php
@@ -4387,12 +4387,53 @@ function events_page_details($event, $server_id=0)
$data = [];
$data[0] = ' '.__('Last contact').' ';
- $data[1] = ($agent['ultimo_contacto'] == '1970-01-01 00:00:00') ? ''.__('N/A').'' : ui_print_timestamp($agent['ultimo_contacto'], true);
+
+ $user_timezone = users_get_user_by_id($_SESSION['id_usuario'])['timezone'];
+ if (!$user_timezone) {
+ $timezone = timezone_open(date_default_timezone_get());
+ $datetime_eur = date_create('now', timezone_open($config['timezone']));
+ $dif = timezone_offset_get($timezone, $datetime_eur);
+ date($config['date_format'], $dif);
+ if (!date('I')) {
+ // For summer -3600sec.
+ $dif -= 3600;
+ }
+
+ $total_sec = strtotime($agent['ultimo_contacto']);
+ $total_sec += $dif;
+ $last_contact = date($config['date_format'], $total_sec);
+ $last_contact_value = ui_print_timestamp($last_contact, true);
+ } else {
+ $user_timezone = users_get_user_by_id($_SESSION['id_usuario'])['timezone'];
+ date_default_timezone_set($user_timezone);
+
+ $last_contact_value = human_time_comparation(strtotime($agent['ultimo_contacto']), 'large');
+ }
+
+ $data[1] = ($agent['ultimo_contacto'] == '1970-01-01 00:00:00') ? ''.__('N/A').'' : $last_contact_value;
$table_details->data[] = $data;
+ $user_timezone = users_get_user_by_id($_SESSION['id_usuario'])['timezone'];
+ if (!$user_timezone) {
+ $timezone = timezone_open(date_default_timezone_get());
+ $datetime_eur = date_create('now', timezone_open($config['timezone']));
+ $dif = timezone_offset_get($timezone, $datetime_eur);
+ date($config['date_format'], $dif);
+ if (!date('I')) {
+ // For summer -3600sec.
+ $dif -= 3600;
+ }
+
+ $total_sec = strtotime($agent['ultimo_contacto_remoto']);
+ $total_sec += $dif;
+ $lr_contact = date($config['date_format'], $total_sec);
+ } else {
+ $lr_contact = date($config['date_format'], strtotime($agent['ultimo_contacto_remoto']));
+ }
+
$data = [];
$data[0] = ''.__('Last remote contact').' ';
- $data[1] = ($agent['ultimo_contacto_remoto'] == '1970-01-01 00:00:00') ? ''.__('N/A').'' : date_w_fixed_tz($agent['ultimo_contacto_remoto']);
+ $data[1] = ($agent['ultimo_contacto_remoto'] == '1970-01-01 00:00:00') ? ''.__('N/A').'' : $lr_contact;
$table_details->data[] = $data;
$data = [];
@@ -4879,6 +4920,13 @@ function events_page_general($event)
$data[1] .= __('Last event').': ';
$data[1] .= date($config['date_format'], $event['timestamp_last']);
} else {
+ $user_timezone = users_get_user_by_id($_SESSION['id_usuario'])['timezone'];
+ if ($user_timezone) {
+ date_default_timezone_set($user_timezone);
+ } else {
+ date_default_timezone_set($config['timezone']);
+ }
+
$data[1] = date($config['date_format'], $event['utimestamp']);
}
diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php
index 66f60967c7..1e5297dbff 100644
--- a/pandora_console/include/functions_filemanager.php
+++ b/pandora_console/include/functions_filemanager.php
@@ -751,7 +751,7 @@ function filemanager_file_explorer(
&& ($readOnly === false)
) {
$data[4] .= ' |