From 36f59a5ab97a7b508cdf42f160f5118a36fe6867 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Fri, 11 Dec 2015 17:15:14 +0100 Subject: [PATCH] + enhance cisco ipsla (managing no tag name) --- .../centreon/common/cisco/standard/snmp/mode/ipsla.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/centreon-plugins/centreon/common/cisco/standard/snmp/mode/ipsla.pm b/centreon-plugins/centreon/common/cisco/standard/snmp/mode/ipsla.pm index a3b98b84e..ea4385571 100644 --- a/centreon-plugins/centreon/common/cisco/standard/snmp/mode/ipsla.pm +++ b/centreon-plugins/centreon/common/cisco/standard/snmp/mode/ipsla.pm @@ -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} };