From e60537dd2cf7d245d4859c42056227ec1e662772 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Thu, 7 May 2015 14:43:45 +0200 Subject: [PATCH] Fix #45 Tested! --- .../snmp/mode/apchannelinterference.pm | 2 +- .../airespace/snmp/mode/apchannelnoise.pm | 4 +- .../common/airespace/snmp/mode/apstatus.pm | 4 +- .../common/airespace/snmp/mode/apusers.pm | 61 ++++++++++--------- .../airespace/snmp/mode/components/psu.pm | 4 +- 5 files changed, 38 insertions(+), 37 deletions(-) diff --git a/centreon/common/airespace/snmp/mode/apchannelinterference.pm b/centreon/common/airespace/snmp/mode/apchannelinterference.pm index 02f494f4a..eef140629 100644 --- a/centreon/common/airespace/snmp/mode/apchannelinterference.pm +++ b/centreon/common/airespace/snmp/mode/apchannelinterference.pm @@ -193,7 +193,7 @@ sub manage_selection { } my $instance_end; foreach my $oid2 (keys %{$self->{results}->{$oid_bsnAPIfInterferencePower}}) { - if ($oid2 =~ /^$oid\.(\d+)\.(\d+)$/) { + if ($oid2 =~ /^$oid_bsnAPIfInterferencePower\.$instance_mac\.(\d+)\.(\d+)$/) { $instance_end = $1 . '.' . $2; if (defined($self->{option_results}->{filter_channel}) && $self->{option_results}->{filter_channel} ne '' && diff --git a/centreon/common/airespace/snmp/mode/apchannelnoise.pm b/centreon/common/airespace/snmp/mode/apchannelnoise.pm index c750df1a6..79c9ae135 100644 --- a/centreon/common/airespace/snmp/mode/apchannelnoise.pm +++ b/centreon/common/airespace/snmp/mode/apchannelnoise.pm @@ -45,7 +45,7 @@ my $maps_counters = { '000_noise-power' => { class => 'centreon::plugins::values', obj => undef, set => { key_values => [ - { name => 'noise_power' } + { name => 'noise_power' }, { name => 'label_perfdata' } ], output_template => 'Noise Power : %s dBm', perfdatas => [ @@ -179,7 +179,7 @@ sub manage_selection { } my $instance_end; foreach my $oid2 (keys %{$self->{results}->{$oid_bsnAPIfDBNoisePower}}) { - if ($oid2 =~ /^$oid\.(\d+)\.(\d+)$/) { + if ($oid2 =~ /^$oid_bsnAPIfDBNoisePower\.$instance_mac\.(\d+)\.(\d+)$/) { $instance_end = $1 . '.' . $2; if (defined($self->{option_results}->{filter_channel}) && $self->{option_results}->{filter_channel} ne '' && diff --git a/centreon/common/airespace/snmp/mode/apstatus.pm b/centreon/common/airespace/snmp/mode/apstatus.pm index a2eca4e7e..d476661b4 100644 --- a/centreon/common/airespace/snmp/mode/apstatus.pm +++ b/centreon/common/airespace/snmp/mode/apstatus.pm @@ -262,8 +262,8 @@ sub manage_selection { $oid =~ /^$mapping->{bsnAPName}->{oid}\.(.*)$/; my $instance = $1; my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{ $mapping->{bsnAPName}->{oid} }, instance => $instance); - my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{ $mapping->{bsnAPOperationStatus}->{oid} }, instance => $instance); - my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{ $mapping->{bsnAPAdminStatus}->{oid} }, instance => $instance); + my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{ $mapping2->{bsnAPOperationStatus}->{oid} }, instance => $instance); + my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{ $mapping3->{bsnAPAdminStatus}->{oid} }, instance => $instance); if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && $result->{bsnAPName} !~ /$self->{option_results}->{filter_name}/) { $self->{output}->output_add(long_msg => "Skipping '" . $result->{bsnAPName} . "': no matching filter."); diff --git a/centreon/common/airespace/snmp/mode/apusers.pm b/centreon/common/airespace/snmp/mode/apusers.pm index fabb19ff7..f005a8825 100644 --- a/centreon/common/airespace/snmp/mode/apusers.pm +++ b/centreon/common/airespace/snmp/mode/apusers.pm @@ -51,84 +51,84 @@ my $maps_counters = { ], } }, - '001_idle' => { class => 'centreon::plugins::values', obj => undef, + '001_total-idle' => { class => 'centreon::plugins::values', obj => undef, set => { - key_values => [ { name => 'idle' } ], + key_values => [ { name => 'total_idle' } ], output_template => 'Total Idle Users : %s', perfdatas => [ - { label => 'total_idle', value => 'idle_absolute', template => '%s', + { label => 'total_idle', value => 'total_idle_absolute', template => '%s', unit => 'users', min => 0 }, ], } }, - '002_aaapending' => { set => { - key_values => [ { name => 'aaapending' } ], + '002_total-aaapending' => { set => { + key_values => [ { name => 'total_aaapending' } ], output_template => 'Total AaaPending Users : %s', perfdatas => [ - { label => 'total_aaapending', value => 'aaapending_absolute', template => '%s', + { label => 'total_aaapending', value => 'total_aaapending_absolute', template => '%s', unit => 'users', min => 0 }, ], } }, - '003_authenticated' => { set => { - key_values => [ { name => 'authenticated' } ], + '003_total-authenticated' => { set => { + key_values => [ { name => 'total_authenticated' } ], output_template => 'Total Authenticated Users : %s', perfdatas => [ - { label => 'total_authenticated', value => 'authenticated_absolute', template => '%s', + { label => 'total_authenticated', value => 'total_authenticated_absolute', template => '%s', unit => 'users', min => 0 }, ], } }, - '004_associated' => { set => { - key_values => [ { name => 'associated' } ], + '004_total-associated' => { set => { + key_values => [ { name => 'total_associated' } ], output_template => 'Total Associated Users : %s', perfdatas => [ - { label => 'total_associated', value => 'associated_absolute', template => '%s', + { label => 'total_associated', value => 'total_associated_absolute', template => '%s', unit => 'users', min => 0 }, ], } }, - '005_powersave' => { set => { - key_values => [ { name => 'idle' } ], + '005_total-powersave' => { set => { + key_values => [ { name => 'total_powersave' } ], output_template => 'Total Powersave Users : %s', perfdatas => [ - { label => 'total_powersave', value => 'powersave_absolute', template => '%s', + { label => 'total_powersave', value => 'total_powersave_absolute', template => '%s', unit => 'users', min => 0 }, ], } }, - '006_disassociated' => { set => { - key_values => [ { name => 'disassociated' } ], + '006_total-disassociated' => { set => { + key_values => [ { name => 'total_disassociated' } ], output_template => 'Total Disassociated Users : %s', perfdatas => [ - { label => 'total_disassociated', value => 'disassociated_absolute', template => '%s', + { label => 'total_disassociated', value => 'total_disassociated_absolute', template => '%s', unit => 'users', min => 0 }, ], } }, - '007_tobedeleted' => { set => { - key_values => [ { name => 'tobedeleted' } ], + '007_total-tobedeleted' => { set => { + key_values => [ { name => 'total_tobedeleted' } ], output_template => 'Total ToBeDeleted Users : %s', perfdatas => [ - { label => 'total_tobedeleted', value => 'tobedeleted_absolute', template => '%s', + { label => 'total_tobedeleted', value => 'total_tobedeleted_absolute', template => '%s', unit => 'users', min => 0 }, ], } }, - '008_probing' => { set => { - key_values => [ { name => 'probing' } ], + '008_total-probing' => { set => { + key_values => [ { name => 'total_probing' } ], output_template => 'Total Probing Users : %s', perfdatas => [ - { label => 'total_probing', value => 'probing_absolute', template => '%s', + { label => 'total_probing', value => 'total_probing_absolute', template => '%s', unit => 'users', min => 0 }, ], } }, - '009_blacklisted' => { set => { + '009_total-blacklisted' => { set => { key_values => [ { name => 'blacklisted' } ], output_template => 'Total Blacklisted Users : %s', perfdatas => [ - { label => 'total_blacklisted', value => 'blacklisted_absolute', template => '%s', + { label => 'total_blacklisted', value => 'total_blacklisted_absolute', template => '%s', unit => 'users', min => 0 }, ], } @@ -239,7 +239,9 @@ my $mapping2 = { sub manage_selection { my ($self, %options) = @_; - $self->{global} = { total => 0 }; + $self->{global} = { total => 0, total_idle => 0, total_aaapending => 0, total_authenticated => 0, + total_associated => 0, total_powersave => 0, total_disassociated => 0, + total_tobedeleted => 0, total_probing => 0, total_blacklisted => 0}; $self->{results} = $self->{snmp}->get_multiple_table(oids => [ { oid => $mapping->{bsnMobileStationStatus}->{oid} }, { oid => $mapping2->{bsnMobileStationSsid}->{oid} }, ], @@ -248,15 +250,14 @@ sub manage_selection { $oid =~ /^$mapping->{bsnMobileStationStatus}->{oid}\.(.*)$/; my $instance = $1; my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{ $mapping->{bsnMobileStationStatus}->{oid} }, instance => $instance); - my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{ $mapping->{bsnMobileStationSsid}->{oid} }, instance => $instance); + my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{ $mapping2->{bsnMobileStationSsid}->{oid} }, instance => $instance); if (defined($self->{option_results}->{filter_ssid}) && $self->{option_results}->{filter_ssid} ne '' && $result2->{bsnMobileStationSsid} !~ /$self->{option_results}->{filter_ssid}/) { $self->{output}->output_add(long_msg => "Skipping '" . $result2->{bsnMobileStationSsid} . "': no matching filter."); next; } $self->{global}->{total}++; - $self->{global}->{$result->{bsnMobileStationStatus}} = 0 if (!defined($self->{global}->{$result->{bsnMobileStationStatus}})); - $self->{global}->{$result->{bsnMobileStationStatus}}++; + $self->{global}->{'total_' . $result->{bsnMobileStationStatus}}++; } } diff --git a/centreon/common/airespace/snmp/mode/components/psu.pm b/centreon/common/airespace/snmp/mode/components/psu.pm index 381178493..81dc4471d 100644 --- a/centreon/common/airespace/snmp/mode/components/psu.pm +++ b/centreon/common/airespace/snmp/mode/components/psu.pm @@ -70,12 +70,12 @@ sub check { $self->{components}->{psu}->{total}++; $self->{output}->output_add(long_msg => sprintf("Power supply '%s' status is %s.", - $$instances[1], $operational)); + $$instances[0], $operational)); my $exit = $self->get_severity(section => 'psu', value => $operational); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("Power supply '%s' status is %s.", - $$instances[1], $operational)); + $$instances[0], $operational)); } } }