Tested!
This commit is contained in:
garnier-quentin 2015-05-07 14:43:45 +02:00
parent 9bade3e68a
commit e60537dd2c
5 changed files with 38 additions and 37 deletions

View File

@ -193,7 +193,7 @@ sub manage_selection {
} }
my $instance_end; my $instance_end;
foreach my $oid2 (keys %{$self->{results}->{$oid_bsnAPIfInterferencePower}}) { 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; $instance_end = $1 . '.' . $2;
if (defined($self->{option_results}->{filter_channel}) && $self->{option_results}->{filter_channel} ne '' && if (defined($self->{option_results}->{filter_channel}) && $self->{option_results}->{filter_channel} ne '' &&

View File

@ -45,7 +45,7 @@ my $maps_counters = {
'000_noise-power' => { class => 'centreon::plugins::values', obj => undef, '000_noise-power' => { class => 'centreon::plugins::values', obj => undef,
set => { set => {
key_values => [ key_values => [
{ name => 'noise_power' } { name => 'noise_power' }, { name => 'label_perfdata' }
], ],
output_template => 'Noise Power : %s dBm', output_template => 'Noise Power : %s dBm',
perfdatas => [ perfdatas => [
@ -179,7 +179,7 @@ sub manage_selection {
} }
my $instance_end; my $instance_end;
foreach my $oid2 (keys %{$self->{results}->{$oid_bsnAPIfDBNoisePower}}) { 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; $instance_end = $1 . '.' . $2;
if (defined($self->{option_results}->{filter_channel}) && $self->{option_results}->{filter_channel} ne '' && if (defined($self->{option_results}->{filter_channel}) && $self->{option_results}->{filter_channel} ne '' &&

View File

@ -262,8 +262,8 @@ sub manage_selection {
$oid =~ /^$mapping->{bsnAPName}->{oid}\.(.*)$/; $oid =~ /^$mapping->{bsnAPName}->{oid}\.(.*)$/;
my $instance = $1; my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{ $mapping->{bsnAPName}->{oid} }, instance => $instance); 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 $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}->{ $mapping->{bsnAPAdminStatus}->{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 '' && if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$result->{bsnAPName} !~ /$self->{option_results}->{filter_name}/) { $result->{bsnAPName} !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "Skipping '" . $result->{bsnAPName} . "': no matching filter."); $self->{output}->output_add(long_msg => "Skipping '" . $result->{bsnAPName} . "': no matching filter.");

View File

@ -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 => { set => {
key_values => [ { name => 'idle' } ], key_values => [ { name => 'total_idle' } ],
output_template => 'Total Idle Users : %s', output_template => 'Total Idle Users : %s',
perfdatas => [ perfdatas => [
{ label => 'total_idle', value => 'idle_absolute', template => '%s', { label => 'total_idle', value => 'total_idle_absolute', template => '%s',
unit => 'users', min => 0 }, unit => 'users', min => 0 },
], ],
} }
}, },
'002_aaapending' => { set => { '002_total-aaapending' => { set => {
key_values => [ { name => 'aaapending' } ], key_values => [ { name => 'total_aaapending' } ],
output_template => 'Total AaaPending Users : %s', output_template => 'Total AaaPending Users : %s',
perfdatas => [ perfdatas => [
{ label => 'total_aaapending', value => 'aaapending_absolute', template => '%s', { label => 'total_aaapending', value => 'total_aaapending_absolute', template => '%s',
unit => 'users', min => 0 }, unit => 'users', min => 0 },
], ],
} }
}, },
'003_authenticated' => { set => { '003_total-authenticated' => { set => {
key_values => [ { name => 'authenticated' } ], key_values => [ { name => 'total_authenticated' } ],
output_template => 'Total Authenticated Users : %s', output_template => 'Total Authenticated Users : %s',
perfdatas => [ perfdatas => [
{ label => 'total_authenticated', value => 'authenticated_absolute', template => '%s', { label => 'total_authenticated', value => 'total_authenticated_absolute', template => '%s',
unit => 'users', min => 0 }, unit => 'users', min => 0 },
], ],
} }
}, },
'004_associated' => { set => { '004_total-associated' => { set => {
key_values => [ { name => 'associated' } ], key_values => [ { name => 'total_associated' } ],
output_template => 'Total Associated Users : %s', output_template => 'Total Associated Users : %s',
perfdatas => [ perfdatas => [
{ label => 'total_associated', value => 'associated_absolute', template => '%s', { label => 'total_associated', value => 'total_associated_absolute', template => '%s',
unit => 'users', min => 0 }, unit => 'users', min => 0 },
], ],
} }
}, },
'005_powersave' => { set => { '005_total-powersave' => { set => {
key_values => [ { name => 'idle' } ], key_values => [ { name => 'total_powersave' } ],
output_template => 'Total Powersave Users : %s', output_template => 'Total Powersave Users : %s',
perfdatas => [ perfdatas => [
{ label => 'total_powersave', value => 'powersave_absolute', template => '%s', { label => 'total_powersave', value => 'total_powersave_absolute', template => '%s',
unit => 'users', min => 0 }, unit => 'users', min => 0 },
], ],
} }
}, },
'006_disassociated' => { set => { '006_total-disassociated' => { set => {
key_values => [ { name => 'disassociated' } ], key_values => [ { name => 'total_disassociated' } ],
output_template => 'Total Disassociated Users : %s', output_template => 'Total Disassociated Users : %s',
perfdatas => [ perfdatas => [
{ label => 'total_disassociated', value => 'disassociated_absolute', template => '%s', { label => 'total_disassociated', value => 'total_disassociated_absolute', template => '%s',
unit => 'users', min => 0 }, unit => 'users', min => 0 },
], ],
} }
}, },
'007_tobedeleted' => { set => { '007_total-tobedeleted' => { set => {
key_values => [ { name => 'tobedeleted' } ], key_values => [ { name => 'total_tobedeleted' } ],
output_template => 'Total ToBeDeleted Users : %s', output_template => 'Total ToBeDeleted Users : %s',
perfdatas => [ perfdatas => [
{ label => 'total_tobedeleted', value => 'tobedeleted_absolute', template => '%s', { label => 'total_tobedeleted', value => 'total_tobedeleted_absolute', template => '%s',
unit => 'users', min => 0 }, unit => 'users', min => 0 },
], ],
} }
}, },
'008_probing' => { set => { '008_total-probing' => { set => {
key_values => [ { name => 'probing' } ], key_values => [ { name => 'total_probing' } ],
output_template => 'Total Probing Users : %s', output_template => 'Total Probing Users : %s',
perfdatas => [ perfdatas => [
{ label => 'total_probing', value => 'probing_absolute', template => '%s', { label => 'total_probing', value => 'total_probing_absolute', template => '%s',
unit => 'users', min => 0 }, unit => 'users', min => 0 },
], ],
} }
}, },
'009_blacklisted' => { set => { '009_total-blacklisted' => { set => {
key_values => [ { name => 'blacklisted' } ], key_values => [ { name => 'blacklisted' } ],
output_template => 'Total Blacklisted Users : %s', output_template => 'Total Blacklisted Users : %s',
perfdatas => [ perfdatas => [
{ label => 'total_blacklisted', value => 'blacklisted_absolute', template => '%s', { label => 'total_blacklisted', value => 'total_blacklisted_absolute', template => '%s',
unit => 'users', min => 0 }, unit => 'users', min => 0 },
], ],
} }
@ -239,7 +239,9 @@ my $mapping2 = {
sub manage_selection { sub manage_selection {
my ($self, %options) = @_; 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} }, $self->{results} = $self->{snmp}->get_multiple_table(oids => [ { oid => $mapping->{bsnMobileStationStatus}->{oid} },
{ oid => $mapping2->{bsnMobileStationSsid}->{oid} }, { oid => $mapping2->{bsnMobileStationSsid}->{oid} },
], ],
@ -248,15 +250,14 @@ sub manage_selection {
$oid =~ /^$mapping->{bsnMobileStationStatus}->{oid}\.(.*)$/; $oid =~ /^$mapping->{bsnMobileStationStatus}->{oid}\.(.*)$/;
my $instance = $1; my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{ $mapping->{bsnMobileStationStatus}->{oid} }, instance => $instance); 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 '' && if (defined($self->{option_results}->{filter_ssid}) && $self->{option_results}->{filter_ssid} ne '' &&
$result2->{bsnMobileStationSsid} !~ /$self->{option_results}->{filter_ssid}/) { $result2->{bsnMobileStationSsid} !~ /$self->{option_results}->{filter_ssid}/) {
$self->{output}->output_add(long_msg => "Skipping '" . $result2->{bsnMobileStationSsid} . "': no matching filter."); $self->{output}->output_add(long_msg => "Skipping '" . $result2->{bsnMobileStationSsid} . "': no matching filter.");
next; next;
} }
$self->{global}->{total}++; $self->{global}->{total}++;
$self->{global}->{$result->{bsnMobileStationStatus}} = 0 if (!defined($self->{global}->{$result->{bsnMobileStationStatus}})); $self->{global}->{'total_' . $result->{bsnMobileStationStatus}}++;
$self->{global}->{$result->{bsnMobileStationStatus}}++;
} }
} }

View File

@ -70,12 +70,12 @@ sub check {
$self->{components}->{psu}->{total}++; $self->{components}->{psu}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Power supply '%s' status is %s.", $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); my $exit = $self->get_severity(section => 'psu', value => $operational);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(severity => $exit,
short_msg => sprintf("Power supply '%s' status is %s.", short_msg => sprintf("Power supply '%s' status is %s.",
$$instances[1], $operational)); $$instances[0], $operational));
} }
} }
} }