Merge remote-tracking branch 'origin/develop' into fix/styles

This commit is contained in:
fbsanchez 2019-05-29 10:50:38 +02:00
commit 32424ddae1
27 changed files with 173 additions and 100 deletions

View File

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

@ -42,7 +42,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.735';
use constant AGENT_BUILD => '190528';
use constant AGENT_BUILD => '190529';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -536,6 +536,12 @@ sub parse_conf_modules($) {
# Check for invalid modules
next unless (($module->{'name'} ne '' && $module->{'func'} != 0) || $module->{'func'} == \&module_plugin);
# Skip disabled modules.
if (defined($module->{'disabled'}) && $module->{'disabled'} == 1) {
log_message('setup', 'Skipping disabled module "' . $module->{'name'} . '"');
next;
}
# Set the intensive interval
if ($module->{'is_intensive'} == 1) {
$module->{'intensive_interval'} = $module->{'interval'};

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.735"
PI_BUILD="190528"
PI_BUILD="190529"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{190528}
{190529}
ViewReadme
{Yes}

View File

@ -1117,6 +1117,12 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
}
}
/* Skip disabled modules */
if (module_disabled == "1") {
pandoraLog ("Skipping disabled module \"%s\"", module_name.c_str ());
return NULL;
}
/* Create module objects */
if (module_exec != "") {
module = new Pandora_Module_Exec (module_name,

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.735(Build 190528)")
#define PANDORA_VERSION ("7.0NG.735(Build 190529)")
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.735(Build 190528))"
VALUE "ProductVersion", "(7.0NG.735(Build 190529))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

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

View File

@ -1253,6 +1253,7 @@ if ($update_module || $create_module) {
// Get macros.
$macros = (string) get_parameter('macros');
$macros_names = (array) get_parameter('macro_name', []);
if (!empty($macros)) {
$macros = json_decode(base64_decode($macros), true);
@ -1263,11 +1264,19 @@ if ($update_module || $create_module) {
$m_hide = $m['hide'];
}
if ($update_module) {
if ($m_hide == '1') {
$macros[$k]['value'] = io_input_password(get_parameter($m['macro'], ''));
} else {
$macros[$k]['value'] = get_parameter($m['macro'], '');
}
} else {
if ($m_hide == '1') {
$macros[$k]['value'] = io_input_password($macros_names[$k]);
} else {
$macros[$k]['value'] = $macros_names[$k];
}
}
}
$macros = io_json_mb_encode($macros);
@ -1464,32 +1473,11 @@ if ($update_module || $create_module) {
$module_in_policy = enterprise_hook('policies_is_module_in_policy', [$id_agent_module]);
$module_linked = enterprise_hook('policies_is_module_linked', [$id_agent_module]);
if ((!$module_in_policy && !$module_linked && $update_module)
|| ( $module_in_policy && !$module_linked && $update_module)
) {
enterprise_hook(
'config_agents_update_module_in_conf',
[
$id_agente,
io_safe_output($old_configuration_data),
io_safe_output($configuration_data),
$disabled,
]
);
} else {
enterprise_hook(
'config_agents_write_module_in_conf',
[
$id_agente,
io_safe_output($old_configuration_data),
io_safe_output($configuration_data),
$disabled,
]
);
}
}
// Initialize result of the action (insert or update).
$success_action = NOERR;
// MODULE UPDATE.
if ($update_module) {
$id_agent_module = (int) get_parameter('id_agent_module');
@ -1625,6 +1613,8 @@ if ($update_module) {
break;
}
// I save the result of the action (insert or update).
$success_action = $result;
$result = false;
ui_print_error_message($msg);
@ -1666,6 +1656,9 @@ if ($update_module) {
// MODULE INSERT.
if ($create_module) {
// Old configuration data must always be empty in case of creation.
$old_configuration_data = '';
if (isset($_POST['combo_snmp_oid'])) {
$combo_snmp_oid = get_parameter_post('combo_snmp_oid');
}
@ -1676,13 +1669,6 @@ if ($create_module) {
$id_module = (int) get_parameter('id_module');
/*
* Commented because can't create prediction modules
* if ($id_module == 5) {
* $prediction_module = 1;
* }
*/
switch ($config['dbtype']) {
case 'oracle':
if (empty($description) || !isset($description)) {
@ -1805,6 +1791,9 @@ if ($create_module) {
break;
}
// I save the result of the action (insert or update).
$success_action = $id_agent_module;
$id_agent_module = false;
ui_print_error_message($msg);
$edit_module = true;
@ -1815,7 +1804,13 @@ if ($create_module) {
);
} else {
if ($prediction_module == 3) {
enterprise_hook('modules_create_synthetic_operations', [$id_agent_module, $serialize_ops]);
enterprise_hook(
'modules_create_synthetic_operations',
[
$id_agent_module,
$serialize_ops,
]
);
}
// Update the module interval.
@ -1838,6 +1833,112 @@ if ($create_module) {
}
}
// MODULE ENABLE/DISABLE
// =====================.
if ($enable_module) {
$result = modules_change_disabled($enable_module, 0);
$module_name = modules_get_agentmodule_name($enable_module);
// Write for conf disable if remote_config.
$configuration_data = enterprise_hook(
'config_agents_get_module_from_conf',
[
$id_agente,
io_safe_output($module_name),
]
);
// Force disable.
$disabled = 0;
// Force Update when disabled for save disabled in conf.
$old_configuration_data = $configuration_data;
// Successfull action.
$success_action = $result;
$success_action = $result;
if ($result === NOERR) {
db_pandora_audit(
'Module management',
'Enable #'.$enable_module.' | '.$module_name.' | '.$agent['alias']
);
} else {
db_pandora_audit(
'Module management',
'Fail to enable #'.$enable_module.' | '.$module_name.' | '.$agent['alias']
);
}
ui_print_result_message(
$result,
__('Successfully enabled'),
__('Could not be enabled')
);
}
if ($disable_module) {
$result = modules_change_disabled($disable_module, 1);
$module_name = modules_get_agentmodule_name($disable_module);
// Write for conf disable if remote_config.
$configuration_data = enterprise_hook(
'config_agents_get_module_from_conf',
[
$id_agente,
io_safe_output($module_name),
]
);
// Force disable.
$disabled = 1;
// Force Update when disabled for save disabled in conf.
$old_configuration_data = $configuration_data;
// Successfull action.
$success_action = $result;
if ($result === NOERR) {
db_pandora_audit(
'Module management',
'Disable #'.$disable_module.' | '.$module_name.' | '.$agent['alias']
);
} else {
db_pandora_audit(
'Module management',
'Fail to disable #'.$disable_module.' | '.$module_name.' | '.$agent['alias']
);
}
ui_print_result_message(
$result,
__('Successfully disabled'),
__('Could not be disabled')
);
}
// Fix to stop the module from being added to the agent's conf
// when an error occurred while updating or inserting. or enable disable module.
if ($update_module || $create_module
|| $enable_module || $disable_module
) {
if ((!$module_in_policy && !$module_linked)
|| ($module_in_policy && !$module_linked)
) {
if ($success_action > 0) {
enterprise_hook(
'config_agents_write_module_in_conf',
[
$id_agente,
io_safe_output($old_configuration_data),
io_safe_output($configuration_data),
$disabled,
]
);
}
}
}
// MODULE DELETION
// =================.
if ($delete_module) {
@ -2037,46 +2138,6 @@ if (!empty($duplicate_module)) {
}
}
// MODULE ENABLE/DISABLE
// =====================.
if ($enable_module) {
$result = modules_change_disabled($enable_module, 0);
$modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$enable_module.'');
$modulo_nombre = $modulo_nombre['nombre'];
if ($result === NOERR) {
enterprise_hook('config_agents_enable_module_conf', [$id_agente, $enable_module]);
db_pandora_audit('Module management', 'Enable #'.$enable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
} else {
db_pandora_audit('Module management', 'Fail to enable #'.$enable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
}
ui_print_result_message(
$result,
__('Successfully enabled'),
__('Could not be enabled')
);
}
if ($disable_module) {
$result = modules_change_disabled($disable_module, 1);
$modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$disable_module.'');
$modulo_nombre = $modulo_nombre['nombre'];
if ($result === NOERR) {
enterprise_hook('config_agents_disable_module_conf', [$id_agente, $disable_module]);
db_pandora_audit('Module management', 'Disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
} else {
db_pandora_audit('Module management', 'Fail to disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
}
ui_print_result_message(
$result,
__('Successfully disabled'),
__('Could not be disabled')
);
}
// UPDATE GIS
// ==========.
$updateGIS = get_parameter('update_gis', 0);

View File

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

View File

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.735
%define release 190528
%define release 190529
# 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.735
%define release 190528
%define release 190529
# 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.735
%define release 190528
%define release 190529
%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.735-190528
Version: 7.0NG.735-190529
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.735-190528"
pandora_version="7.0NG.735-190529"
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.735";
my $pandora_build = "190528";
my $pandora_build = "190529";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.735";
my $pandora_build = "190528";
my $pandora_build = "190529";
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.735
%define release 190528
%define release 190529
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

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

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.735 PS190528";
my $version = "7.0NG.735 PS190529";
# 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.735 PS190528";
my $version = "7.0NG.735 PS190529";
# save program name for logging
my $progname = basename($0);