diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 5edf2e031e..46498bd8fe 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.730-190121 +Version: 7.0NG.730-190122 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 47d6c97643..47128ef243 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 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." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 54b12f4f5b..00bb415dc9 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; 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 use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 6fb7b30b81..e4a54348bd 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.730 -%define release 190121 +%define release 190122 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 5bbd32b462..fe3f6aaff7 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.730 -%define release 190121 +%define release 190122 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 47fb301e3b..e95c7c910a 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.730" -PI_BUILD="190121" +PI_BUILD="190122" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 945e983da3..544b0425a4 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190121} +{190122} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index fee3ef8459..34845987ce 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #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_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 71d61237d1..855569fa37 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" 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" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index ec72bc0293..11e2512c6c 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.730-190121 +Version: 7.0NG.730-190122 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 7aa7dbadd5..56b66d548d 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.730-190121" +pandora_version="7.0NG.730-190122" package_pear=0 package_pandora=1 diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 5dc7cd70c4..d0d17dfb18 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -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 (`agent_id`) REFERENCES `tagente` (`id_agente`) ON DELETE CASCADE ) 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 ; diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index fd05f10323..1a0e4737e4 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190121'; +$build_version = 'PC190122'; $pandora_version = 'v7.0NG.730'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index ae0e37cbbc..d4aadca58d 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -116,7 +116,7 @@
getConfig (), $file_name, $xml_data, $self->getDBH ()); } elsif (defined($xml_data->{'connection_source'})) { 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 { process_xml_data ($self->getConfig (), $file_name, $xml_data, $self->getServerID (), $self->getDBH ()); } @@ -321,6 +327,7 @@ sub process_xml_data ($$$$$) { # Get agent id my $agent_id = get_agent_id ($dbh, $agent_name); + my $group_id = 0; if ($agent_id < 1) { if ($pa_config->{'autocreate'} == 0) { 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 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 ($data->{'group_id'}) && $data->{'group_id'} ne '') { $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); } +########################################################################## +# 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; __END__ diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index 7f59a34945..47341d6460 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -32,7 +32,7 @@ our @ISA = qw(Exporter); # version: Defines actual version of Pandora Server for this module only my $pandora_version = "7.0NG.730"; -my $pandora_build = "190121"; +my $pandora_build = "190122"; our $VERSION = $pandora_version." ".$pandora_build; our %EXPORT_TAGS = ( 'all' => [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index bc18642b58..d1020c30b2 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.730 -%define release 190121 +%define release 190122 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index c89ed5b2f2..798f7c9b5f 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.730 -%define release 190121 +%define release 190122 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 98b3dc1cb8..ccc329991d 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.730" -PI_BUILD="190121" +PI_BUILD="190122" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 74dfd0b39b..fe865df9b5 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.730 PS190121"; +my $version = "7.0NG.730 PS190122"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 338075ed7b..d15b70da59 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.730 PS190121"; +my $version = "7.0NG.730 PS190122"; # save program name for logging my $progname = basename($0);