Merge remote-tracking branch 'origin/develop' into ent-3013-ipam-modo-configuracion-de-vlan

Former-commit-id: ec5c28bb52343952fd644c1f999d3b5ef04cd709
This commit is contained in:
daniel 2019-01-25 09:55:09 +01:00
commit 61c9603ae8
26 changed files with 181 additions and 28 deletions

View File

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

@ -42,7 +42,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.730'; use constant AGENT_VERSION => '7.0NG.730';
use constant AGENT_BUILD => '190123'; use constant AGENT_BUILD => '190125';
# 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

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

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.730 %define version 7.0NG.730
%define release 190123 %define release 190125
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.730" PI_VERSION="7.0NG.730"
PI_BUILD="190123" PI_BUILD="190125"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{190123} {190125}
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.730(Build 190123)") #define PANDORA_VERSION ("7.0NG.730(Build 190125)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.730(Build 190123))" VALUE "ProductVersion", "(7.0NG.730(Build 190125))"
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.730-190123 Version: 7.0NG.730-190125
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.730-190123" pandora_version="7.0NG.730-190125"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -22,7 +22,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC190123'; $build_version = 'PC190125';
$pandora_version = 'v7.0NG.730'; $pandora_version = 'v7.0NG.730';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -3399,7 +3399,7 @@ function validate_csrf_code() {
} }
function generate_hash_to_api(){ function generate_hash_to_api(){
hash('sha256', db_get_value ('value', 'tupdate_settings', '`key`', 'customer_key')); return (string)hash('sha256', db_get_value ('value', 'tupdate_settings', '`key`', 'customer_key'));
} }
/** /**

View File

@ -99,6 +99,10 @@ function returnError($typeError, $returnType = 'string') {
returnData($returnType, returnData($returnType,
array('type' => 'string', 'data' => __('No data to show.'))); array('type' => 'string', 'data' => __('No data to show.')));
break; break;
case 'centralized':
returnData($returnType,
array('type' => 'string', 'data' => __('This console is not manager of this environment, please manage this feature from centralized manager console (Metaconsole).')));
break;
default: default:
returnData("string", returnData("string",
array('type' => 'string', 'data' => __($returnType))); array('type' => 'string', 'data' => __($returnType)));
@ -149,7 +153,7 @@ function returnData($returnType, $data, $separator = ';') {
else { else {
if (!empty($data['data'])) { if (!empty($data['data'])) {
foreach ($data['data'] as $dataContent) { foreach ($data['data'] as $dataContent) {
$clean = array_map("array_apply_io_safe_output", $dataContent); $clean = array_map("array_apply_io_safe_output", (array)$dataContent);
foreach ($clean as $k => $v) { foreach ($clean as $k => $v) {
$clean[$k] = str_replace("\r", "\n", $clean[$k]); $clean[$k] = str_replace("\r", "\n", $clean[$k]);
$clean[$k] = str_replace("\n", " ", $clean[$k]); $clean[$k] = str_replace("\n", " ", $clean[$k]);
@ -7684,6 +7688,94 @@ function api_set_alert_actions($id, $id2, $other, $trash1) {
} }
} }
/**
* Create a new module group
* @param $id as module group name (mandatory)
example:
*http://localhost/pandora_console/include/api.php?op=set&op2=new_module_group&id=Module_group_name&apipass=1234&user=admin&pass=pandora
*/
function api_set_new_module_group($id, $thrash2, $other, $trash1) {
global $config;
if (defined ('METACONSOLE')) {
return;
}
if (!check_acl($config['id_user'], 0, "PM")){
returnError('forbidden', 'string');
return;
}
if ($id == '' || !$id) {
returnError('error_parameter', __('Module group must have a name'));
return;
}
$name = db_get_value ('name', 'tmodule_group', 'name', $id);
if ($name) {
returnError('error_parameter', __('Each module group must have a different name'));
return;
}
$return = db_process_sql_insert('tmodule_group', array('name' => $id));
if ($return === false)
returnError('error_new_moodule_group', 'There was a problem creating group');
else
returnData('string', array('type' => 'string', 'data' => $return));
}
/**
* synchronize module group
* @param $other as server_names (mandatory)
example:
*api.php?op=set&op2=module_group_synch&other=server_name1|server_name2|server_name3&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
*/
function api_set_module_group_synch($thrash1, $thrash2, $other, $thrash4) {
global $config;
enterprise_include_once ('meta/include/functions_meta.php');
if (is_metaconsole()) {
if (!check_acl($config['id_user'], 0, "PM")) {
returnError('forbidden', 'string');
return;
}
$targets = array();
foreach ($other['data'] as $server) {
$targets[] = $server;
}
$return = meta_module_group_synchronizing($targets, true);
$module_group_update_err = $return["module_group_update_err"];
$module_group_create_err = $return["module_group_create_err"];
$module_group_update_ok = $return["module_group_update_ok"];
$module_group_create_ok = $return["module_group_create_ok"];
$string_ok = __('Created/Updated %s/%s module groups', $module_group_create_ok, $module_group_update_ok);
// User feedback
if ($module_group_create_err > 0 or $module_group_update_err > 0) {
returnError ('module_group_synch_err',__('Error creating/updating %s/%s module groups <br>', $module_group_create_err, $module_group_update_err));
}
if ($module_group_create_ok > 0 or $module_group_update_ok > 0){
returnData ('string', array('type' => 'string', 'data' => $string_ok));
}
}
else{
returnError ('not_defined_in_metaconsole',__('This function is only for metaconsole'));
}
}
function api_set_new_event($trash1, $trash2, $other, $trash3) { function api_set_new_event($trash1, $trash2, $other, $trash3) {
$simulate = false; $simulate = false;
$time = get_system_time(); $time = get_system_time();
@ -10601,6 +10693,7 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3) {
} }
} }
/** /**
* Update a service. * Update a service.
* *

View File

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

View File

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

View File

@ -45,7 +45,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.730"; my $pandora_version = "7.0NG.730";
my $pandora_build = "190123"; my $pandora_build = "190125";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -32,7 +32,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.730"; my $pandora_version = "7.0NG.730";
my $pandora_build = "190123"; my $pandora_build = "190125";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

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

View File

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

View File

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

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.730 PS190123"; my $version = "7.0NG.730 PS190125";
# 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.730 PS190123"; my $version = "7.0NG.730 PS190125";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);
@ -144,7 +144,9 @@ sub help_screen{
help_screen_line('--create_snmp_module', "<module_name> <module_type> <agent_name> <module_address> <module_port>\n\t <version> [<community> <oid> <description> <module_group> <min> <max> <post_process> <interval>\n\t <warning_min> <warning_max> <critical_min> <critical_max> <history_data> \n\t <snmp3_priv_method> <snmp3_priv_pass> <snmp3_sec_level> <snmp3_auth_method> \n\t <snmp3_auth_user> <snmp3_auth_pass> <ff_threshold> <warning_str> \n\t <critical_str> <unknown_events> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <timeout> <retries> help_screen_line('--create_snmp_module', "<module_name> <module_type> <agent_name> <module_address> <module_port>\n\t <version> [<community> <oid> <description> <module_group> <min> <max> <post_process> <interval>\n\t <warning_min> <warning_max> <critical_min> <critical_max> <history_data> \n\t <snmp3_priv_method> <snmp3_priv_pass> <snmp3_sec_level> <snmp3_auth_method> \n\t <snmp3_auth_user> <snmp3_auth_pass> <ff_threshold> <warning_str> \n\t <critical_str> <unknown_events> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <timeout> <retries>
\n\t <critical_instructions> <warning_instructions> <unknown_instructions>\n\t <warning_inverse> <critical_inverse>]", 'Add snmp network module to agent'); \n\t <critical_instructions> <warning_instructions> <unknown_instructions>\n\t <warning_inverse> <critical_inverse>]", 'Add snmp network module to agent');
help_screen_line('--create_plugin_module', "<module_name> <module_type> <agent_name> <module_address> \n\t <module_port> <plugin_name> <user> <password> <parameters> [<description> \n\t <module_group> <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> \n\t <critical_max> <history_data> <ff_threshold> <warning_str> <critical_str>\n\t <unknown_events> <each_ff> <ff_threshold_normal> <ff_threshold_warning>\n\t <ff_threshold_critical> <timeout> \n\t <critical_instructions> <warning_instructions> <unknown_instructions>\n\t <warning_inverse> <critical_inverse>]", 'Add plug-in module to agent'); help_screen_line('--create_plugin_module', "<module_name> <module_type> <agent_name> <module_address> \n\t <module_port> <plugin_name> <user> <password> <parameters> [<description> \n\t <module_group> <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> \n\t <critical_max> <history_data> <ff_threshold> <warning_str> <critical_str>\n\t <unknown_events> <each_ff> <ff_threshold_normal> <ff_threshold_warning>\n\t <ff_threshold_critical> <timeout> \n\t <critical_instructions> <warning_instructions> <unknown_instructions>\n\t <warning_inverse> <critical_inverse>]", 'Add plug-in module to agent');
help_screen_line('--get_module_group', '[<module_group_name>]', 'Dysplay all module groups');
help_screen_line('--create_module_group', '<module_group_name>'); help_screen_line('--create_module_group', '<module_group_name>');
help_screen_line('--module_group_synch', "<server_name1|server_name2|server_name3...> [<return_type>]", 'Synchronize metaconsole module groups');
help_screen_line('--delete_module', 'Delete module from agent', '<module_name> <agent_name>'); help_screen_line('--delete_module', 'Delete module from agent', '<module_name> <agent_name>');
help_screen_line('--data_module', "<server_name> <agent_name> <module_name> \n\t <module_type> <module_new_data> [<datetime>]", 'Insert data to module'); help_screen_line('--data_module', "<server_name> <agent_name> <module_name> \n\t <module_type> <module_new_data> [<datetime>]", 'Insert data to module');
help_screen_line('--get_module_data', "<agent_name> <module_name> <interval> [<csv_separator>]", "\n\t Show the data of a module in the last X seconds (interval) in CSV format"); help_screen_line('--get_module_data', "<agent_name> <module_name> <interval> [<csv_separator>]", "\n\t Show the data of a module in the last X seconds (interval) in CSV format");
@ -241,8 +243,8 @@ sub help_screen{
######################################################################## ########################################################################
# #
######################################################################## ########################################################################
sub api_call($$$;$$$) { sub api_call($$$;$$$$) {
my ($pa_config, $op, $op2, $id, $id2, $other) = @_; my ($pa_config, $op, $op2, $id, $id2, $other, $return_type) = @_;
my $content = undef; my $content = undef;
eval { eval {
@ -256,6 +258,7 @@ sub api_call($$$;$$$) {
$params->{"id"} = $id; $params->{"id"} = $id;
$params->{"id2"} = $id2; $params->{"id2"} = $id2;
$params->{"other"} = $other; $params->{"other"} = $other;
$params->{"return_type"} = $return_type;
$params->{"other_mode"} = "url_encode_separator_|"; $params->{"other_mode"} = "url_encode_separator_|";
# Call the API. # Call the API.
@ -1605,6 +1608,54 @@ sub cli_create_module_group () {
db_insert ($dbh, 'id_mg', 'INSERT INTO tmodule_group (name) VALUES (?)', safe_input($module_group_name)); db_insert ($dbh, 'id_mg', 'INSERT INTO tmodule_group (name) VALUES (?)', safe_input($module_group_name));
} }
##############################################################################
# Show all the module group (without parameters) or the module groups with a filter parameters
# Related option: --get_module_group
##############################################################################
sub cli_get_module_group() {
my ($module_group_name) = @ARGV[2..2];
my $condition = ' 1=1 ';
if($module_group_name ne '') {
$condition .= " AND name LIKE '%$module_group_name%' ";
}
my @module_group = get_db_rows ($dbh, "SELECT * FROM tmodule_group WHERE $condition");
if(scalar(@module_group) == 0) {
print_log "[INFO] No groups found\n\n";
exit;
}
my $head_print = 0;
foreach my $groups (@module_group) {
if($head_print == 0) {
$head_print = 1;
print "id_module_group, group_name\n";
}
print $groups->{'id_mg'}.",".safe_output($groups->{'name'})."\n";
}
if($head_print == 0) {
print_log "[INFO] No groups found\n\n";
}
}
sub cli_module_group_synch() {
my $other = @ARGV[2];
my $return_type = @ARGV[3];
if ($return_type eq '') {
$return_type = 'csv';
}
my $result = api_call(\%conf,'set', 'module_group_synch', undef, undef, "$other", $return_type);
print "$result \n\n ";
}
############################################################################## ##############################################################################
# Create network module from component. # Create network module from component.
# Related option: --create_network_module_from_component # Related option: --create_network_module_from_component
@ -5734,10 +5785,19 @@ sub pandora_manage_main ($$$) {
param_check($ltotal, 38, 35); param_check($ltotal, 38, 35);
cli_create_web_module(0); cli_create_web_module(0);
} }
elsif ($param eq '--get_module_group') {
param_check($ltotal, 1, 1);
cli_get_module_group();
}
elsif ($param eq '--create_module_group') { elsif ($param eq '--create_module_group') {
param_check($ltotal, 1, 1); param_check($ltotal, 1, 1);
cli_create_module_group(); cli_create_module_group();
} }
elsif ($param eq '--module_group_synch') {
param_check($ltotal, 2, 1);
cli_module_group_synch();
}
elsif ($param eq '--create_network_module') { elsif ($param eq '--create_network_module') {
param_check($ltotal, 32, 20); param_check($ltotal, 32, 20);
cli_create_network_module(0); cli_create_network_module(0);