mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
multiple fixes
This commit is contained in:
parent
3d01b918c9
commit
890cfe68aa
@ -6276,7 +6276,10 @@ sub notification_get_users {
|
|||||||
safe_input($source)
|
safe_input($source)
|
||||||
);
|
);
|
||||||
|
|
||||||
@results = map { $_->{'id_user'} } @results;
|
@results = map {
|
||||||
|
if(ref($_) eq 'HASH') { $_->{'id_user'} }
|
||||||
|
else {}
|
||||||
|
} @results;
|
||||||
|
|
||||||
return @results;
|
return @results;
|
||||||
}
|
}
|
||||||
@ -6301,7 +6304,10 @@ sub notification_get_groups {
|
|||||||
safe_input($source)
|
safe_input($source)
|
||||||
);
|
);
|
||||||
|
|
||||||
@results = map { $_->{'id_group'} } @results;
|
@results = map {
|
||||||
|
if(ref($_) eq 'HASH') { $_->{'id_group'} }
|
||||||
|
else {}
|
||||||
|
} @results;
|
||||||
|
|
||||||
return @results;
|
return @results;
|
||||||
}
|
}
|
||||||
|
@ -675,6 +675,12 @@ sub get_pen_templates($$) {
|
|||||||
$pen
|
$pen
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@results = map {
|
||||||
|
if (ref($_) eq 'HASH') { $_->{'id_np'} }
|
||||||
|
else {}
|
||||||
|
} @results;
|
||||||
|
|
||||||
|
|
||||||
return @results;
|
return @results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,7 +545,8 @@ sub PandoraFMS::Recon::Base::test_module($$) {
|
|||||||
$test->{'id_tipo_modulo'}
|
$test->{'id_tipo_modulo'}
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
# Numeric.
|
# Numeric. Remove " symbols if any.
|
||||||
|
$value =~ s/\"//g;
|
||||||
return 0 unless is_numeric($value);
|
return 0 unless is_numeric($value);
|
||||||
|
|
||||||
if (is_in_array([2,6,9,18,21,31,35], $test->{'id_tipo_modulo'})) {
|
if (is_in_array([2,6,9,18,21,31,35], $test->{'id_tipo_modulo'})) {
|
||||||
@ -842,7 +843,9 @@ sub PandoraFMS::Recon::Base::create_network_profile_modules($$) {
|
|||||||
|
|
||||||
if (is_enabled($self->{'task_data'}{'auto_monitor'})) {
|
if (is_enabled($self->{'task_data'}{'auto_monitor'})) {
|
||||||
# Apply PEN monitoring template (HW).
|
# Apply PEN monitoring template (HW).
|
||||||
push @template_ids, get_pen_templates($self->{'dbh'}, $self->get_pen($device));
|
my @pen_templates= get_pen_templates($self->{'dbh'}, $self->get_pen($device));
|
||||||
|
# Join.
|
||||||
|
@template_ids = (@template_ids, @pen_templates);
|
||||||
} else {
|
} else {
|
||||||
# Return if no specific templates are selected.
|
# Return if no specific templates are selected.
|
||||||
return if is_empty($self->{'id_network_profile'});
|
return if is_empty($self->{'id_network_profile'});
|
||||||
@ -861,7 +864,7 @@ sub PandoraFMS::Recon::Base::create_network_profile_modules($$) {
|
|||||||
if (defined($template->{'pen'})) {
|
if (defined($template->{'pen'})) {
|
||||||
my @penes = split(',', $template->{'pen'});
|
my @penes = split(',', $template->{'pen'});
|
||||||
|
|
||||||
next unless (is_in_array(\@penes, $data->{'pen'}));
|
next unless (is_in_array(\@penes, $self->get_pen($device)));
|
||||||
}
|
}
|
||||||
|
|
||||||
# 3. Retrieve module list from target template.
|
# 3. Retrieve module list from target template.
|
||||||
@ -1595,8 +1598,9 @@ sub PandoraFMS::Recon::Base::update_progress ($$) {
|
|||||||
|
|
||||||
my $stats = {};
|
my $stats = {};
|
||||||
if (defined($self->{'summary'}) && $self->{'summary'} ne '') {
|
if (defined($self->{'summary'}) && $self->{'summary'} ne '') {
|
||||||
$stats->{'summary'} = $self->{'task_data'}{'summary'};
|
$stats->{'summary'} = $self->{'summary'};
|
||||||
}
|
}
|
||||||
|
|
||||||
$stats->{'step'} = $self->{'step'};
|
$stats->{'step'} = $self->{'step'};
|
||||||
$stats->{'c_network_name'} = $self->{'c_network_name'};
|
$stats->{'c_network_name'} = $self->{'c_network_name'};
|
||||||
$stats->{'c_network_percent'} = $self->{'c_network_percent'};
|
$stats->{'c_network_percent'} = $self->{'c_network_percent'};
|
||||||
|
@ -1360,8 +1360,11 @@ sub add_module($$$) {
|
|||||||
return unless ref($data) eq 'HASH' && defined($data->{'name'})
|
return unless ref($data) eq 'HASH' && defined($data->{'name'})
|
||||||
&& $data->{'name'} ne '';
|
&& $data->{'name'} ne '';
|
||||||
|
|
||||||
# Test module. Is it success?
|
# Test module. Is it success? Some components have MIB name instead OID.
|
||||||
|
$self->{'translate_snmp'} = 1;
|
||||||
my $rs = $self->call('test_module', $agent, $data);
|
my $rs = $self->call('test_module', $agent, $data);
|
||||||
|
$self->{'translate_snmp'} = 0;
|
||||||
|
|
||||||
return unless is_enabled($rs);
|
return unless is_enabled($rs);
|
||||||
|
|
||||||
$self->{'agents_found'}->{$agent}->{'modules'}{$data->{'name'}} = $data;
|
$self->{'agents_found'}->{$agent}->{'modules'}{$data->{'name'}} = $data;
|
||||||
@ -2059,10 +2062,17 @@ sub snmp_get_command {
|
|||||||
sub snmp_get_value($$$) {
|
sub snmp_get_value($$$) {
|
||||||
my ($self, $device, $oid) = @_;
|
my ($self, $device, $oid) = @_;
|
||||||
|
|
||||||
my @output = $self->snmp_get($device, $oid);
|
my $effective_oid = $oid;
|
||||||
|
if (is_enabled($self->{'translate_snmp'})) {
|
||||||
|
$effective_oid = `snmptranslate $oid -On 2>$DEVNULL`;
|
||||||
|
chomp($effective_oid);
|
||||||
|
}
|
||||||
|
|
||||||
|
my @output = $self->snmp_get($device, $effective_oid);
|
||||||
|
|
||||||
foreach my $line (@output) {
|
foreach my $line (@output) {
|
||||||
chomp($line);
|
chomp($line);
|
||||||
return $1 if ($line =~ /^$oid\s+=\s+\S+:\s+(.*)$/);
|
return $1 if ($line =~ /^$effective_oid\s+=\s+\S+:\s+(.*)$/);
|
||||||
}
|
}
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user