Merge branch 'ent-8884-meter-os_version-cogiendo-de-recon-de-red' into 'develop'
Add support for OS version detection via SNMP. See merge request artica/pandorafms!5038
This commit is contained in:
commit
da1838d3bb
|
@ -1546,6 +1546,25 @@ sub PandoraFMS::Recon::Base::report_scanned_agents($;$) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Update OS information.
|
||||||
|
foreach my $agent (@agents) {
|
||||||
|
|
||||||
|
# Avoid processing if does not exist.
|
||||||
|
next unless (defined($agent->{'agent_id'}));
|
||||||
|
|
||||||
|
# Make sure OS version information is available.
|
||||||
|
next unless (defined($agent->{'os_version'}));
|
||||||
|
|
||||||
|
# Is the agent in learning mode?
|
||||||
|
next unless ($agent->{'modo'} == 1);
|
||||||
|
|
||||||
|
# Set the OS version.
|
||||||
|
db_do($self->{'dbh'},
|
||||||
|
'UPDATE tagente SET os_version=? WHERE id_agente=?',
|
||||||
|
$agent->{'os_version'}, $agent->{'agent_id'}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
# Connect agents.
|
# Connect agents.
|
||||||
my @connections = get_db_rows(
|
my @connections = get_db_rows(
|
||||||
$self->{'dbh'},
|
$self->{'dbh'},
|
||||||
|
@ -1595,9 +1614,12 @@ sub PandoraFMS::Recon::Base::report_scanned_agents($;$) {
|
||||||
|
|
||||||
next if is_empty($label);
|
next if is_empty($label);
|
||||||
|
|
||||||
# Retrieve target agent OS version.
|
# Retrieve target agent OS.
|
||||||
$self->{'agents_found'}->{$addr}{'agent'}{'id_os'} = $self->guess_os($addr);
|
$self->{'agents_found'}->{$addr}{'agent'}{'id_os'} = $self->guess_os($addr);
|
||||||
|
|
||||||
|
# Retrieve target agent OS version.
|
||||||
|
$self->{'agents_found'}->{$addr}{'agent'}{'os_version'} = $self->get_os_version($addr);
|
||||||
|
|
||||||
$self->call('update_progress', $progress);
|
$self->call('update_progress', $progress);
|
||||||
$progress += $step;
|
$progress += $step;
|
||||||
# Store temporally. Wait user approval.
|
# Store temporally. Wait user approval.
|
||||||
|
|
|
@ -78,7 +78,7 @@ our $IPROUTEIFINDEX = ".1.3.6.1.2.1.4.21.1.2";
|
||||||
our $IPROUTENEXTHOP = ".1.3.6.1.2.1.4.21.1.7";
|
our $IPROUTENEXTHOP = ".1.3.6.1.2.1.4.21.1.7";
|
||||||
our $IPROUTETYPE = ".1.3.6.1.2.1.4.21.1.8";
|
our $IPROUTETYPE = ".1.3.6.1.2.1.4.21.1.8";
|
||||||
our $PRTMARKERINDEX = ".1.3.6.1.2.1.43.10.2.1.1";
|
our $PRTMARKERINDEX = ".1.3.6.1.2.1.43.10.2.1.1";
|
||||||
our $SYSDESCR = ".1.3.6.1.2.1.1.1";
|
our $SYSDESCR = ".1.3.6.1.2.1.1.1.0";
|
||||||
our $SYSSERVICES = ".1.3.6.1.2.1.1.7";
|
our $SYSSERVICES = ".1.3.6.1.2.1.1.7";
|
||||||
our $SYSUPTIME = ".1.3.6.1.2.1.1.3";
|
our $SYSUPTIME = ".1.3.6.1.2.1.1.3";
|
||||||
our $VTPVLANIFINDEX = ".1.3.6.1.4.1.9.9.46.1.3.1.1.18.1";
|
our $VTPVLANIFINDEX = ".1.3.6.1.4.1.9.9.46.1.3.1.1.18.1";
|
||||||
|
@ -554,6 +554,27 @@ sub gateway_connectivity($$) {
|
||||||
$self->mark_connected($gw, '', $host, '');
|
$self->mark_connected($gw, '', $host, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Retrieve OS version via SNMP.
|
||||||
|
################################################################################
|
||||||
|
sub get_os_version($$) {
|
||||||
|
my ($self, $device) = @_;
|
||||||
|
|
||||||
|
# OS detection disabled.
|
||||||
|
return '' if ($self->{'os_detection'} == 0);
|
||||||
|
|
||||||
|
# Does the device respond to SNMP?
|
||||||
|
return '' unless ($self->is_snmp_discovered($device));
|
||||||
|
|
||||||
|
# Retrieve the system description, which should contain the OS version.
|
||||||
|
my $os_version = $self->snmp_get_value($device, "$PandoraFMS::Recon::Base::SYSDESCR");
|
||||||
|
|
||||||
|
# Remove leading and trailing quotes.
|
||||||
|
$os_version = $1 if ($os_version =~ /^"(.*)"$/);
|
||||||
|
|
||||||
|
return defined($os_version) ? $os_version : '';
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Find IP address aliases for the given device.
|
# Find IP address aliases for the given device.
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
Loading…
Reference in New Issue