Merge branch 'develop' into ent-8365-ncm-fase-3

This commit is contained in:
Jonathan 2023-12-11 10:13:46 +01:00
commit 49fd9435dd
52 changed files with 1150 additions and 182 deletions

View File

@ -234,6 +234,21 @@ module_description Number of cron task files
module_unit files module_unit files
module_end module_end
# This module /var/log/syslog file, under the module name "syslog"
# And search for "ssh" string into it, sending only that information.
module_begin
module_name Syslog
module_description Search for ssh string into /var/log/syslog file
module_type log
module_regexp /var/log/syslog
module_pattern ssh
module_end
#Hardening plugin for security compliance analysis. Enable to use it.
#module_begin
#module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150
#module_absoluteinterval 7d
#module_end
# Plugin example # Plugin example
@ -241,11 +256,6 @@ module_end
module_plugin pandora_df module_plugin pandora_df
# This parses /var/log/syslog file, under the module name "syslog"
# And search for "ssh" string into it, sending only that information.
module_plugin grep_log /var/log/syslog Syslog ssh
# Get disk space free in MB # Get disk space free in MB
#module_begin #module_begin
#module_name disk_root_free #module_name disk_root_free
@ -270,7 +280,6 @@ module_plugin grep_log /var/log/syslog Syslog ssh
#module_end #module_end
# Plugin for inventory on the agent. # Plugin for inventory on the agent.
# module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users process ip route # module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users process ip route
# Example of preconditions # Example of preconditions
@ -303,4 +312,13 @@ module_plugin grep_log /var/log/syslog Syslog ssh
# This plugin runs several security checks in a Linux system # This plugin runs several security checks in a Linux system
#module_plugin pandora_security_check #module_plugin pandora_security_check
# Extraction module example
#module_begin
#module_name Collector
#module_description Logs extraction module
#module_type log
#module_regexp /var/log/logfile.log
#module_pattern .*
#module_end

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2023 Pandora FMS # (c) 2006-2023 Pandora FMS
# Version 7.0NG.774 # Version 7.0NG.774
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version # Foundation; either version 2 of the Licence or any later version
@ -147,22 +147,23 @@ module_max_critical 20
module_end module_end
# Log events # Log events
# Get logs from System source.
module_begin module_begin
module_name System Events (TermService) module_name System Events (TermService)
module_type async_string
module_logevent
module_description Log Events coming from Terminal Service module_description Log Events coming from Terminal Service
module_type log
module_logevent
module_source System module_source System
module_application TermService
module_end module_end
# Get logs from Security source.
module_begin module_begin
module_name Security Events (Invalid Login) module_name Security Events
module_type async_string module_description Security log events
module_description Security log events for invalid login attempt module_type log
module_logevent module_logevent
module_source Security module_source Security
module_eventcode 529
module_end module_end
# Check if Dhcp service is enabled # Check if Dhcp service is enabled
@ -219,6 +220,12 @@ module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df.vbs"
# module_description Free space on drive D: (%) # module_description Free space on drive D: (%)
# module_end # module_end
# Hardening plugin for security compliance analysis.
# module_begin
# module_plugin "%PROGRAMFILES%\Pandora_Agent\util\pandora_hardening.exe -t 150"
# module_absoluteinterval 7d
# module_end
# Sample of Windows inventory module (ONLY ENTERPRISE)! # Sample of Windows inventory module (ONLY ENTERPRISE)!
#module_begin #module_begin
#module_name Inventory #module_name Inventory
@ -344,4 +351,13 @@ module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df.vbs"
#module_condition (3,8) cmd.exe /c echo range >> c:\log.txt #module_condition (3,8) cmd.exe /c echo range >> c:\log.txt
#module_exec echo 5 #module_exec echo 5
#module_description Postcondition test module #module_description Postcondition test module
#module_end
# Example of collector module
#module_begin
#module_name Collector
#module_description Logs extraction module
#module_type log
#module_regexp /var/log/logfile.log
#module_pattern .*
#module_end #module_end

View File

@ -157,12 +157,32 @@ module_exec last | head -1
module_description Last Login module_description Last Login
module_end module_end
# Plugin example #Hardening plugin for security compliance analysis. Enable to use it.
#module_begin
#module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150
#module_absoluteinterval 7d
#module_end
# This parses /var/log/syslog file, under the module name "syslog" # This module parses /var/log/syslog file, under the module name "syslog"
# And search for "ssh" string into it, sending only that information. # And search for "ssh" string into it, sending only that information.
module_begin
module_name Syslog
module_description Search for ssh string into /var/log/syslog file
module_type log
module_regexp /var/log/syslog
module_pattern ssh
module_end
module_plugin grep_log /var/log/syslog Syslog ssh # Plugin example
# Plugin for inventory on the agent. # Plugin for inventory on the agent.
# module_plugin inventory 1 cpu ram video nic hd cdrom software # module_plugin inventory 1 cpu ram video nic hd cdrom software
# Extraction module example
#module_begin
#module_name Collector
#module_description Logs extraction module
#module_type log
#module_regexp /var/log/logfile.log
#module_pattern .*
#module_end

View File

@ -372,13 +372,32 @@ module_end
#module_description XGrid #module_description XGrid
#module_end #module_end
#Hardening plugin for security compliance analysis. Enable to use it.
#module_begin
#module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150
#module_absoluteinterval 7d
#module_end
# This module parses /var/log/syslog file, under the module name "syslog"
# And search for "ssh" string into it, sending only that information.
module_begin
module_name Syslog
module_description Log collection modules
module_type log
module_regexp /var/log/syslog
module_pattern ssh
module_end
# Plugin example # Plugin example
# This parses /var/log/syslog file, under the module name "syslog"
# And search for "ssh" string into it, sending only that information.
#module_plugin grep_log /var/log/syslog Syslog ssh
# Plugin for inventory on the agent. # Plugin for inventory on the agent.
# module_plugin inventory 1 cpu ram video nic hd cdrom software # module_plugin inventory 1 cpu ram video nic hd cdrom software
# Extraction module example
#module_begin
#module_name Collector
#module_description Logs extraction module
#module_type log
#module_regexp /var/log/logfile.log
#module_pattern .*
#module_end

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.774-231207 Version: 7.0NG.774-231211
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.774-231207" pandora_version="7.0NG.774-231211"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -271,11 +271,17 @@ module_plugin pandora_netusage
module_plugin autodiscover --default module_plugin autodiscover --default
# Plugin for inventory on the agent. # Plugin for inventory on the agent.
#module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route # module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route
# Log collection modules. This will collect log files for forensic analysis and store everything # Log collection modules. This will collect log files for forensic analysis and store everything
# This is for LOG monitoring. Different than log monitoring. # This is for LOG monitoring. Different than log monitoring.
#module_plugin grep_log_module /var/log/messages Syslog \.\* module_begin
module_name Syslog
module_description Log collection modules
module_type log
module_regexp /var/log/messages
module_pattern .*
module_end
# Another samples of monitoring modules # Another samples of monitoring modules
@ -317,9 +323,9 @@ module_plugin autodiscover --default
#module_absoluteinterval 7d #module_absoluteinterval 7d
#module_end #module_end
# Logs extraction # Extraction module example
#module_begin #module_begin
#module_name Syslog #module_name Collector
#module_description Logs extraction module #module_description Logs extraction module
#module_type log #module_type log
#module_regexp /var/log/logfile.log #module_regexp /var/log/logfile.log

View File

@ -1039,7 +1039,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.774'; use constant AGENT_VERSION => '7.0NG.774';
use constant AGENT_BUILD => '231207'; use constant AGENT_BUILD => '231211';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231207 %define release 231211
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin %define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux %define source_name pandorafms_agent_linux
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231207 %define release 231211
%define debug_package %{nil} %define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin %define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux %define source_name pandorafms_agent_linux
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231207 %define release 231211
%define debug_package %{nil} %define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin %define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux %define source_name pandorafms_agent_linux
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231207 %define release 231211
Summary: Pandora FMS Linux agent, binary version Summary: Pandora FMS Linux agent, binary version
Name: %{name} Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231207 %define release 231211
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.774" PI_VERSION="7.0NG.774"
PI_BUILD="231207" PI_BUILD="231211"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -179,6 +179,22 @@ module_description Total number of TCP connections active
module_group Networking module_group Networking
module_end module_end
# Get logs from System source.
module_begin
module_name Eventlog_System
module_type log
module_logevent
module_source System
module_end
# Get logs from Security source.
module_begin
module_name Eventlog_Security
module_type log
module_logevent
module_source Security
module_end
# Example plugin to retrieve drive usage # Example plugin to retrieve drive usage
module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent_used.vbs" module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent_used.vbs"
@ -273,22 +289,6 @@ module_plugin "%PROGRAMFILES%\Pandora_Agent\util\autodiscover.exe" --default
#module_type generic_data_string #module_type generic_data_string
#module_end #module_end
# Get logs from System source. Need enterprise version.
#module_begin
#module_name Eventlog_System
#module_type log
#module_logevent
#module_source System
#module_end
# Get logs from Security source. Need enterprise version.
#module_begin
#module_name Eventlog_Security
#module_type log
#module_logevent
#module_source Security
#module_end
# Get logs from Application source. Need enterprise version. # Get logs from Application source. Need enterprise version.
#module_begin #module_begin
#module_name Eventlog_Application #module_name Eventlog_Application

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{231207} {231211}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.774 Build 231207") #define PANDORA_VERSION ("7.0NG.774 Build 231211")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS" VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.774(Build 231207))" VALUE "ProductVersion", "(7.0NG.774(Build 231211))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.774-231207 Version: 7.0NG.774-231211
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.774-231207" pandora_version="7.0NG.774-231211"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -183,7 +183,9 @@ if (isset($config['force_instant_logout']) === true
$_SESSION = []; $_SESSION = [];
session_destroy(); session_destroy();
header_remove('Set-Cookie'); header_remove('Set-Cookie');
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/'); if (isset($_COOKIE[session_name()]) === true) {
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
}
if ($config['auth'] === 'saml' && empty($public_hash) === true) { if ($config['auth'] === 'saml' && empty($public_hash) === true) {
include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php'; include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php';

View File

@ -1057,6 +1057,22 @@ UPDATE talert_actions
UPDATE talert_actions UPDATE talert_actions
SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_' SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_'
WHERE id=11; WHERE id=11;
SET @exist = (SELECT count(*) FROM information_schema.columns WHERE TABLE_NAME='tmetaconsole_agent' AND COLUMN_NAME='transactional_agent' AND table_schema = DATABASE());
SET @sqlstmt = IF (@exist>0, 'ALTER TABLE `tmetaconsole_agent` DROP COLUMN `transactional_agent`', 'SELECT ""');
prepare stmt from @sqlstmt;
execute stmt;
SET @exist = (SELECT count(*) FROM information_schema.columns WHERE TABLE_NAME='tagente' AND COLUMN_NAME='transactional_agent' AND table_schema = DATABASE());
SET @sqlstmt = IF (@exist>0, 'ALTER TABLE `tagente` DROP COLUMN `transactional_agent`', 'SELECT ""');
prepare stmt from @sqlstmt;
execute stmt;
ALTER TABLE `tdashboard`
ADD COLUMN `date_range` TINYINT NOT NULL DEFAULT 0 AFTER `cells_slideshow`,
ADD COLUMN `date_from` INT NOT NULL DEFAULT 0 AFTER `date_range`,
ADD COLUMN `date_to` INT NOT NULL DEFAULT 0 AFTER `date_from`;
-- Delete table tagent_access -- Delete table tagent_access
DROP TABLE IF EXISTS tagent_access; DROP TABLE IF EXISTS tagent_access;
@ -1065,10 +1081,8 @@ ALTER TABLE `tevent_rule` DROP COLUMN `operator_user_comment`;
ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL; ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL;
ALTER TABLE `tevent_filter` ALTER TABLE `tevent_filter` ADD COLUMN `regex` TEXT NULL AFTER `private_filter_user`;
ADD COLUMN `regex` TEXT NULL AFTER `private_filter_user`;
-- Update macros for plugin oracle -- Update macros for plugin oracle
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.oracle'; UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.oracle';
SET @id_app := (SELECT `id_app` FROM `tdiscovery_apps` WHERE `short_name` = 'pandorafms.oracle'); SET @id_app := (SELECT `id_app` FROM `tdiscovery_apps` WHERE `short_name` = 'pandorafms.oracle');
@ -1082,11 +1096,6 @@ UPDATE `trecon_task` SET `setup_complete` = 1 WHERE `id_app` = @id_app;
-- Update lts updates -- Update lts updates
UPDATE tconfig SET value='1' WHERE token='lts_updates'; UPDATE tconfig SET value='1' WHERE token='lts_updates';
ALTER TABLE `tdashboard`
ADD COLUMN `date_range` TINYINT NOT NULL DEFAULT 0 AFTER `cells_slideshow`,
ADD COLUMN `date_from` INT NOT NULL DEFAULT 0 AFTER `date_range`,
ADD COLUMN `date_to` INT NOT NULL DEFAULT 0 AFTER `date_from`;
SELECT @generic_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_data"; SELECT @generic_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_data";
SELECT @generic_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_proc"; SELECT @generic_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_proc";
SELECT @async_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_data"; SELECT @async_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_data";
@ -1094,4 +1103,8 @@ SELECT @async_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_proc
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_data WHERE `tagente_modulo`.`id_tipo_modulo` = @async_data; UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_data WHERE `tagente_modulo`.`id_tipo_modulo` = @async_data;
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_proc WHERE `tagente_modulo`.`id_tipo_modulo` = @async_proc; UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_proc WHERE `tagente_modulo`.`id_tipo_modulo` = @async_proc;
-- Telegram and vonage default alerts
UPDATE talert_actions SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_' WHERE id=9;
UPDATE talert_actions SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_' WHERE id=11;
COMMIT; COMMIT;

View File

@ -111,7 +111,8 @@ if ($delete) {
$alerts_agent_modules = []; $alerts_agent_modules = [];
foreach ($agent_alerts['simple'] as $agent_alert) { foreach ($agent_alerts['simple'] as $agent_alert) {
if ((in_array($agent_alert['id_alert_template'], $id_alert_templates)) && (in_array($agent_alert['id_agent_module'], $modules_id))) { if ((in_array($agent_alert['id_alert_template'], $id_alert_templates)) && (in_array($agent_alert['id_agent_module'], $modules_id))) {
$alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module($agent_alert['id_agent_module'], true, false, 'id')); // $alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module($agent_alert['id_agent_module'], true, false, 'id'));
$alerts_agent_modules[] = $agent_alert['id'];
} }
} }
@ -126,7 +127,7 @@ if ($delete) {
$agent_module_actions = []; $agent_module_actions = [];
foreach ($alerts_agent_modules as $alert_agent_module) { foreach ($alerts_agent_modules as $alert_agent_module) {
$agent_module_actions = alerts_get_alert_agent_module_actions($alert_agent_module['id'], ['id', 'id_alert_action']); $agent_module_actions = alerts_get_alert_agent_module_actions($alert_agent_module, ['id', 'id_alert_action']);
foreach ($agent_module_actions as $agent_module_action) { foreach ($agent_module_actions as $agent_module_action) {
foreach ($actions as $action) { foreach ($actions as $action) {

View File

@ -478,8 +478,8 @@ if ($access_console_node === true) {
} }
} }
$sub2['godmode/setup/setup&section=ehorus']['text'] = __('Pandora RC'); $sub2['godmode/setup/setup&section=pandorarc']['text'] = __('Pandora RC');
$sub2['godmode/setup/setup&section=ehorus']['refr'] = 0; $sub2['godmode/setup/setup&section=pandorarc']['refr'] = 0;
$sub2['godmode/setup/setup&section=ITSM']['text'] = __('ITSM'); $sub2['godmode/setup/setup&section=ITSM']['text'] = __('ITSM');
$sub2['godmode/setup/setup&section=ITSM']['refr'] = 0; $sub2['godmode/setup/setup&section=ITSM']['refr'] = 0;

View File

@ -184,7 +184,7 @@ $buttons['ITSM'] = [
$buttons['ehorus'] = [ $buttons['ehorus'] = [
'active' => false, 'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=ehorus').'">'.html_print_image( 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=pandorarc').'">'.html_print_image(
'images/RC.png', 'images/RC.png',
true, true,
[ [
@ -297,7 +297,7 @@ switch ($section) {
$help_header = 'setup_flow_tab'; $help_header = 'setup_flow_tab';
break; break;
case 'ehorus': case 'pandorarc':
$buttons['ehorus']['active'] = true; $buttons['ehorus']['active'] = true;
$subpage = __('Pandora RC'); $subpage = __('Pandora RC');
$help_header = 'setup_ehorus_tab'; $help_header = 'setup_ehorus_tab';
@ -442,7 +442,7 @@ switch ($section) {
include_once $config['homedir'].'/godmode/setup/setup_visuals.php'; include_once $config['homedir'].'/godmode/setup/setup_visuals.php';
break; break;
case 'ehorus': case 'pandorarc':
include_once $config['homedir'].'/godmode/setup/setup_ehorus.php'; include_once $config['homedir'].'/godmode/setup/setup_ehorus.php';
break; break;

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC231207'; $build_version = 'PC231211';
$pandora_version = 'v7.0NG.774'; $pandora_version = 'v7.0NG.774';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -306,32 +306,48 @@ function format_for_graph(
} }
function human_milliseconds_to_string($seconds) function human_milliseconds_to_string($seconds, $size_text='large')
{ {
$ret = ''; $ret = '';
// get the days // get the days
$days = intval(intval($seconds) / (360000 * 24)); $days = intval(intval($seconds) / (360000 * 24));
if ($days > 0) { if ($days > 0) {
$ret .= "$days days "; if ($size_text === 'short') {
$ret .= str_replace(' ', '', "$days d").' ';
} else {
$ret .= "$days days ";
}
} }
// get the hours // get the hours
$hours = ((intval($seconds) / 360000) % 24); $hours = ((intval($seconds) / 360000) % 24);
if ($hours > 0) { if ($hours > 0) {
$ret .= "$hours hours "; if ($size_text === 'short') {
$ret .= str_replace(' ', '', "$hours h").' ';
} else {
$ret .= "$hours hours ";
}
} }
// get the minutes // get the minutes
$minutes = ((intval($seconds) / 6000) % 60); $minutes = ((intval($seconds) / 6000) % 60);
if ($minutes > 0) { if ($minutes > 0) {
$ret .= "$minutes minutes "; if ($size_text === 'short') {
$ret .= str_replace(' ', '', "$minutes m").' ';
} else {
$ret .= "$minutes minutes ";
}
} }
// get the seconds // get the seconds
$seconds = ((intval($seconds) / 100) % 60); $seconds = ((intval($seconds) / 100) % 60);
if ($seconds > 0) { if ($seconds > 0) {
$ret .= "$seconds seconds"; if ($size_text === 'short') {
$ret .= str_replace(' ', '', "$seconds s").' ';
} else {
$ret .= "$seconds seconds ";
}
} }
return $ret; return $ret;

View File

@ -459,17 +459,17 @@ function cron_task_start_gotty(bool $restart_mode=true)
// Check prev process running and kill it (only if port changed in setup params). // Check prev process running and kill it (only if port changed in setup params).
if (empty($config['restart_gotty_next_cron_port']) === false) { if (empty($config['restart_gotty_next_cron_port']) === false) {
config_update_value('restart_gotty_next_cron_port', ''); $prevProcessRunning = shell_exec("pgrep -af 'pandora_gotty.*-p ".$config['restart_gotty_next_cron_port']."' | grep -v 'pgrep'");
$prevProcessRunning = shell_exec("pgrep -f 'pandora_gotty.*-p ".$config['restart_gotty_next_cron_port']."'");
if (empty($prevProcessRunning) === false) { if (empty($prevProcessRunning) === false) {
shell_exec("pkill -f 'pandora_gotty.*-p ".$config['restart_gotty_next_cron_port']."'"); shell_exec("pkill -f 'pandora_gotty.*-p ".$config['restart_gotty_next_cron_port']."'");
} }
config_update_value('restart_gotty_next_cron_port', '');
} }
// Check if gotty is running on the configured port. // Check if gotty is running on the configured port.
$processRunning = shell_exec("pgrep -f 'pandora_gotty.*-p ".$config['gotty_port']."'"); $processRunning = shell_exec("pgrep -af 'pandora_gotty.*-p ".$config['gotty_port']."' | grep -v 'pgrep'");
$start_proc = true; $start_proc = true;

View File

@ -4770,7 +4770,231 @@ function export_agents_module_csv($filters)
/** /**
* Check if modules are compatible with MADE server. * Function to return Mean Time Between Failure, Mean Time To Solution (in seconds)
* and Availability of a module
*
* @param string $datetime_from Start time of the interval.
*
* @param string $datetime_to End time of the interval.
*
* @param string $id_agentmodule id_agentmodule of the module
*
* @return array Returns an array with the data
*/
function service_level_module_data($datetime_from, $datetime_to, $id_agentmodule)
{
$data = [];
$data['mtbf'] = false;
$data['mtrs'] = false;
$data['availability'] = false;
$data['critical_events'] = false;
$data['warning_events'] = false;
$data['last_status_change'] = false;
$data['module_name'] = false;
$availability = 0;
$type = '';
if ((bool) is_metaconsole() === true) {
if (enterprise_include_once('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) {
$server_id = [];
$server_id['id'] = explode('|', $id_agentmodule)[0];
$id_agentmodule = explode('|', $id_agentmodule)[1];
$server_name = db_get_row_filter('tmetaconsole_setup', $server_id, 'server_name');
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) !== NOERR) {
// Restore db connection.
metaconsole_restore_db();
return $data;
}
}
}
$uncompressed_data = db_uncompress_module_data(
$id_agentmodule,
$datetime_from,
$datetime_to
);
$first_utimestamp = 0;
foreach ($uncompressed_data as $data_module) {
foreach ($data_module['data'] as $subdata) {
if (!empty($subdata['datos'])) {
$first_utimestamp = $subdata['utimestamp'];
if (isset($subdata['type'])) {
$type = $subdata['type'];
}
break;
}
}
}
$interval_time = ($datetime_to - $datetime_from);
$current_time = time();
$sql = 'SELECT utimestamp, event_type FROM tevento
WHERE id_agentmodule = '.$id_agentmodule.'
AND utimestamp >= '.$datetime_from.'
AND utimestamp <= '.$datetime_to.'
ORDER BY utimestamp DESC';
$events_time = db_get_all_rows_sql($sql);
// Count events.
$sql = 'SELECT COUNT(*) as critical_events FROM tevento
WHERE id_agentmodule= '.$id_agentmodule.'
AND utimestamp >= '.$datetime_from.'
AND utimestamp <= '.$datetime_to.'
AND (event_type = "going_up_critical" OR event_type = "going_down_critical")';
$critical_events = db_get_sql($sql);
$sql = 'SELECT COUNT(*) as warning_events FROM tevento
WHERE id_agentmodule= '.$id_agentmodule.'
AND utimestamp >= '.$datetime_from.'
AND utimestamp <= '.$datetime_to.'
AND (event_type = "going_up_warning" OR event_type = "going_down_warning")';
$warning_events = db_get_sql($sql);
if ($events_time !== false && count($events_time) > 0) {
$failed_event = [];
$normal_event = [];
$events_time = array_reverse($events_time);
$mtrs_events = [];
foreach ($events_time as $key => $event) {
if ($event['event_type'] === 'going_up_critical' || $event['event_type'] === 'going_down_critical') {
$failed_event[] = $event['utimestamp'];
$mtrs_events[]['failed_event'] = $event['utimestamp'];
}
if ($event['event_type'] === 'going_up_normal'
|| $event['event_type'] === 'going_down_normal'
|| $event['event_type'] === 'going_up_warning'
|| $event['event_type'] === 'going_down_warning'
) {
$normal_event[] = $event['utimestamp'];
$mtrs_events[]['normal_event'] = $event['utimestamp'];
}
}
$process_mtrs_events = [];
if (empty($mtrs_events) === false) {
$last_event_key = '';
foreach ($mtrs_events as $key => $val) {
if (key($val) !== $last_event_key) {
$last_event_key = key($val);
$process_mtrs_events[] = $val;
}
}
}
$mtrs_array = [];
if (empty($normal_event) === true) {
$mtrs_array[] = ($current_time - $failed_event[0]);
} else if (empty($failed_event) === true) {
$mtrs_array[] = 0;
} else {
$last_value = '';
foreach ($process_mtrs_events as $key => $val) {
$current_value = $val[key($val)];
if ($last_value !== '') {
$mtrs_array[] = ($current_value - $last_value);
}
$last_value = $current_value;
}
$last_mtrs_event = key(end($process_mtrs_events));
if ($last_mtrs_event === 'failed_event') {
$mtrs_array[] = ($current_time - $last_value);
}
}
$mtbf_array = [];
if (!empty($failed_event) === true) {
if (count($failed_event) > 1) {
for ($i = 1; $i <= array_key_last($failed_event); $i++) {
$mtbf_array[] = ($failed_event[$i] - ($failed_event[($i - 1)]));
}
} else {
$mtbf_array[] = 0;
}
} else {
$mtbf_array[] = 0;
}
$total_time_failed = array_sum($mtrs_array);
$total_time_ok = ($interval_time - $total_time_failed);
if (count($events_time) === 1) {
if ((int) $first_utimestamp !== 0) {
$availability = round((($total_time_ok / $interval_time) * 100), 2);
}
} else {
$availability = round((($total_time_ok / $interval_time) * 100), 2);
}
if ($critical_events > 1) {
$mtbf = round(array_sum($mtbf_array) / count($mtbf_array));
} else {
$mtbf = false;
}
if (count($mtrs_array) === 1 && (int) $first_utimestamp !== 0) {
$mtrs = round($total_time_failed / count($mtrs_array));
} else if (count($mtrs_array) > 1 && (int) $first_utimestamp !== 0) {
$mtrs = round((array_sum($mtrs_array) / count($mtrs_array)));
} else {
$mtrs = false;
}
$data['mtbf'] = $mtbf;
$data['mtrs'] = $mtrs;
$data['availability'] = $availability;
} else {
$data['mtbf'] = false;
$data['mtrs'] = false;
$data['availability'] = false;
}
// Get last status change.
$sql = 'SELECT last_status_change FROM tagente_estado
WHERE id_agente_modulo = '.$id_agentmodule.' ';
$last_status_change = db_get_sql($sql);
// Get module name.
/*
$sql = 'SELECT nombre FROM tagente_modulo
WHERE id_agente_modulo = '.$id_agentmodule;*/
$sql = 'SELECT tagente_modulo.nombre as nombre, tagente.alias as alias
FROM tagente_modulo INNER JOIN tagente
ON tagente_modulo.id_agente = tagente.id_agente
WHERE id_agente_modulo = '.$id_agentmodule.' ';
$sql_query = db_get_all_rows_sql($sql);
$data['critical_events'] = $critical_events;
$data['warning_events'] = $warning_events;
$data['last_status_change'] = $last_status_change;
$data['module_name'] = $sql_query[0]['nombre'];
if ((bool) is_metaconsole() === true) {
$data['agent_alias'] = $server_name['server_name'].' » '.$sql_query[0]['alias'];
} else {
$data['agent_alias'] = $sql_query[0]['alias'];
}
if ((bool) is_metaconsole() === true) {
metaconsole_restore_db();
}
return $data;
}
/*
Check if modules are compatible with MADE server.
* *
* @param integer $id_tipo_modulo * @param integer $id_tipo_modulo
* @retur boolean True if compatible, false otherwise. * @retur boolean True if compatible, false otherwise.

View File

@ -4956,7 +4956,7 @@ function reporting_html_value(
$table2->head = [ $table2->head = [
__('Agent'), __('Agent'),
__('Module'), __('Module'),
__('Minimun'), __('Minimum'),
]; ];
break; break;
@ -5027,7 +5027,7 @@ function reporting_html_value(
case 'min_value': case 'min_value':
$table1->head = [ $table1->head = [
__('Lapse'), __('Lapse'),
__('Minimun'), __('Minimum'),
]; ];
break; break;

View File

@ -808,8 +808,8 @@ function loadVisualConsoleData(
getVisualConsoleItems: 1, getVisualConsoleItems: 1,
size: size, size: size,
visualConsoleId: vcId, visualConsoleId: vcId,
id_user: typeof id_user == undefined ? id_user : null, id_user: typeof id_user !== undefined ? id_user : null,
auth_hash: typeof hash == undefined ? hash : null, auth_hash: typeof hash !== undefined ? hash : null,
mode: mode, mode: mode,
widthScreen: widthScreen widthScreen: widthScreen
}, },

View File

@ -466,6 +466,10 @@ class Widget
$className .= '\HeatmapWidget'; $className .= '\HeatmapWidget';
break; break;
case 'service_level':
$className .= '\ServiceLevelWidget';
break;
case 'security_hardening': case 'security_hardening':
if (\enterprise_installed() === false) { if (\enterprise_installed() === false) {
$not_installed = true; $not_installed = true;

View File

@ -0,0 +1,672 @@
<?php
/**
* Widget Service Level Pandora FMS Console
*
* @category Console Class
* @package Pandora FMS
* @subpackage Widget Service Level
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ 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.
* ============================================================================
*/
namespace PandoraFMS\Dashboard;
use PandoraFMS\Agent;
use PandoraFMS\Module;
/**
* Service Level Widgets
*/
class ServiceLevelWidget extends Widget
{
/**
* Name widget.
*
* @var string
*/
protected $name;
/**
* Title widget.
*
* @var string
*/
protected $title;
/**
* Page widget;
*
* @var string
*/
protected $page;
/**
* Class name widget.
*
* @var [type]
*/
protected $className;
/**
* Values options for each widget.
*
* @var [type]
*/
protected $values;
/**
* Configuration required.
*
* @var boolean
*/
protected $configurationRequired;
/**
* Error load widget.
*
* @var boolean
*/
protected $loadError;
/**
* Width.
*
* @var integer
*/
protected $width;
/**
* Heigth.
*
* @var integer
*/
protected $height;
/**
* Grid Width.
*
* @var integer
*/
protected $gridWidth;
/**
* Construct.
*
* @param integer $cellId Cell ID.
* @param integer $dashboardId Dashboard ID.
* @param integer $widgetId Widget ID.
* @param integer|null $width New width.
* @param integer|null $height New height.
* @param integer|null $gridWidth Grid width.
*/
public function __construct(
int $cellId,
int $dashboardId=0,
int $widgetId=0,
?int $width=0,
?int $height=0,
?int $gridWidth=0
) {
global $config;
include_once $config['homedir'].'/include/functions_agents.php';
include_once $config['homedir'].'/include/functions_modules.php';
// WARNING: Do not edit. This chunk must be in the constructor.
parent::__construct(
$cellId,
$dashboardId,
$widgetId
);
// Width.
$this->width = $width;
// Height.
$this->height = $height;
// Grid Width.
$this->gridWidth = $gridWidth;
// Options.
$this->values = $this->decoders($this->getOptionsWidget());
// Positions.
$this->position = $this->getPositionWidget();
// Page.
$this->page = basename(__FILE__);
// ClassName.
$class = new \ReflectionClass($this);
$this->className = $class->getShortName();
// Title.
$this->title = __('Service Level Detail');
// Name.
if (empty($this->name) === true) {
$this->name = 'service_level';
}
// This forces at least a first configuration.
$this->configurationRequired = false;
if (isset($this->values['mModules']) === false) {
$this->configurationRequired = true;
}
$this->overflow_scrollbars = false;
}
/**
* Decoders hack for retrocompability.
*
* @param array $decoder Values.
*
* @return array Returns the values with the correct key.
*/
public function decoders(array $decoder): array
{
$values = [];
// Retrieve global - common inputs.
$values = parent::decoders($decoder);
if (isset($decoder['interval']) === true) {
$values['interval'] = $decoder['interval'];
} else {
$values['interval'] = '28800';
}
if (isset($decoder['show_agents']) === true) {
$values['show_agents'] = $decoder['show_agents'];
} else {
$values['show_agents'] = '0';
}
if (isset($decoder['mTypeShow']) === true) {
$values['mTypeShow'] = $decoder['mTypeShow'];
}
if (isset($decoder['mGroup']) === true) {
$values['mGroup'] = $decoder['mGroup'];
}
if (isset($decoder['mRecursion']) === true) {
$values['mRecursion'] = $decoder['mRecursion'];
}
if (isset($decoder['mModuleGroup']) === true) {
$values['mModuleGroup'] = $decoder['mModuleGroup'];
}
if (isset($decoder['mAgents']) === true) {
$values['mAgents'] = $decoder['mAgents'];
}
if (isset($decoder['mShowCommonModules']) === true) {
$values['mShowCommonModules'] = $decoder['mShowCommonModules'];
}
if (isset($decoder['mModules']) === true) {
$values['mModules'] = $decoder['mModules'];
}
return $values;
}
/**
* Generates inputs for form (specific).
*
* @return array Of inputs.
*
* @throws Exception On error.
*/
public function getFormInputs(): array
{
$values = $this->values;
// Retrieve global - common inputs.
$inputs = parent::getFormInputs();
// Interval.
$fields = [
'604800' => __('1 week'),
'172800' => __('48 hours'),
'86400' => __('24 hours'),
'43200' => __('12 hours'),
'28800' => __('8 hours'),
];
$inputs[] = [
'label' => __('Interval'),
'arguments' => [
'type' => 'select',
'fields' => $fields,
'name' => 'interval-'.$this->cellId,
'selected' => $values['interval'],
'return' => true,
],
];
// Show agent.
$inputs[] = [
'label' => __('Show agents'),
'arguments' => [
'type' => 'switch',
'name' => 'show_agents-'.$this->cellId,
'value' => $values['show_agents'],
'return' => true,
],
];
$return_all_group = false;
if (users_can_manage_group_all('RM') || $this->values['mGroup'] == 0) {
$return_all_group = true;
}
$mgroup = '';
if (isset($this->values['mGroup']) === false) {
$sql = sprintf(
'SELECT id_group FROM tdashboard WHERE id = %d',
$this->dashboardId
);
$group_dahsboard = db_get_value_sql($sql);
if ($group_dahsboard > 0) {
$mgroup = $group_dahsboard;
}
}
if (is_metaconsole() === true) {
$this->values['mAgents'] = $this->getIdCacheAgent($this->values['mAgents']);
}
$inputs[] = [
'class' => 'flex flex-row',
'id' => 'select_multiple_modules_filtered',
'arguments' => [
'type' => 'select_multiple_modules_filtered',
'uniqId' => $this->cellId,
'mGroup' => (isset($this->values['mGroup']) === true) ? $this->values['mGroup'] : $mgroup,
'mRecursion' => (isset($this->values['mRecursion']) === true) ? $this->values['mRecursion'] : '',
'mModuleGroup' => (isset($this->values['mModuleGroup']) === true) ? $this->values['mModuleGroup'] : '',
'mAgents' => (isset($this->values['mAgents']) === true) ? $this->values['mAgents'] : '',
'mShowCommonModules' => (isset($this->values['mShowCommonModules']) === true) ? $this->values['mShowCommonModules'] : '',
'mModules' => (isset($this->values['mModules']) === true) ? $this->values['mModules'] : '',
'mShowSelectedOtherGroups' => true,
'mReturnAllGroup' => $return_all_group,
'mMetaFields' => ((bool) is_metaconsole()),
'commonModulesSwitch' => true,
],
];
return $inputs;
}
/**
* Get Post for widget.
*
* @return array
*/
public function getPost():array
{
// Retrieve global - common inputs.
$values = parent::getPost();
$values['interval'] = \get_parameter('interval-'.$this->cellId, '28800');
$values['show_agents'] = \get_parameter('show_agents-'.$this->cellId, '0');
$values['mTypeShow'] = \get_parameter(
'filtered-type-show-'.$this->cellId
);
$values['mGroup'] = \get_parameter(
'filtered-module-group-'.$this->cellId
);
$values['mRecursion'] = \get_parameter_switch(
'filtered-module-recursion-'.$this->cellId
);
$values['mModuleGroup'] = \get_parameter(
'filtered-module-module-group-'.$this->cellId
);
$values['mAgents'] = \get_parameter(
'filtered-module-agents-'.$this->cellId
);
if (is_metaconsole() === true) {
$values['mAgents'] = $this->getRealIdAgentNode($values['mAgents']);
}
$values['mShowCommonModules'] = \get_parameter(
'filtered-module-show-common-modules-'.$this->cellId
);
$values['mModules'] = explode(
',',
\get_parameter(
'filtered-module-modules-'.$this->cellId
)
);
return $values;
}
/**
* Draw widget.
*
* @return string;
*/
public function load()
{
global $config;
$output = '';
if (check_acl($config['id_user'], 0, 'AR') === 0) {
$output .= '<div class="container-center">';
$output .= ui_print_error_message(
__('You don\'t have access'),
'',
true
);
$output .= '</div>';
return $output;
}
$interval_range = [];
$current_timestamp = time();
$interval_range['start'] = ($current_timestamp - $this->values['interval']);
$interval_range['end'] = $current_timestamp;
$reduceAllModules = array_reduce(
$this->values['mModules'],
function ($carry, $item) {
if ($item === null) {
return $carry;
}
if (is_metaconsole() === true) {
$item = explode('|', $item);
$serverId = $item[0];
$fullname = $item[1];
if ($this->values['mShowCommonModules'] !== 'on') {
$item = explode('&#x20;&raquo;&#x20;', $fullname);
$name = $item[1];
$carry['modules_selected'][$serverId][$name] = null;
$carry['modules'][$name] = null;
} else {
$carry['modules'][$fullname] = null;
}
} else {
$carry['modules'][$item] = null;
}
return $carry;
}
);
$allModules = $reduceAllModules['modules'];
$visualData = [];
// Extract info agents selected.
$target_agents = explode(',', $this->values['mAgents']);
foreach ($target_agents as $agent_id) {
try {
if (is_metaconsole() === true && str_contains($agent_id, '|') === true) {
$server_agent = explode('|', $agent_id);
} else {
$id_agente = $agent_id;
}
if ((bool) is_metaconsole() === true) {
if (isset($server_agent) === true) {
$id_agente = $server_agent[1];
$tserver = $server_agent[0];
} else {
$tmeta_agent = db_get_row_filter(
'tmetaconsole_agent',
[ 'id_agente' => $id_agente ]
);
$id_agente = $tmeta_agent['id_tagente'];
$tserver = $tmeta_agent['id_tmetaconsole_setup'];
}
if (metaconsole_connect(null, $tserver) !== NOERR) {
continue;
}
}
$agent = new Agent((int) $id_agente);
$visualData[$agent_id]['agent_status'] = $agent->lastStatus();
$visualData[$agent_id]['agent_name'] = $agent->name();
$visualData[$agent_id]['agent_alias'] = $agent->alias();
$visualData[$agent_id]['modules'] = [];
if (empty($allModules) === false) {
if (is_metaconsole() === true && $this->values['mShowCommonModules'] !== 'on') {
if (isset($reduceAllModules['modules_selected'][$tserver]) === true) {
$modules = $agent->searchModules(
['nombre' => array_keys($reduceAllModules['modules_selected'][$tserver])]
);
} else {
$modules = null;
}
} else {
$modules = $agent->searchModules(
['nombre' => array_keys($allModules)]
);
}
}
$visualData[$agent_id]['modules'] = $allModules;
if ((bool) is_metaconsole() === true) {
metaconsole_restore_db();
}
foreach ($modules as $module) {
if ($module === null) {
continue;
}
$data_module_array = $module->toArray();
$visualData[$agent_id]['modules'][$module->name()] = [];
$last_status = $module->getStatus()->toArray();
$visualData[$agent_id]['modules'][$module->name()]['last_status_change'] = $last_status['last_status_change'];
// Mean Time Between Failure.
// Mean Time To Solution.
// Availability.
if ((bool) is_metaconsole() === true) {
$module_id = $tserver.'|'.$data_module_array['id_agente_modulo'];
} else {
$module_id = $data_module_array['id_agente_modulo'];
}
$module_data = service_level_module_data($interval_range['start'], $interval_range['end'], $module_id);
$visualData[$agent_id]['modules'][$module->name()]['mtrs'] = ($module_data['mtrs'] !== false) ? human_milliseconds_to_string(($module_data['mtrs'] * 100), 'short') : '-';
$visualData[$agent_id]['modules'][$module->name()]['mtbf'] = ($module_data['mtbf'] !== false) ? human_milliseconds_to_string(($module_data['mtbf'] * 100), 'short') : '-';
$visualData[$agent_id]['modules'][$module->name()]['availability'] = ($module_data['availability'] !== false) ? $module_data['availability'] : '100';
$visualData[$agent_id]['modules'][$module->name()]['critical_events'] = ($module_data['critical_events'] !== false) ? $module_data['critical_events'] : '';
$visualData[$agent_id]['modules'][$module->name()]['warning_events'] = ($module_data['warning_events'] !== false) ? $module_data['warning_events'] : '';
$visualData[$agent_id]['modules'][$module->name()]['last_status_change'] = ($module_data['last_status_change'] !== false) ? $module_data['last_status_change'] : '';
$visualData[$agent_id]['modules'][$module->name()]['agent_alias'] = ($module_data['agent_alias'] !== false) ? $module_data['agent_alias'] : '';
$visualData[$agent_id]['modules'][$module->name()]['module_name'] = ($module_data['module_name'] !== false) ? $module_data['module_name'] : '';
}
} catch (\Exception $e) {
echo 'Error: ['.$agent_id.']'.$e->getMessage();
}
}
$table = new \stdClass();
$table->width = '100%';
$table->class = 'databox filters filter-table-adv';
$table->head = [];
$show_agents = $this->values['show_agents'];
if ($show_agents === 'on') {
$table->head[0] = __('Agent / Modules');
} else {
$table->head[0] = __('Modules');
}
$table->head[1] = __('% Av.');
$table->head[2] = __('MTBF');
$table->head[3] = __('MTRS');
$table->head[4] = __('Crit. Events').ui_print_help_tip(__('Counted only critical events generated automatic by the module'), true);
$table->head[5] = __('Warn. Events').ui_print_help_tip(__('Counted only warning events generated automatic by the module'), true);
$table->head[6] = __('Last change');
$table->data = [];
$table->cellstyle = [];
$row = 0;
foreach ($visualData as $agent_id => $data) {
foreach ($data['modules'] as $module_name => $module_data) {
if (isset($module_data) === true) {
if ($show_agents === 'on') {
$table->data[$row][0] = $module_data['agent_alias'].' / '.$module_data['module_name'];
$table->cellstyle[$row][0] = 'text-align:left';
} else {
$table->data[$row][0] = $module_data['module_name'];
$table->cellstyle[$row][0] = 'text-align:left';
}
$table->data[$row][1] = $module_data['availability'].'%';
$table->data[$row][2] = $module_data['mtbf'];
$table->data[$row][3] = $module_data['mtrs'];
$table->data[$row][4] = $module_data['critical_events'];
$table->data[$row][5] = $module_data['warning_events'];
$table->data[$row][6] = date(TIME_FORMAT, $module_data['last_status_change']);
}
$row++;
}
}
$height = (count($table->data) * 32);
$style = 'min-width:400px; min-height:'.$height.'px;';
$output = '<div class="container-top" style="'.$style.'">';
$output .= html_print_table($table, true);
$output .= '</div>';
return $output;
}
/**
* Get description.
*
* @return string.
*/
public static function getDescription()
{
return __('Service Level Detail');
}
/**
* Get Name.
*
* @return string.
*/
public static function getName()
{
return 'service_level';
}
/**
* Get size Modal Configuration.
*
* @return array
*/
public function getSizeModalConfiguration(): array
{
$size = [
'width' => 800,
'height' => 270,
];
return $size;
}
/**
* Return array with the real id agent and server.
*
* @param string $id_agents_cache String with the agents cache id.
*
* @return string $agents_servers with the real id agent and server.
*/
public function getRealIdAgentNode($id_agents_cache)
{
$agents_servers = [];
$target_agents = explode(',', $id_agents_cache);
foreach ($target_agents as $agent_id) {
$id_agente = $agent_id;
$tmeta_agent = db_get_row_filter(
'tmetaconsole_agent',
['id_agente' => $id_agente]
);
$id_agente = $tmeta_agent['id_tagente'];
$tserver = $tmeta_agent['id_tmetaconsole_setup'];
$agents_servers[] = $tserver.'|'.$id_agente;
}
return implode(',', $agents_servers);
}
/**
* Return string with the cache id agent in metaconsole.
*
* @param string $id_agents String with the agents and server id.
*
* @return string $cache_id_agents with the cache id agent.
*/
public function getIdCacheAgent($id_agents)
{
$target_agents = explode(',', $id_agents);
$cache_id_agents = [];
foreach ($target_agents as $agent_id) {
if (str_contains($agent_id, '|') === false) {
$cache_id_agents[] = $agent_id;
continue;
}
$server_agent = explode('|', $agent_id);
$tmeta_agent = db_get_row_filter(
'tmetaconsole_agent',
[
'id_tagente' => $server_agent[1],
'id_tmetaconsole_setup' => $server_agent[0],
]
);
$cache_id_agents[] = $tmeta_agent['id_agente'];
}
return implode(',', $cache_id_agents);
}
}

View File

@ -1196,7 +1196,7 @@ class Item extends CachedModel
'operation/visual_console/view', 'operation/visual_console/view',
['id' => $vcId], ['id' => $vcId],
// No autologin from the public view. // No autologin from the public view.
!$config['public_view'], !$config['public_access'],
$mobile_navigation, $mobile_navigation,
[ [
'page' => 'visualmap', 'page' => 'visualmap',
@ -1302,7 +1302,7 @@ class Item extends CachedModel
'enterprise/operation/services/services', 'enterprise/operation/services/services',
['id_service' => $serviceId], ['id_service' => $serviceId],
// No autologin from the public view. // No autologin from the public view.
!$config['public_view'] !$config['public_access']
); );
} else { } else {
// A regular module. // A regular module.
@ -1312,7 +1312,7 @@ class Item extends CachedModel
'operation/agentes/status_monitor', 'operation/agentes/status_monitor',
['id_module' => $moduleId], ['id_module' => $moduleId],
// No autologin from the public view. // No autologin from the public view.
!((isset($config['public_view']) === true) ? $config['public_view'] : false), !((isset($config['public_access']) === true) ? $config['public_access'] : false),
$mobile_navigation, $mobile_navigation,
[ [
'id' => $moduleId, 'id' => $moduleId,
@ -1377,7 +1377,7 @@ class Item extends CachedModel
'operation/agentes/ver_agente', 'operation/agentes/ver_agente',
['id_agente' => $agentId], ['id_agente' => $agentId],
// No autologin from the public view. // No autologin from the public view.
!$config['public_view'], !$config['public_access'],
$mobile_navigation, $mobile_navigation,
[ [
'id' => $agentId, 'id' => $agentId,

View File

@ -284,6 +284,11 @@ li#div-textarea label {
display: initial; display: initial;
} }
.content-widget .container-top {
height: 100%;
width: 99%;
}
.widget-groups-status { .widget-groups-status {
display: flex; display: flex;
flex-direction: row; flex-direction: row;

View File

@ -784,6 +784,11 @@ form ul.form_flex {
width: 100%; width: 100%;
} }
.content-widget .container-top {
height: 100%;
width: 99%;
}
.container-layout { .container-layout {
border-radius: 5px; border-radius: 5px;
border: 3px dashed #fff; border: 3px dashed #fff;

View File

@ -131,7 +131,7 @@
<div style='padding-bottom: 50px'> <div style='padding-bottom: 50px'>
<?php <?php
$version = '7.0NG.774'; $version = '7.0NG.774';
$build = '231207'; $build = '231211';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -1205,57 +1205,6 @@ if (is_ajax() === true) {
return; return;
} }
if ($get_agents_in_group) {
$id = (int) get_parameter('id', 0);
$group = (int) get_parameter('group', -1);
$return = [];
$return['correct'] = false;
if ($group != -1) {
$where_id_agente = ' 1=1 ';
$agents_in_networkmap = db_get_all_rows_filter(
'titem',
[
'id_map' => $id,
'deleted' => 0,
]
);
if ($agents_in_networkmap !== false) {
$ids = [];
foreach ($agents_in_networkmap as $agent) {
if ($agent['type'] == 0) {
$ids[] = $agent['source_data'];
}
}
$where_id_agente = ' id_agente NOT IN ('.implode(',', $ids).')';
}
$sql = 'SELECT id_agente, alias
FROM tagente
WHERE id_grupo = '.$group.' AND '.$where_id_agente.'
ORDER BY alias ASC';
$agents = db_get_all_rows_sql($sql);
if ($agents !== false) {
$return['agents'] = [];
foreach ($agents as $agent) {
$return['agents'][$agent['id_agente']] = $agent['alias'];
}
$return['correct'] = true;
}
}
echo json_encode($return);
return;
}
if ($get_agent_info) { if ($get_agent_info) {
$id_agent = (int) get_parameter('id_agent'); $id_agent = (int) get_parameter('id_agent');

View File

@ -33,7 +33,7 @@ require_once $config['homedir'].'/vendor/autoload.php';
ui_require_css_file('register', 'include/styles/', true); ui_require_css_file('register', 'include/styles/', true);
// Connection lost alert. // Connection lost alert.
ui_require_javascript_file('connection_check', 'include/javascript/', true); // ui_require_javascript_file('connection_check', 'include/javascript/', true);
set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false)); set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false));
$conn_title = __('Connection with console has been lost'); $conn_title = __('Connection with console has been lost');
$conn_text = __('Connection to the console has been lost. Please check your internet connection.'); $conn_text = __('Connection to the console has been lost. Please check your internet connection.');
@ -47,7 +47,7 @@ global $vc_public_view;
global $config; global $config;
$vc_public_view = true; $vc_public_view = true;
$config['public_view'] = true; $config['public_access'] = true;
// This starts the page head. In the call back function, // This starts the page head. In the call back function,
// things from $page['head'] array will be processed into the head. // things from $page['head'] array will be processed into the head.
@ -62,12 +62,6 @@ require_once 'include/functions_visual_map.php';
$hash = (string) get_parameter('hash'); $hash = (string) get_parameter('hash');
// For public link issue.
$force_instant_logout = true;
if (isset($config['id_user']) === true) {
$force_instant_logout = false;
}
// Check input hash. // Check input hash.
// DO NOT move it after of get parameter user id. // DO NOT move it after of get parameter user id.
if (User::validatePublicHash($hash) !== true) { if (User::validatePublicHash($hash) !== true) {
@ -256,17 +250,17 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
if (menuLinks !== null) { if (menuLinks !== null) {
menuLinks.forEach(function (menuLink) { menuLinks.forEach(function (menuLink) {
menuLink.href = menuLink.href.replace(regex, replacement); menuLink.href = menuLink.href.replace(regex, replacement);
menuLink.href = menuLink.href.replace( //menuLink.href = menuLink.href.replace(
regex_hash, // regex_hash,
replacement_hash // replacement_hash
); //);
}); });
} }
// Change the URL (if the browser has support). // Change the URL (if the browser has support).
if ("history" in window) { if ("history" in window) {
var href = window.location.href.replace(regex, replacement); var href = window.location.href.replace(regex, replacement);
href = href.replace(regex_hash, replacement_hash); //href = href.replace(regex_hash, replacement_hash);
window.history.replaceState({}, document.title, href); window.history.replaceState({}, document.title, href);
} }
} }
@ -321,20 +315,24 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
} }
} }
}); });
<?php if ($force_instant_logout === true) { ?>
// No click enabled when user not logged.
$( "a" ).on( "click", function( event ) {
event.preventDefault();
$('#visual-console-container').removeClass('is-updating');
$('.div-visual-console-spinner').remove();
});
<?php } ?>
</script> </script>
<?php <?php
if ($force_instant_logout === true) { // Clean session to avoid direct access.
unset($userAccessMaintenance, $config['id_user'], $hash); if ($config['force_instant_logout'] === true) {
// Force user logout.
$iduser = $_SESSION['id_usuario'];
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
$_SESSION = [];
session_destroy(); session_destroy();
header_remove('Set-Cookie'); header_remove('Set-Cookie');
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/'); if (isset($_COOKIE[session_name()]) === true) {
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
}
}
while (ob_get_length() > 0) {
ob_end_flush();
} }

View File

@ -6,7 +6,7 @@
%define debug_package %{nil} %define debug_package %{nil}
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231207 %define release 231211
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -6,7 +6,7 @@
%define debug_package %{nil} %define debug_package %{nil}
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231207 %define release 231211
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231207 %define release 231211
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.774-231207 Version: 7.0NG.774-231211
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.774-231207" pandora_version="7.0NG.774-231211"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.774"; my $pandora_version = "7.0NG.774";
my $pandora_build = "231207"; my $pandora_build = "231211";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.774"; my $pandora_version = "7.0NG.774";
my $pandora_build = "231207"; my $pandora_build = "231211";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -7,7 +7,7 @@
%define debug_package %{nil} %define debug_package %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231207 %define release 231211
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231207 %define release 231211
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.774" PI_VERSION="7.0NG.774"
PI_BUILD="231207" PI_BUILD="231211"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

@ -38,7 +38,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.774 Build 231207"; my $version = "7.0NG.774 Build 231211";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.774 Build 231207"; my $version = "7.0NG.774 Build 231211";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);