+ Fix #227
This commit is contained in:
parent
8f35022f03
commit
ccc1fd22d4
|
@ -30,6 +30,7 @@ sub set_counters {
|
|||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0 },
|
||||
{ name => 'ssid', type => 1, cb_prefix_output => 'prefix_ssid_output', message_multiple => 'All users by SSID are ok' }
|
||||
];
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'total', set => {
|
||||
|
@ -123,6 +124,24 @@ sub set_counters {
|
|||
}
|
||||
},
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{ssid} = [
|
||||
{ label => 'ssid', set => {
|
||||
key_values => [ { name => 'total' }, { name => 'display' } ],
|
||||
output_template => 'users : %s',
|
||||
perfdatas => [
|
||||
{ label => 'ssid', value => 'total_absolute', template => '%s',
|
||||
unit => 'users', min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_ssid_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "SSID '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
|
@ -156,8 +175,12 @@ my $mapping = {
|
|||
my $mapping2 = {
|
||||
bsnMobileStationSsid => { oid => '.1.3.6.1.4.1.14179.2.1.4.1.7' },
|
||||
};
|
||||
my $mapping3 = {
|
||||
bsnDot11EssNumberOfMobileStations => { oid => '.1.3.6.1.4.1.14179.2.1.1.1.38' },
|
||||
};
|
||||
|
||||
my $oid_agentInventoryMachineModel = '.1.3.6.1.4.1.14179.1.1.1.3';
|
||||
my $oid_bsnDot11EssSsid = '.1.3.6.1.4.1.14179.2.1.1.1.2';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -168,6 +191,8 @@ sub manage_selection {
|
|||
$self->{results} = $options{snmp}->get_multiple_table(oids => [ { oid => $oid_agentInventoryMachineModel },
|
||||
{ oid => $mapping->{bsnMobileStationStatus}->{oid} },
|
||||
{ oid => $mapping2->{bsnMobileStationSsid}->{oid} },
|
||||
{ oid => $oid_bsnDot11EssSsid },
|
||||
{ oid => $mapping3->{bsnDot11EssNumberOfMobileStations}->{oid} },
|
||||
],
|
||||
nothing_quit => 1);
|
||||
$self->{output}->output_add(long_msg => "Model: " . $self->{results}->{$oid_agentInventoryMachineModel}->{$oid_agentInventoryMachineModel . '.0'});
|
||||
|
@ -178,12 +203,29 @@ sub manage_selection {
|
|||
my $result2 = $options{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.");
|
||||
$self->{output}->output_add(long_msg => "Skipping '" . $result2->{bsnMobileStationSsid} . "': no matching filter.", debug => 1);
|
||||
next;
|
||||
}
|
||||
$self->{global}->{total}++;
|
||||
$self->{global}->{'total_' . $result->{bsnMobileStationStatus}}++;
|
||||
}
|
||||
|
||||
# check by ssid
|
||||
$self->{ssid} = {};
|
||||
foreach my $oid (keys %{$self->{results}->{ $oid_bsnDot11EssSsid }}) {
|
||||
$oid =~ /^$oid_bsnDot11EssSsid\.(.*)$/;
|
||||
my $instance = $1;
|
||||
my $ssid_name = $self->{results}->{ $oid_bsnDot11EssSsid }->{$oid};
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{ $mapping3->{bsnDot11EssNumberOfMobileStations}->{oid} }, instance => $instance);
|
||||
if (defined($self->{option_results}->{filter_ssid}) && $self->{option_results}->{filter_ssid} ne '' &&
|
||||
$ssid_name !~ /$self->{option_results}->{filter_ssid}/) {
|
||||
$self->{output}->output_add(long_msg => "Skipping '" . $ssid_name . "': no matching filter.", debug => 1);
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{ssid}->{$ssid_name} = { display => $ssid_name, total => 0 } if (!defined($self->{ssid}->{$ssid_name}));
|
||||
$self->{ssid}->{$ssid_name}->{total} += $result->{bsnDot11EssNumberOfMobileStations};
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -206,14 +248,14 @@ Example: --filter-counters='^total|total-idle$'
|
|||
Threshold warning.
|
||||
Can be: 'total', 'total-idle', 'total-aaapending', 'total-authenticated',
|
||||
'total-associated', 'total-powersave', 'total-disassociated', 'total-tobedeleted',
|
||||
'total-probing', 'total-blacklisted'.
|
||||
'total-probing', 'total-blacklisted', 'ssid'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Threshold critical.
|
||||
Can be: 'total', 'total-idle', 'total-aaapending', 'total-authenticated',
|
||||
'total-associated', 'total-powersave', 'total-disassociated', 'total-tobedeleted',
|
||||
'total-probing', 'total-blacklisted'.
|
||||
'total-probing', 'total-blacklisted', 'ssid'.
|
||||
|
||||
=item B<--filter-ssid>
|
||||
|
||||
|
|
Loading…
Reference in New Issue