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

Conflicts:
	pandora_server/lib/PandoraFMS/DataServer.pm


Former-commit-id: 87b7d3a7591ed181be022b786deba8f090e43d49
This commit is contained in:
daniel 2019-01-22 09:00:47 +01:00
commit 4236b55694
27 changed files with 141 additions and 26 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.730-190121 Version: 7.0NG.730-190122
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-190121" pandora_version="7.0NG.730-190122"
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 => '190121'; use constant AGENT_BUILD => '190122';
# 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 190121 %define release 190122
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 190121 %define release 190122
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="190121" PI_BUILD="190122"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{190121} {190122}
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 190121)") #define PANDORA_VERSION ("7.0NG.730(Build 190122)")
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 190121))" VALUE "ProductVersion", "(7.0NG.730(Build 190122))"
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-190121 Version: 7.0NG.730-190122
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-190121" pandora_version="7.0NG.730-190122"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -1868,3 +1868,17 @@ CREATE TABLE IF NOT EXISTS `tgis_map_layer_groups` (
FOREIGN KEY (`group_id`) REFERENCES `tgrupo` (`id_grupo`) ON DELETE CASCADE, FOREIGN KEY (`group_id`) REFERENCES `tgrupo` (`id_grupo`) ON DELETE CASCADE,
FOREIGN KEY (`agent_id`) REFERENCES `tagente` (`id_agente`) ON DELETE CASCADE FOREIGN KEY (`agent_id`) REFERENCES `tagente` (`id_agente`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `tnetwork_matrix`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tnetwork_matrix` (
`id` int(10) unsigned NOT NULL auto_increment,
`source` varchar(60) default '',
`destination` varchar(60) default '',
`utimestamp` bigint(20) default 0,
`bytes` int(18) unsigned default 0,
`pkts` int(18) unsigned default 0,
PRIMARY KEY (`id`),
UNIQUE (`source`, `destination`, `utimestamp`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ;

View File

@ -22,7 +22,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC190121'; $build_version = 'PC190122';
$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

@ -116,7 +116,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.730'; $version = '7.0NG.730';
$build = '190121'; $build = '190122';
$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 190121 %define release 190122
# 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 190121 %define release 190122
%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

@ -3377,4 +3377,18 @@ CREATE TABLE IF NOT EXISTS `tagent_custom_fields_filter` (
`recursion` int(1) unsigned default '0', `recursion` int(1) unsigned default '0',
`group_search` int(10) unsigned default '0', `group_search` int(10) unsigned default '0',
PRIMARY KEY(`id`) PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) ENGINE = InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `tnetwork_matrix`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tnetwork_matrix` (
`id` int(10) unsigned NOT NULL auto_increment,
`source` varchar(60) default '',
`destination` varchar(60) default '',
`utimestamp` bigint(20) default 0,
`bytes` int(18) unsigned default 0,
`pkts` int(18) unsigned default 0,
PRIMARY KEY (`id`),
UNIQUE (`source`, `destination`, `utimestamp`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ;

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.730-190121 Version: 7.0NG.730-190122
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-190121" pandora_version="7.0NG.730-190122"
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 = "190121"; my $pandora_build = "190122";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -29,6 +29,8 @@ use XML::Parser::Expat;
use XML::Simple; use XML::Simple;
use POSIX qw(setsid strftime); use POSIX qw(setsid strftime);
use IO::Uncompress::Unzip; use IO::Uncompress::Unzip;
use JSON qw(decode_json);
use MIME::Base64;
# For Reverse Geocoding # For Reverse Geocoding
use LWP::Simple; use LWP::Simple;
@ -217,6 +219,10 @@ sub data_consumer ($$) {
process_xml_server ($self->getConfig (), $file_name, $xml_data, $self->getDBH ()); process_xml_server ($self->getConfig (), $file_name, $xml_data, $self->getDBH ());
} elsif (defined($xml_data->{'connection_source'})) { } elsif (defined($xml_data->{'connection_source'})) {
enterprise_hook('process_xml_connections', [$self->getConfig (), $file_name, $xml_data, $self->getDBH ()]); enterprise_hook('process_xml_connections', [$self->getConfig (), $file_name, $xml_data, $self->getDBH ()]);
} elsif (defined($xml_data->{'network_matrix'})){
process_xml_matrix_network(
$self->getConfig(), $xml_data, $self->getDBH()
);
} else { } else {
process_xml_data ($self->getConfig (), $file_name, $xml_data, $self->getServerID (), $self->getDBH ()); process_xml_data ($self->getConfig (), $file_name, $xml_data, $self->getServerID (), $self->getDBH ());
} }
@ -321,6 +327,7 @@ sub process_xml_data ($$$$$) {
# Get agent id # Get agent id
my $agent_id = get_agent_id ($dbh, $agent_name); my $agent_id = get_agent_id ($dbh, $agent_name);
my $group_id = 0;
if ($agent_id < 1) { if ($agent_id < 1) {
if ($pa_config->{'autocreate'} == 0) { if ($pa_config->{'autocreate'} == 0) {
logger($pa_config, "ERROR: There is no agent defined with name $agent_name", 3); logger($pa_config, "ERROR: There is no agent defined with name $agent_name", 3);
@ -329,7 +336,7 @@ sub process_xml_data ($$$$$) {
# Get OS, group and description # Get OS, group and description
my $os = pandora_get_os ($dbh, $data->{'os_name'}); my $os = pandora_get_os ($dbh, $data->{'os_name'});
my $group_id = $pa_config->{'autocreate_group'}; $group_id = $pa_config->{'autocreate_group'};
if (! defined (get_group_name ($dbh, $group_id))) { if (! defined (get_group_name ($dbh, $group_id))) {
if (defined ($data->{'group_id'}) && $data->{'group_id'} ne '') { if (defined ($data->{'group_id'}) && $data->{'group_id'} ne '') {
$group_id = $data->{'group_id'}; $group_id = $data->{'group_id'};
@ -965,5 +972,85 @@ sub unlink_modules {
db_do($dbh, "UPDATE tagente_modulo SET parent_module_id = 0 WHERE id_agente_modulo = ?", $child_id); db_do($dbh, "UPDATE tagente_modulo SET parent_module_id = 0 WHERE id_agente_modulo = ?", $child_id);
} }
##########################################################################
# Process events in the XML.
##########################################################################
sub process_events_dataserver {
my ($pa_config, $data, $agent_id, $group_id, $dbh) = @_;
return unless defined($data->{'events'});
foreach my $event (@{$data->{'events'}}) {
next unless defined($event->{'event'}) && defined($event->{'event'}->[0]);
my $event_info_encoded = $event->{'event'}->[0];
# Try to decode the base64 inside
my $event_info;
eval {
$event_info = decode_json(decode_base64($event_info_encoded));
};
if ($@) {
logger($pa_config, "Error processing base64 event data '$event_info_encoded'.", 5);
next;
}
next unless defined($event_info->{'data'});
pandora_event(
$pa_config,
$event_info->{'data'},
$group_id,
$agent_id,
defined($event_info->{'severity'}) ? $event_info->{'severity'} : 0,
0,
0,
'system',
0,
$dbh
);
}
return;
}
##########################################################################
# Process events in the XML.
##########################################################################
sub process_xml_matrix_network {
my ($pa_config, $data, $dbh) = @_;
my $utimestamp = $data->{'network_matrix'}->[0]->{'utimestamp'};
my $content = $data->{'network_matrix'}->[0]->{'content'};
return unless defined($utimestamp) && defined($content);
# Try to decode the base64 inside
my $matrix_info;
eval {
$matrix_info = decode_json(decode_base64($content));
};
if ($@) {
logger($pa_config, "Error processing base64 matrix data '$content'.", 5);
return;
}
foreach my $source (keys %$matrix_info) {
foreach my $destination (keys %{$matrix_info->{$source}}) {
my $matrix_single_data = $matrix_info->{$source}->{$destination};
$matrix_single_data->{'source'} = $source;
$matrix_single_data->{'destination'} = $destination;
$matrix_single_data->{'utimestamp'} = $utimestamp;
eval {
db_process_insert($dbh, 'id', 'tnetwork_matrix', $matrix_single_data);
};
if ($@) {
logger($pa_config, "Error inserted matrix data. Source: $source, destination: $destination, utimestamp: $utimestamp.", 5);
}
}
}
return;
}
1; 1;
__END__ __END__

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 = "190121"; my $pandora_build = "190122";
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 190121 %define release 190122
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 190121 %define release 190122
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="190121" PI_BUILD="190122"
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 PS190121"; my $version = "7.0NG.730 PS190122";
# 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 PS190121"; my $version = "7.0NG.730 PS190122";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);