+ enhance cisco ipsla (managing no tag name)

This commit is contained in:
garnier-quentin 2015-12-11 17:15:14 +01:00
parent f8732d38c4
commit bbdb1bd7cc
1 changed files with 7 additions and 3 deletions

View File

@ -319,7 +319,7 @@ sub get_my_delta {
my $value;
my ($old_time1, $old_time2) = split /_/, $options{old_datas}->{$self->{instance} . '_' . $options{name} . '_times'};
my ($new_time1, $new_time2) = split /_/, $options{new_datas}->{$self->{instance} . '_' . $options{name} . '_times'};
if ($old_time1 == $new_time1) {
if (defined($old_time1) && defined($new_time1) && $old_time1 == $new_time1) {
$value = $options{new_datas}->{$self->{instance} . '_' . $options{name} . '_1'} - $options{old_datas}->{$self->{instance} . '_' . $options{name} . '_1'} +
$options{new_datas}->{$self->{instance} . '_' . $options{name} . '_2'} - $options{old_datas}->{$self->{instance} . '_' . $options{name} . '_2'};
} else {
@ -944,13 +944,17 @@ sub manage_selection {
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_rttMonCtrlAdminEntry}, instance => $instance);
my $tag_name = $result->{rttMonCtrlAdminTag};
if (!defined($tag_name) || $tag_name eq '') {
$self->{output}->output_add(long_msg => "skipping: please set a tag name");
next;
}
if (defined($self->{datas}->{$tag_name})) {
$self->{output}->output_add(long_msg => "Skipping '" . $tag_name . "': duplicate (please change the tag name).");
$self->{output}->output_add(long_msg => "skipping '" . $tag_name . "': duplicate (please change the tag name).");
next;
}
if (defined($self->{option_results}->{filter_tag}) && $self->{option_results}->{filter_tag} ne '' &&
$tag_name !~ /$self->{option_results}->{filter_tag}/) {
$self->{output}->output_add(long_msg => "Skipping '" . $tag_name . "': no matching filter.");
$self->{output}->output_add(long_msg => "skipping '" . $tag_name . "': no matching filter.");
next;
}
$self->{datas}->{$tag_name} = { %{$result} };