Merge remote-tracking branch 'origin/develop' into ent-8552-fallo-subida-pspz-y-pspz2

This commit is contained in:
Luis 2022-02-08 10:03:31 +01:00
commit 4eade30e48
29 changed files with 135 additions and 78 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.759-220207
Version: 7.0NG.759-220208
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.759
%define release 220207
%define release 220208
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.759
%define release 220207
%define release 220208
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.759"
PI_BUILD="220207"
PI_BUILD="220208"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{220207}
{220208}
ViewReadme
{Yes}

View File

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

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.759(Build 220207))"
VALUE "ProductVersion", "(7.0NG.759(Build 220208))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.759-220207
Version: 7.0NG.759-220208
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

@ -1080,14 +1080,23 @@ function modules_get_agentmodule($id_agentmodule)
}
function modules_get_table_data($id_agent_module)
/**
* Gets data table for agent module
*
* @param integer|null $id_agent_module Id agentmodule.
* @param integer|null $id_type Id module type.
* @return void
*/
function modules_get_table_data(?int $id_agent_module, ?int $id_type)
{
$id_type = db_get_value(
'id_tipo_modulo',
'tagente_modulo',
'id_agente_modulo',
$id_agent_module
);
if ($id_type === null) {
$id_type = db_get_value(
'id_tipo_modulo',
'tagente_modulo',
'id_agente_modulo',
$id_agent_module
);
}
$name_type = db_get_value('nombre', 'ttipo_modulo', 'id_tipo', $id_type);

View File

@ -66,6 +66,9 @@ define('REPORT_STATUS_NOT_INIT', 3);
define('REPORT_STATUS_DOWNTIME', 4);
define('REPORT_STATUS_IGNORED', 5);
// Clases.
use PandoraFMS\Module;
function reporting_user_can_see_report($id_report, $id_user=null)
{
@ -699,7 +702,9 @@ function reporting_make_reporting_data(
case 'last_value':
$report['contents'][] = reporting_last_value(
$report,
$content
$content,
$datetime,
$period
);
break;
@ -4071,46 +4076,44 @@ function reporting_database_serialized($report, $content)
/**
* Show last value and state of module.
*
* @param array $report Data report.
* @param array $content Content report.
* @param array $report Data report.
* @param array $content Content report.
* @param integer $datetime Date limit of report.
* @param integer $init_date Init date of report.
*
* @return array
*/
function reporting_last_value($report, $content)
function reporting_last_value($report, $content, $datetime, $period)
{
global $config;
try {
$id_meta = null;
if (is_metaconsole()) {
$id_meta = metaconsole_get_id_server($content['server_name']);
$server = metaconsole_get_connection_by_id($id_meta);
}
$module = new Module($content['id_agent_module'], false, $server['id']);
} catch (\Exception $e) {
$result = [];
return reporting_check_structure_content($result);
}
$return['type'] = 'last_value';
if (empty($content['name'])) {
$content['name'] = __('Last Value');
}
if (is_metaconsole()) {
$id_meta = metaconsole_get_id_server($content['server_name']);
$server = metaconsole_get_connection_by_id($id_meta);
if (metaconsole_connect($server) != NOERR) {
$result = [];
return reporting_check_structure_content($result);
}
}
$id_agent = agents_get_module_id(
$content['id_agent_module']
);
$agent_alias = agents_get_alias($id_agent);
$module_name = modules_get_agentmodule_name(
$content['id_agent_module']
);
$id_agent = $module->agent()->id_agente();
$id_agent_module = $content['id_agent_module'];
$agent_description = agents_get_description($id_agent);
$agent_group = agents_get_agent_group($id_agent);
$agent_address = agents_get_address($id_agent);
$module_description = modules_get_agentmodule_descripcion(
$id_agent_module
);
$agent_alias = $module->agent()->alias();
$module_name = $module->name();
$agent_description = $module->agent()->comentarios();
$agent_group = $module->agent()->group();
$agent_address = $module->agent()->field['direccion'];
$module_description = $module->descripcion();
$items_label = [
'type' => $return['type'],
@ -4138,22 +4141,63 @@ function reporting_last_value($report, $content)
$return['pagebreak'] = $content['pagebreak'];
$return['subtitle'] = $agent_alias.' - '.$module_name;
$return['description'] = $content['description'];
$return['date'] = reporting_get_date_text($report, $content);
$return['agent_name_db'] = agents_get_name($id_agent);
$return['agent_name_db'] = $module->agent()->id_agente();
$return['agent_name'] = $agent_alias;
$return['module_name'] = $module_name;
$return['date'] = reporting_get_date_text($report, $content);
$sql = sprintf(
'SELECT *
FROM tagente_estado
WHERE id_agente_modulo = %s',
$content['id_agent_module']
);
$result = $module->getStatus()->toArray();
$result = db_get_row_sql($sql);
if ($result === false
|| $result['estado'] == AGENT_MODULE_STATUS_NO_DATA
|| $result['estado'] == AGENT_MODULE_STATUS_NOT_INIT
) {
$result['utimestamp'] = '';
$result['datos'] = __('No data to display within the selected interval');
}
if ($result === false) {
$result = [];
if ($datetime < $result['utimestamp']) {
$id_tipo_modulo = $module->id_tipo_modulo();
$table_data = modules_get_table_data(null, $id_tipo_modulo);
if ($period !== null) {
$sql = sprintf(
'SELECT datos, utimestamp FROM %s WHERE id_agente_modulo = %d AND utimestamp BETWEEN %d AND %d ORDER BY utimestamp DESC',
$table_data,
$id_agent_module,
($datetime - $period),
$datetime
);
} else {
$sql = sprintf(
'SELECT datos, utimestamp FROM %s WHERE id_agente_modulo = %d AND utimestamp <= %d ORDER BY utimestamp DESC',
$table_data,
$id_agent_module,
$datetime
);
}
$search_in_history_db = db_search_in_history_db($datetime);
try {
$module->connectNode();
} catch (\Exception $e) {
// Do not link items if failed to find them.
$module->restoreConnection();
}
$datos = db_get_row_sql($sql, $search_in_history_db);
// Restore if needed.
$module->restoreConnection();
if ($datos !== false) {
$result['datos'] = $datos['datos'];
$result['utimestamp'] = $datos['utimestamp'];
} else {
$result['utimestamp'] = '-';
$result['estado'] = AGENT_MODULE_STATUS_NO_DATA;
$result['datos'] = __('No data to display within the selected interval');
}
}
$result['agent_name'] = $agent_alias;
@ -4161,10 +4205,6 @@ function reporting_last_value($report, $content)
$return['data'] = $result;
if (is_metaconsole()) {
metaconsole_restore_db();
}
return reporting_check_structure_content($return);
}

View File

@ -129,7 +129,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.759';
$build = '220207';
$build = '220208';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.759
%define release 220207
%define release 220208
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.759
%define release 220207
%define release 220208
# User and Group under which Apache is running
%define httpd_name httpd

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.759-220207
Version: 7.0NG.759-220208
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -662,8 +662,8 @@ wuxserver 0
# Force closing previous sessions on remote wux_host, only for Selenium Grid server 3.
#clean_wux_sessions 1
# Enable (1) or disable (0) the Pandora FMS Syslog Server (PANDORA FMS ENTERPRISE ONLY).
syslogserver 1
# Enable (1) or disable (0) the Pandora FMS Syslog Server (PANDORA FMS ENTERPRISE ONLY) disabled by default.
syslogserver 0
# Full path to syslog's output file (PANDORA FMS ENTERPRISE ONLY).
syslog_file /var/log/messages

View File

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

View File

@ -297,7 +297,7 @@ sub data_consumer ($$) {
elsif ($ReturnCode == 2){
$module_data = 0;
}
elsif ($ReturnCode == 3 || $ReturnCode == 124){
elsif ($ReturnCode == 3 || $ReturnCode == 124 || $ReturnCode == 137){
# 124 should be a exit code of the timeout command (command times out)
$module_data = ''; # not defined = Uknown
}
@ -305,7 +305,15 @@ sub data_consumer ($$) {
$module_data = 1;
}
}
} else {
# Timeout.
if ($ReturnCode == 124 || $ReturnCode == 137) {
logger($pa_config, "Plug-in module " . $module->{'nombre'} . " for agent " . $agent->{'nombre'} . " timed out.", 3);
pandora_update_module_on_error ($pa_config, $module, $dbh);
return;
}
}
if (! defined $module_data || $module_data eq '') {
logger (
$pa_config,

View File

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.759
%define release 220207
%define release 220208
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.759
%define release 220207
%define release 220208
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.759 Build 220207";
my $version = "7.0NG.759 Build 220208";
# Pandora server configuration
my %conf;

View File

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