Merge remote-tracking branch 'origin/develop' into ent-7074-Command-Center

This commit is contained in:
Daniel Barbero Martin 2021-02-26 08:37:06 +01:00
commit 58ca60c857
29 changed files with 94 additions and 32 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.752-210225
Version: 7.0NG.752-210226
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.752-210225"
pandora_version="7.0NG.752-210226"
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

@ -1016,7 +1016,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.752';
use constant AGENT_BUILD => '210225';
use constant AGENT_BUILD => '210226';
# 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.752
%define release 210225
%define release 210226
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.752"
PI_BUILD="210225"
PI_BUILD="210226"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{210225}
{210226}
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.752(Build 210225)")
#define PANDORA_VERSION ("7.0NG.752(Build 210226)")
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.752(Build 210225))"
VALUE "ProductVersion", "(7.0NG.752(Build 210226))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.752-210225
Version: 7.0NG.752-210226
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.752-210225"
pandora_version="7.0NG.752-210226"
package_pear=0
package_pandora=1

View File

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

View File

@ -207,7 +207,7 @@ class Module extends Entity
if (is_numeric($id_agent_module) === true
&& $id_agent_module > 0
) {
if ($nodeId !== null) {
if ($nodeId > 0) {
$this->nodeId = $nodeId;
}
@ -1022,12 +1022,13 @@ class Module extends Entity
/**
* Calculates cascade protection service value for this service.
*
* @param integer|null $id_node Meta searching node will use this field.
* @param integer|null $id_node Meta searching node will use this field.
* @param boolean $connected Connected to a node.
*
* @return integer CPS value.
* @throws \Exception On error.
*/
public function calculateCPS(?int $id_node=null)
public function calculateCPS(?int $id_node=null, bool $connected=false)
{
if ($this->cps() < 0) {
return $this->cps();
@ -1047,6 +1048,7 @@ class Module extends Entity
// Here could happen 2 things.
// 1. Metaconsole service is using this method impersonating node DB.
// 2. Node service is trying to find parents into metaconsole.
// 3. Impersonated node searching metaconsole.
if (empty($id_node) === true
&& is_metaconsole() === false
&& has_metaconsole() === true
@ -1119,6 +1121,38 @@ class Module extends Entity
if ($r !== NOERR) {
throw new \Exception(__('Cannot connect to node %d', $r));
}
} else if (is_metaconsole() === true
// True in impersonated nodes.
&& has_metaconsole() === false
&& empty($id_node) === true
) {
// Impersonated node checking metaconsole.
\enterprise_hook('metaconsole_restore_db');
$mc_parents = db_get_all_rows_sql(
sprintf(
'SELECT id_service,
cps,
cascade_protection,
name
FROM `tservice_element` te
INNER JOIN `tservice` t ON te.id_service = t.id
WHERE te.id_agente_modulo = %d',
$this->id_agente_modulo()
),
false,
false
);
// Restore impersonation.
\enterprise_include_once('include/functions_metaconsole.php');
$r = \enterprise_hook(
'metaconsole_connect',
[
null,
$id_node,
]
);
}
$cps = 0;

View File

@ -922,7 +922,8 @@ class Item extends CachedModel
// Can't fetch an agent with an invalid Id.
$agentId = static::extractAgentId($itemData);
if ($agentId === null) {
throw new \InvalidArgumentException('invalid agent Id');
$agentId = 0;
// throw new \InvalidArgumentException('invalid agent Id');
}
// Staticgraph don't need to have an agent.
@ -956,7 +957,8 @@ class Item extends CachedModel
$agent = \db_get_row_sql($sql);
if ($agent === false) {
throw new \Exception('error fetching the data from the DB');
return $agentData;
// throw new \Exception('error fetching the data from the DB');
}
// The agent name should be a valid string or a null value.
@ -996,7 +998,8 @@ class Item extends CachedModel
// Can't fetch an module with a invalid Id.
$moduleId = static::extractModuleId($itemData);
if ($moduleId === null) {
throw new \InvalidArgumentException('invalid module Id');
$moduleId = 0;
// throw new \InvalidArgumentException('invalid module Id');
}
// Staticgraph don't need to have a module.
@ -1037,7 +1040,8 @@ class Item extends CachedModel
}
if ($moduleName === false) {
throw new \Exception('error fetching the data from the DB');
return $moduleData;
// throw new \Exception('error fetching the data from the DB');
}
$moduleData['moduleName'] = $moduleName['nombre'];

View File

@ -123,6 +123,11 @@ final class Clock extends Item
*/
protected function decode(array $data): array
{
// Default values.
if (empty($data['height']) === true) {
$data['height'] = ($data['width'] / 2);
}
$clockData = parent::decode($data);
$clockData['type'] = CLOCK;
$clockData['clockType'] = static::extractClockType($data);

View File

@ -31,6 +31,25 @@ final class Label extends Item
*/
protected function decode(array $data): array
{
$data['label'] = \preg_replace(
'/overflow: hidden;/',
'',
$data['label']
);
// Default values.
if ((empty($data['width']) === true)
&& (empty($data['height']) === true)
) {
preg_match(
'/visual_font_size_(.*)pt/',
$data['label'],
$matches
);
$data['width'] = (($matches[1] * 10) + 5);
$data['height'] = ($matches[1] * 2.5);
}
$return = parent::decode($data);
$return['type'] = LABEL;
return $return;

View File

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.752
%define release 210225
%define release 210226
# 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.752
%define release 210225
%define release 210226
# 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.752
%define release 210225
%define release 210226
%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.752-210225
Version: 7.0NG.752-210226
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.752-210225"
pandora_version="7.0NG.752-210226"
package_cpan=0
package_pandora=1

View File

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

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.752";
my $pandora_build = "210225";
my $pandora_build = "210226";
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.752
%define release 210225
%define release 210226
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.752"
PI_BUILD="210225"
PI_BUILD="210226"
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.752 PS210225";
my $version = "7.0NG.752 PS210226";
# 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.752 PS210225";
my $version = "7.0NG.752 PS210226";
# save program name for logging
my $progname = basename($0);