mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
Merge branch 'ent-12904-quitar-funcionalidad-de-geolocalizacion-de-ips-en-mapas-giss' into 'develop'
Remove Geo::IP. See merge request artica/pandorafms!7084
This commit is contained in:
commit
f03fbcdef5
@ -304,7 +304,6 @@ server_dependencies=" \
|
|||||||
perl(Sys::Syslog) \
|
perl(Sys::Syslog) \
|
||||||
perl(DBI) \
|
perl(DBI) \
|
||||||
perl(XML::Simple) \
|
perl(XML::Simple) \
|
||||||
perl(Geo::IP) \
|
|
||||||
perl(IO::Socket::INET6) \
|
perl(IO::Socket::INET6) \
|
||||||
perl(XML::Twig) \
|
perl(XML::Twig) \
|
||||||
expect \
|
expect \
|
||||||
@ -344,7 +343,6 @@ ipam_dependencies=" \
|
|||||||
perl(Sys::Syslog) \
|
perl(Sys::Syslog) \
|
||||||
perl(DBI) \
|
perl(DBI) \
|
||||||
perl(XML::Simple) \
|
perl(XML::Simple) \
|
||||||
perl(Geo::IP) \
|
|
||||||
perl(IO::Socket::INET6) \
|
perl(IO::Socket::INET6) \
|
||||||
perl(XML::Twig)"
|
perl(XML::Twig)"
|
||||||
execute_cmd "yum install -y $ipam_dependencies" "Installing IPAM Instant client"
|
execute_cmd "yum install -y $ipam_dependencies" "Installing IPAM Instant client"
|
||||||
|
@ -417,7 +417,6 @@ server_dependencies=" \
|
|||||||
perl(Sys::Syslog) \
|
perl(Sys::Syslog) \
|
||||||
perl(DBI) \
|
perl(DBI) \
|
||||||
perl(XML::Simple) \
|
perl(XML::Simple) \
|
||||||
perl(Geo::IP) \
|
|
||||||
perl(IO::Socket::INET6) \
|
perl(IO::Socket::INET6) \
|
||||||
perl(XML::Twig) \
|
perl(XML::Twig) \
|
||||||
expect \
|
expect \
|
||||||
@ -457,7 +456,6 @@ ipam_dependencies=" \
|
|||||||
perl(Sys::Syslog) \
|
perl(Sys::Syslog) \
|
||||||
perl(DBI) \
|
perl(DBI) \
|
||||||
perl(XML::Simple) \
|
perl(XML::Simple) \
|
||||||
perl(Geo::IP) \
|
|
||||||
perl(IO::Socket::INET6) \
|
perl(IO::Socket::INET6) \
|
||||||
perl(XML::Twig)"
|
perl(XML::Twig)"
|
||||||
execute_cmd "dnf install -y $ipam_dependencies" "Installing IPAM Instant client"
|
execute_cmd "dnf install -y $ipam_dependencies" "Installing IPAM Instant client"
|
||||||
|
@ -116,7 +116,6 @@ RUN dnf install -y --setopt=tsflags=nodocs \
|
|||||||
"perl(Sys::Syslog)" \
|
"perl(Sys::Syslog)" \
|
||||||
"perl(DBI)" \
|
"perl(DBI)" \
|
||||||
"perl(XML::Simple)" \
|
"perl(XML::Simple)" \
|
||||||
"perl(Geo::IP)" \
|
|
||||||
"perl(IO::Socket::INET6)" \
|
"perl(IO::Socket::INET6)" \
|
||||||
"perl(XML::Twig)" \
|
"perl(XML::Twig)" \
|
||||||
expect \
|
expect \
|
||||||
@ -135,7 +134,7 @@ RUN dnf install -y http://firefly.artica.es/centos8/perl-Crypt-OpenSSL-AES-0.02-
|
|||||||
# Instant client Oracle
|
# Instant client Oracle
|
||||||
RUN dnf install -y https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm
|
RUN dnf install -y https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm
|
||||||
# Install IPAM dependencies
|
# Install IPAM dependencies
|
||||||
RUN dnf install -y "perl(NetAddr::IP)" "perl(Sys::Syslog)" "perl(DBI)" "perl(XML::Simple)" "perl(Geo::IP)" "perl(IO::Socket::INET6)" "perl(XML::Twig)" "perl(DBD::mysql)" --setopt=tsflags=nodocs
|
RUN dnf install -y "perl(NetAddr::IP)" "perl(Sys::Syslog)" "perl(DBI)" "perl(XML::Simple)" "perl(IO::Socket::INET6)" "perl(XML::Twig)" "perl(DBD::mysql)" --setopt=tsflags=nodocs
|
||||||
|
|
||||||
|
|
||||||
EXPOSE 80 443 41121 162/udp
|
EXPOSE 80 443 41121 162/udp
|
||||||
|
@ -31,7 +31,6 @@ WriteMakefile(
|
|||||||
HTML::Entities => 0,
|
HTML::Entities => 0,
|
||||||
IO::Socket::INET6 => 0,
|
IO::Socket::INET6 => 0,
|
||||||
JSON => 0,
|
JSON => 0,
|
||||||
Geo::IP => 0,
|
|
||||||
},
|
},
|
||||||
EXE_FILES => [ @exe_files ],
|
EXE_FILES => [ @exe_files ],
|
||||||
PMLIBDIRS => [ 'lib' ],
|
PMLIBDIRS => [ 'lib' ],
|
||||||
|
@ -459,11 +459,10 @@ sub process_xml_data ($$$$$) {
|
|||||||
my $description = '';
|
my $description = '';
|
||||||
$description = $data->{'description'} if (defined ($data->{'description'}));
|
$description = $data->{'description'} if (defined ($data->{'description'}));
|
||||||
my $alias = (defined ($data->{'agent_alias'}) && $data->{'agent_alias'} ne '') ? $data->{'agent_alias'} : $data->{'agent_name'};
|
my $alias = (defined ($data->{'agent_alias'}) && $data->{'agent_alias'} ne '') ? $data->{'agent_alias'} : $data->{'agent_name'};
|
||||||
my $location = get_geoip_info($pa_config, $address);
|
|
||||||
$agent_id = pandora_create_agent($pa_config, $pa_config->{'servername'}, $agent_name, $address,
|
$agent_id = pandora_create_agent($pa_config, $pa_config->{'servername'}, $agent_name, $address,
|
||||||
$group_id, $parent_id, $os,
|
$group_id, $parent_id, $os,
|
||||||
$description, $interval, $dbh, $timezone_offset,
|
$description, $interval, $dbh, $timezone_offset,
|
||||||
$location->{'longitude'}, $location->{'latitude'}, undef, undef,
|
undef, undef, undef, undef,
|
||||||
$custom_id, $url_address, $agent_mode, $alias
|
$custom_id, $url_address, $agent_mode, $alias
|
||||||
);
|
);
|
||||||
if (! defined ($agent_id)) {
|
if (! defined ($agent_id)) {
|
||||||
|
@ -40,8 +40,6 @@ Exported Functions:
|
|||||||
|
|
||||||
=item * C<distance_moved>
|
=item * C<distance_moved>
|
||||||
|
|
||||||
=item * C<get_geoip_info>
|
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head1 METHODS
|
=head1 METHODS
|
||||||
@ -66,7 +64,6 @@ our %EXPORT_TAGS = ( 'all' => [ qw( ) ] );
|
|||||||
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
||||||
our @EXPORT = qw(
|
our @EXPORT = qw(
|
||||||
distance_moved
|
distance_moved
|
||||||
get_geoip_info
|
|
||||||
);
|
);
|
||||||
# Some intenrnal constants
|
# Some intenrnal constants
|
||||||
|
|
||||||
@ -128,46 +125,6 @@ sub distance_moved ($$$$$$$) {
|
|||||||
return $dist_in_meters;
|
return $dist_in_meters;
|
||||||
}
|
}
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
=head2 C<< get_geoip_info (I<$pa_config>, I<$address>, I<$dispersion>) >>
|
|
||||||
|
|
||||||
Get GIS information from the MaxMind GeoIP database on file using Geo::IP module
|
|
||||||
|
|
||||||
B<Returns>: I<undef> if there is not information available or a B<hash ref> with:
|
|
||||||
* I<longitude>
|
|
||||||
* I<latitude>
|
|
||||||
|
|
||||||
=cut
|
|
||||||
##########################################################################
|
|
||||||
sub get_geoip_info {
|
|
||||||
my ($pa_config, $address) = @_;
|
|
||||||
|
|
||||||
# Return undef if feature is not activated
|
|
||||||
return undef unless ($pa_config->{'activate_gis'} && $pa_config->{'recon_reverse_geolocation_file'} ne '');
|
|
||||||
|
|
||||||
my $record = undef;
|
|
||||||
eval {
|
|
||||||
local $SIG{__DIE__};
|
|
||||||
my $gi = Geo::IP->open($pa_config->{'recon_reverse_geolocation_file'}, GEOIP_STANDARD);
|
|
||||||
die("Cannot load the geoip file \"" . $pa_config->{'recon_reverse_geolocation_file'} . "\".\n") unless defined($gi);
|
|
||||||
$record = $gi->record_by_addr($address);
|
|
||||||
};
|
|
||||||
if ($@) {
|
|
||||||
logger($pa_config, "Error giving coordinates to IP: $address. $@", 8);
|
|
||||||
}
|
|
||||||
return undef unless defined($record);
|
|
||||||
|
|
||||||
# Fuzzy position filter
|
|
||||||
my ($longitude, $latitude) = get_random_close_point (
|
|
||||||
$pa_config, $record->longitude, $record->latitude
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
"longitude" => $longitude,
|
|
||||||
"latitude" => $latitude
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
=head2 C<< get_random_close_point(I<$pa_config>, I<$center_longitude>, I<$center_latitude>) >>
|
=head2 C<< get_random_close_point(I<$pa_config>, I<$center_longitude>, I<$center_latitude>) >>
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ Requires: perl(NetAddr::IP) net-snmp net-tools
|
|||||||
Requires: perl(IO::Socket::INET6) perl(IO::Socket::SSL) perl(Net::Telnet)
|
Requires: perl(IO::Socket::INET6) perl(IO::Socket::SSL) perl(Net::Telnet)
|
||||||
Requires: fping nmap sudo perl(JSON)
|
Requires: fping nmap sudo perl(JSON)
|
||||||
Requires: perl(Time::HiRes) perl(Encode::Locale)
|
Requires: perl(Time::HiRes) perl(Encode::Locale)
|
||||||
Requires: perl perl(Sys::Syslog) perl(HTML::Entities) perl(Geo::IP) expect
|
Requires: perl perl(Sys::Syslog) perl(HTML::Entities) expect
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Pandora FMS is a monitoring system for big IT environments. It uses remote tests, or local agents to grab information. Pandora supports all standard OS (Linux, AIX, HP-UX, Solaris and Windows XP,2000/2003), and support multiple setups in HA enviroments.
|
Pandora FMS is a monitoring system for big IT environments. It uses remote tests, or local agents to grab information. Pandora supports all standard OS (Linux, AIX, HP-UX, Solaris and Windows XP,2000/2003), and support multiple setups in HA enviroments.
|
||||||
|
@ -263,11 +263,9 @@ install () {
|
|||||||
echo " Recommended: p5-DBI p5-NetAddr-IP p5-XML-Simple p5-XML-Twig p5-HTML-Parser p5-DBD-mysql p5-Socket6 p5-IO-Socket-INET6 p5-JSON"
|
echo " Recommended: p5-DBI p5-NetAddr-IP p5-XML-Simple p5-XML-Twig p5-HTML-Parser p5-DBD-mysql p5-Socket6 p5-IO-Socket-INET6 p5-JSON"
|
||||||
echo " Optional: nmap"
|
echo " Optional: nmap"
|
||||||
echo " "
|
echo " "
|
||||||
echo " And install Geo::IP manually."
|
|
||||||
echo " "
|
|
||||||
echo "To get them from source through CPAN do"
|
echo "To get them from source through CPAN do"
|
||||||
echo " "
|
echo " "
|
||||||
echo " $ cpan Time::Local DBI Socket6 XML::Simple XML::Twig IO::Socket Time::HiRes NetAddr::IP HTML::Entities IO::Socket::INET6 JSON Geo::IP"
|
echo " $ cpan Time::Local DBI Socket6 XML::Simple XML::Twig IO::Socket Time::HiRes NetAddr::IP HTML::Entities IO::Socket::INET6 JSON"
|
||||||
echo " "
|
echo " "
|
||||||
rm output
|
rm output
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -1,92 +0,0 @@
|
|||||||
#!/usr/bin/perl
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Pandora FMS DB Management
|
|
||||||
###############################################################################
|
|
||||||
# Copyright (c) 2005-2023 Pandora FMS
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or
|
|
||||||
# modify it under the terms of the GNU General Public License
|
|
||||||
# as published by the Free Software Foundation; version 2
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
# Includes list
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
use Time::Local; # DateTime basic manipulation
|
|
||||||
use DBI; # DB interface with MySQL
|
|
||||||
use POSIX qw(strftime);
|
|
||||||
use Time::HiRes qw(usleep);
|
|
||||||
|
|
||||||
# Default lib dir for RPM and DEB packages
|
|
||||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
|
||||||
|
|
||||||
use PandoraFMS::Core;
|
|
||||||
use PandoraFMS::Config;
|
|
||||||
use PandoraFMS::DB;
|
|
||||||
use PandoraFMS::GIS;
|
|
||||||
|
|
||||||
# Pandora server configuration
|
|
||||||
my %conf;
|
|
||||||
|
|
||||||
# Pandora db handler
|
|
||||||
my $dbh;
|
|
||||||
|
|
||||||
# FLUSH in each IO
|
|
||||||
$| = 1;
|
|
||||||
|
|
||||||
sub print_agent_gis_update_help() {
|
|
||||||
print "Usage: $0 <path to pandora_server.conf>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Get options
|
|
||||||
my ($configuration_file) = @ARGV;
|
|
||||||
if (!defined($configuration_file) || $configuration_file eq '-h' || $configuration_file eq '--help') {
|
|
||||||
print_agent_gis_update_help();
|
|
||||||
exit defined($configuration_file) ? 0 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Load configuration file
|
|
||||||
$conf{'pandora_path'} = $configuration_file;
|
|
||||||
$conf{'quiet'} = 0;
|
|
||||||
pandora_load_config(\%conf);
|
|
||||||
|
|
||||||
use Data::Dumper;
|
|
||||||
#print Dumper(\%conf);
|
|
||||||
|
|
||||||
if (!$conf{'activate_gis'} || $conf{'recon_reverse_geolocation_file'} eq '') {
|
|
||||||
print "Geolocation feature es blocked.\n";
|
|
||||||
exit 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Connect to the DB
|
|
||||||
$dbh = db_connect ('mysql', $conf{'dbname'}, $conf{'dbhost'}, $conf{'dbport'}, $conf{'dbuser'}, $conf{'dbpass'});
|
|
||||||
if (!defined($dbh)){
|
|
||||||
print "Cannot connect to database\n";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Get all agents with IP assigned
|
|
||||||
my @agents = get_db_rows($dbh,
|
|
||||||
"SELECT id_agente, direccion, alias FROM tagente WHERE disabled = 0 AND direccion <> ''"
|
|
||||||
);
|
|
||||||
|
|
||||||
my $c_time = strftime ("%Y/%m/%d %H:%M:%S", localtime());
|
|
||||||
foreach my $agent (@agents) {
|
|
||||||
my $location = get_geoip_info (\%conf, $agent->{'direccion'});
|
|
||||||
if (defined($location)) {
|
|
||||||
pandora_update_gis_data(\%conf, $dbh, $agent->{'id_agente'}, $agent->{'id_agente'}, $location->{'longitude'}, $location->{'latitude'}, undef, undef, $c_time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print "Successfull relocation\n";
|
|
||||||
|
|
||||||
db_disconnect($dbh);
|
|
||||||
exit 0;
|
|
@ -91,8 +91,6 @@ RUN dnf install -y vim wget bzip2 curl && \
|
|||||||
gettext \
|
gettext \
|
||||||
wmic \
|
wmic \
|
||||||
chromium \
|
chromium \
|
||||||
cpanminus && \
|
|
||||||
cpanm Geo::IP && \
|
|
||||||
mkdir -p /opt/phantomjs/bin && cd /opt/phantomjs/bin && \
|
mkdir -p /opt/phantomjs/bin && cd /opt/phantomjs/bin && \
|
||||||
wget https://netcologne.dl.sourceforge.net/project/pandora/Tools%20and%20dependencies%20%28All%20versions%29/DEB%20Debian%2C%20Ubuntu/phantomjs && \
|
wget https://netcologne.dl.sourceforge.net/project/pandora/Tools%20and%20dependencies%20%28All%20versions%29/DEB%20Debian%2C%20Ubuntu/phantomjs && \
|
||||||
chmod +x phantomjs && \
|
chmod +x phantomjs && \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user