This commit is contained in:
garnier-quentin 2020-05-04 15:50:05 +02:00
parent 85965474bf
commit 3736f5b852
4 changed files with 806 additions and 0 deletions

View File

@ -0,0 +1,333 @@
#
# Copyright 2020 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package network::ruckus::zonedirector::snmp::mode::accesspoints;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use Digest::MD5 qw(md5_hex);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold catalog_status_calc);
sub custom_status_output {
my ($self, %options) = @_;
return sprintf('zone directory connection status is %s',
$self->{result_values}->{zd_connection_status}
);
}
sub ap_long_output {
my ($self, %options) = @_;
return "checking access point '" . $options{instance_value}->{display} . "'";
}
sub prefix_ap_output {
my ($self, %options) = @_;
return "access point '" . $options{instance_value}->{display} . "' ";
}
sub custom_usage_output {
my ($self, %options) = @_;
return sprintf(
'ram total: %s %s used: %s %s (%.2f%%) free: %s %s (%.2f%%)',
$self->{perfdata}->change_bytes(value => $self->{result_values}->{total_absolute}),
$self->{perfdata}->change_bytes(value => $self->{result_values}->{used_absolute}),
$self->{result_values}->{prct_used_absolute},
$self->{perfdata}->change_bytes(value => $self->{result_values}->{free_absolute}),
$self->{result_values}->{prct_free_absolute}
);
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'accesspoints', type => 3, cb_prefix_output => 'prefix_ap_output', cb_long_output => 'ap_long_output',
indent_long_output => ' ', message_multiple => 'All access points are ok',
group => [
{ name => 'status', type => 0, skipped_code => { -10 => 1 } },
{ name => 'cpu', type => 0, skipped_code => { -10 => 1 } },
{ name => 'memory', type => 0, skipped_code => { -10 => 1 } },
{ name => 'connection', type => 0, skipped_code => { -10 => 1 } },
{ name => 'traffic', type => 0, skipped_code => { -10 => 1 } }
]
}
];
$self->{maps_counters}->{status} = [
{ label => 'status', threshold => 0, set => {
key_values => [ { name => 'zd_connection_status' }, { name => 'display' } ],
closure_custom_calc => \&catalog_status_calc,
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold
}
}
];
$self->{maps_counters}->{cpu} = [
{ label => 'cpu-utilization', nlabel => 'accesspoint.cpu.utilization.percentage', set => {
key_values => [ { name => 'cpu_util' }, { name => 'display' } ],
output_template => 'cpu usage: %.2f%%',
perfdatas => [
{ value => 'cpu_util_absolute', template => '%.2f', unit => '%',
min => 0, max => 100, label_extra_instance => 1, instance_use => 'display_absolute' }
]
}
}
];
$self->{maps_counters}->{memory} = [
{ label => 'memory-usage', nlabel => 'accesspoint.memory.usage.bytes', set => {
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' }, { name => 'display' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ value => 'used_absolute', template => '%d', min => 0, max => 'total_absolute',
unit => 'B', cast_int => 1, label_extra_instance => 1, instance_use => 'display_absolute' }
]
}
},
{ label => 'usage-free', display_ok => 0, nlabel => 'accesspoint.memory.free.bytes', set => {
key_values => [ { name => 'free' }, { name => 'used' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' }, { name => 'display' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ value => 'free_absolute', template => '%d', min => 0, max => 'total_absolute',
unit => 'B', cast_int => 1, label_extra_instance => 1, instance_use => 'display_absolute' }
]
}
},
{ label => 'usage-prct', display_ok => 0, nlabel => 'accesspoint.memory.usage.percentage', set => {
key_values => [ { name => 'prct_used' }, { name => 'display' } ],
output_template => 'ram used: %.2f %%',
perfdatas => [
{ value => 'prct_used_absolute', template => '%.2f', min => 0, max => 100,
label_extra_instance => 1, instance_use => 'display_absolute' }
]
}
}
];
$self->{maps_counters}->{connection} = [
{ label => 'connection-accesspoints', nlabel => 'accesspoint.connection.accesspoints.count', set => {
key_values => [ { name => 'ap' }, { name => 'display' } ],
output_template => 'access points connections: %d',
perfdatas => [
{ value => 'ap_absolute', template => '%d', min => 0 }
]
}
},
{ label => 'connection-client-devices-authorized', nlabel => 'accesspoint.connection.client.devices.authorized.count', set => {
key_values => [ { name => 'authorized_clients' }, { name => 'display' } ],
output_template => 'client devices authorized connections: %d',
perfdatas => [
{ value => 'authorized_clients_absolute', template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display_absolute' }
]
}
},
{ label => 'connection-rogue-devices', nlabel => 'accesspoint.connection.rogue.devices.count', display_ok => 0, set => {
key_values => [ { name => 'rogues' }, { name => 'display' } ],
output_template => 'rogue devices connections: %d',
perfdatas => [
{ value => 'rogues_absolute', template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display_absolute' }
]
}
}
];
$self->{maps_counters}->{traffic} = [
{ label => 'traffic-in', nlabel => 'accesspoint.traffic.in.bitspersecond', set => {
key_values => [ { name => 'traffic_in', diff => 1 }, { name => 'display' } ],
output_template => 'traffic in: %s%s/s',
per_second => 1, output_change_bytes => 2,
perfdatas => [
{ value => 'traffic_in_per_second', template => '%s',
min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display_absolute' }
]
}
},
{ label => 'traffic-out', nlabel => 'accesspoint.traffic.out.bitspersecond', set => {
key_values => [ { name => 'traffic_out', diff => 1 }, { name => 'display' } ],
output_template => 'traffic in: %s%s/s',
per_second => 1, output_change_bytes => 2,
perfdatas => [
{ value => 'traffic_out_per_second', template => '%s',
min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display_absolute' }
]
}
}
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {
'filter-name:s' => { name => 'filter_name' },
'unknown-status:s' => { name => 'unknown_status', default => '' },
'warning-status:s' => { name => 'warning_status', default => '' },
'critical-status:s' => { name => 'critical_status', default => '' }
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->change_macros(macros => ['unknown_status', 'warning_status', 'critical_status']);
}
my $map_zd_connection_status = {
0 => 'disconnected', 1 => 'connected', 2 => 'approvalPending', 3 => 'upgradingFirmware', 4 => 'provisioning'
};
my $mapping = {
zd_connection_status => { oid => '.1.3.6.1.4.1.25053.1.2.2.1.1.2.1.1.3', map => $map_zd_connection_status }, # ruckusZDWLANAPStatus
cpu_util => { oid => '.1.3.6.1.4.1.25053.1.2.2.1.1.2.1.1.29' }, # ruckusZDWLANAPCPUUtil
memory_used => { oid => '.1.3.6.1.4.1.25053.1.2.2.1.1.2.1.1.27' }, # ruckusZDWLANAPMemUtil (% or KB)
memory_size => { oid => '.1.3.6.1.4.1.25053.1.2.2.1.1.2.1.1.28' }, # ruckusZDWLANAPMemTotal (KB)
ap => { oid => '.1.3.6.1.4.1.25053.1.2.2.1.1.2.1.1.14' }, # ruckusZDWLANAPNumVAP
authorized_clients => { oid => '.1.3.6.1.4.1.25053.1.2.2.1.1.2.1.1.15' }, # ruckusZDWLANAPNumSta
rogues => { oid => '.1.3.6.1.4.1.25053.1.2.2.1.1.2.1.1.16' }, # ruckusZDWLANAPNumRogues
traffic_in => { oid => '.1.3.6.1.4.1.25053.1.2.2.1.1.2.1.1.21' }, # ruckusZDWLANAPLANStatsRXByte
traffic_out => { oid => '.1.3.6.1.4.1.25053.1.2.2.1.1.2.1.1.25' } # ruckusZDWLANAPLANStatsTXByte
};
sub manage_selection {
my ($self, %options) = @_;
my $oid_ruckusZDWLANAPDescription = '.1.3.6.1.4.1.25053.1.2.2.1.1.2.1.1.2';
my $oid_ruckusZDWLANAPSerialNumber = '.1.3.6.1.4.1.25053.1.2.2.1.1.2.1.1.5';
my $snmp_result = $options{snmp}->get_multiple_table(
oids => [
{ oid => $oid_ruckusZDWLANAPDescription },
{ oid => $oid_ruckusZDWLANAPSerialNumber }
],
return_type => 1,
nothing_quit => 1
);
$self->{accesspoints} = {};
foreach (keys %$snmp_result) {
next if (! /^$oid_ruckusZDWLANAPDescription\.(.*)/);
my $instance = $1;
my $name = defined($snmp_result->{$_}) && $snmp_result->{$_} ne '' ?
$snmp_result->{$_} : $snmp_result->{$oid_ruckusZDWLANAPSerialNumber . '.' . $instance};
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$name !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "skipping access point '" . $name . "'.", debug => 1);
next;
}
$self->{accesspoints}->{$instance} = {
display => $name,
status => { display => $name },
cpu => { display => $name },
memory => { display => $name },
connection => { display => $name },
traffic => { display => $name }
};
}
return if (scalar(keys %{$self->{accesspoints}}) <= 0);
$options{snmp}->load(
oids => [ map($_->{oid}, values(%$mapping)) ],
instances => [ keys %{$self->{accesspoints}} ],
instance_regexp => '^(.*)$'
);
$snmp_result = $options{snmp}->get_leef();
foreach (keys %{$self->{accesspoints}}) {
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $_);
$self->{accesspoints}->{$_}->{status}->{zd_connection_status} = $result->{zd_connection_status};
$self->{accesspoints}->{$_}->{cpu}->{cpu_util} = $result->{cpu_util};
my $memory_total = $result->{memory_size} * 1024;
my $memory_used = $result->{memory_used} <= 100 ? ($result->{memory_used} * $memory_total / 100) : $result->{memory_used} * 1024;
my $memory_used_prct = $result->{memory_used} <= 100 ? $result->{memory_used} : ($memory_used * 100 / $memory_total);
$self->{accesspoints}->{$_}->{memory}->{used} = $memory_used;
$self->{accesspoints}->{$_}->{memory}->{free} = $memory_total - $memory_used;
$self->{accesspoints}->{$_}->{memory}->{prct_used} = $memory_used_prct;
$self->{accesspoints}->{$_}->{memory}->{prct_free} = 100 - $memory_used_prct;
$self->{accesspoints}->{$_}->{memory}->{total} = $memory_total;
$self->{accesspoints}->{$_}->{connection}->{ap} = $result->{ap};
$self->{accesspoints}->{$_}->{connection}->{authorized_clients} = $result->{authorized_clients};
$self->{accesspoints}->{$_}->{connection}->{rogues} = $result->{rogues};
$self->{accesspoints}->{$_}->{traffic}->{traffic_in} = $result->{traffic_in} * 8;
$self->{accesspoints}->{$_}->{traffic}->{traffic_out} = $result->{traffic_out} * 8;
}
$self->{cache_name} = 'ruckus_zd_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' .
(defined($self->{option_results}->{filter_counters_block}) ? md5_hex($self->{option_results}->{filter_counters_block}) : md5_hex('all')) . '_' .
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')) . '_' .
(defined($self->{option_results}->{filter_name}) ? md5_hex($self->{option_results}->{filter_name}) : md5_hex('all'))
}
1;
__END__
=head1 MODE
Check access points.
=over 8
=item B<--filter-name>
Filter by access point name (can be a regexp).
=item B<--unknown-status>
Set unknown threshold for status.
Can used special variables like: %{zd_connection_status}
=item B<--warning-status>
Set warning threshold for status.
Can used special variables like: %{zd_connection_status}
=item B<--critical-status>
Set critical threshold for status.
Can used special variables like: %{zd_connection_status}
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'memory-usage', 'usage-free', 'usage-prct', 'traffic-in', 'traffic-out',
'cpu-utilization', 'connection-accesspoints', 'connection-client-devices-authorized',
'connection-rogue-devices'.
=back
=cut

View File

@ -0,0 +1,131 @@
#
# Copyright 2020 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package network::ruckus::zonedirector::snmp::mode::listaccesspoints;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
my $map_zd_connection_status = {
0 => 'disconnected', 1 => 'connected', 2 => 'approvalPending', 3 => 'upgradingFirmware', 4 => 'provisioning'
};
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments => {
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
}
my $mapping = {
description => { oid => '.1.3.6.1.4.1.25053.1.2.2.1.1.2.1.1.2' }, # ruckusZDWLANAPDescription
zd_connection_status => { oid => '.1.3.6.1.4.1.25053.1.2.2.1.1.2.1.1.3', map => $map_zd_connection_status }, # ruckusZDWLANAPStatus
model => { oid => '.1.3.6.1.4.1.25053.1.2.2.1.1.2.1.1.4' }, # ruckusZDWLANAPModel
serial_number => { oid => '.1.3.6.1.4.1.25053.1.2.2.1.1.2.1.1.5' }, # ruckusZDWLANAPSerialNumber
};
my $oid_ruckusZDWLANAPEntry = '.1.3.6.1.4.1.25053.1.2.2.1.1.2.1.1';
sub manage_selection {
my ($self, %options) = @_;
my $snmp_result = $options{snmp}->get_table(
oid => $oid_ruckusZDWLANAPEntry,
start => $mapping->{description}->{oid},
end => $mapping->{serial_number}->{oid},
nothing_quit => 1
);
my $accesspoints = {};
foreach my $oid (keys %$snmp_result) {
next if ($oid !~ /^$mapping->{description}->{oid}\.(.*)$/);
my $instance = $1;
$accesspoints->{$instance} = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
}
return $accesspoints;
}
sub run {
my ($self, %options) = @_;
my $accesspoints = $self->manage_selection(%options);
foreach (sort keys %$accesspoints) {
$self->{output}->output_add(
long_msg => sprintf(
'[description: %s] [serial number: %s] [model: %s] [zonedirector connection status: %s]',
$accesspoints->{$_}->{description},
$accesspoints->{$_}->{serial_number},
$accesspoints->{$_}->{model},
$accesspoints->{$_}->{zd_connection_status}
)
);
}
$self->{output}->output_add(
severity => 'OK',
short_msg => 'List acess points:'
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
sub disco_format {
my ($self, %options) = @_;
$self->{output}->add_disco_format(elements => [keys %$mapping]);
}
sub disco_show {
my ($self, %options) = @_;
my $accesspoints = $self->manage_selection(%options);
foreach (sort keys %$accesspoints) {
$self->{output}->add_disco_entry(
%{$accesspoints->{$_}}
);
}
}
1;
__END__
=head1 MODE
List acess points.
=over 8
=back
=cut

View File

@ -0,0 +1,292 @@
#
# Copyright 2020 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package network::ruckus::zonedirector::snmp::mode::system;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use Digest::MD5 qw(md5_hex);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold catalog_status_calc);
sub custom_status_output {
my ($self, %options) = @_;
return sprintf('system status is %s [peer status: %s]',
$self->{result_values}->{system_status},
$self->{result_values}->{peer_connected_status}
);
}
sub system_long_output {
my ($self, %options) = @_;
return 'checking system ';
}
sub custom_usage_output {
my ($self, %options) = @_;
return sprintf(
'ram total: %s %s used: %s %s (%.2f%%) free: %s %s (%.2f%%)',
$self->{perfdata}->change_bytes(value => $self->{result_values}->{total_absolute}),
$self->{perfdata}->change_bytes(value => $self->{result_values}->{used_absolute}),
$self->{result_values}->{prct_used_absolute},
$self->{perfdata}->change_bytes(value => $self->{result_values}->{free_absolute}),
$self->{result_values}->{prct_free_absolute}
);
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'system', type => 3, cb_long_output => 'system_long_output',
indent_long_output => ' ',
group => [
{ name => 'status', type => 0, skipped_code => { -10 => 1 } },
{ name => 'cpu', type => 0, skipped_code => { -10 => 1 } },
{ name => 'memory', type => 0, skipped_code => { -10 => 1 } },
{ name => 'connection', type => 0, skipped_code => { -10 => 1 } },
{ name => 'traffic', type => 0, skipped_code => { -10 => 1 } }
]
}
];
$self->{maps_counters}->{status} = [
{ label => 'status', threshold => 0, set => {
key_values => [ { name => 'system_status' }, { name => 'peer_connected_status' } ],
closure_custom_calc => \&catalog_status_calc,
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold
}
}
];
$self->{maps_counters}->{cpu} = [
{ label => 'cpu-utilization', nlabel => 'system.cpu.utilization.percentage', set => {
key_values => [ { name => 'cpu_util' } ],
output_template => 'cpu usage: %.2f%%',
perfdatas => [
{ value => 'cpu_util_absolute', template => '%.2f', unit => '%', min => 0, max => 100 }
]
}
}
];
$self->{maps_counters}->{memory} = [
{ label => 'memory-usage', nlabel => 'system.memory.usage.bytes', set => {
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ value => 'used_absolute', template => '%d', min => 0, max => 'total_absolute',
unit => 'B', cast_int => 1 }
]
}
},
{ label => 'usage-free', display_ok => 0, nlabel => 'system.memory.free.bytes', set => {
key_values => [ { name => 'free' }, { name => 'used' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ value => 'free_absolute', template => '%d', min => 0, max => 'total_absolute',
unit => 'B', cast_int => 1 }
]
}
},
{ label => 'usage-prct', display_ok => 0, nlabel => 'system.memory.usage.percentage', set => {
key_values => [ { name => 'prct_used' } ],
output_template => 'ram used: %.2f %%',
perfdatas => [
{ value => 'prct_used_absolute', template => '%.2f', min => 0, max => 100 }
]
}
}
];
$self->{maps_counters}->{connection} = [
{ label => 'connection-accesspoints', nlabel => 'system.connection.accesspoints.count', set => {
key_values => [ { name => 'ap' } ],
output_template => 'access points connections: %d',
perfdatas => [
{ value => 'ap_absolute', template => '%d', min => 0 }
]
}
},
{ label => 'connection-client-devices-authorized', nlabel => 'system.connection.client.devices.authorized.count', set => {
key_values => [ { name => 'authorized_clients' } ],
output_template => 'client devices authorized connections: %d',
perfdatas => [
{ value => 'authorized_clients_absolute', template => '%d', min => 0 }
]
}
},
{ label => 'connection-rogue-devices', nlabel => 'system.connection.rogue.devices.count', display_ok => 0, set => {
key_values => [ { name => 'rogues' } ],
output_template => 'rogue devices connections: %d',
perfdatas => [
{ value => 'rogues_absolute', template => '%d', min => 0 }
]
}
}
];
$self->{maps_counters}->{traffic} = [
{ label => 'traffic-in', nlabel => 'system.traffic.in.bitspersecond', set => {
key_values => [ { name => 'traffic_in', diff => 1 } ],
output_template => 'traffic in: %s%s/s',
per_second => 1, output_change_bytes => 2,
perfdatas => [
{ value => 'traffic_in_per_second', template => '%s',
min => 0, unit => 'b/s' }
]
}
},
{ label => 'traffic-out', nlabel => 'system.traffic.out.bitspersecond', set => {
key_values => [ { name => 'traffic_out', diff => 1 } ],
output_template => 'traffic in: %s%s/s',
per_second => 1, output_change_bytes => 2,
perfdatas => [
{ value => 'traffic_out_per_second', template => '%s',
min => 0, unit => 'b/s' }
]
}
}
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {
'unknown-status:s' => { name => 'unknown_status', default => '' },
'warning-status:s' => { name => 'warning_status', default => '' },
'critical-status:s' => { name => 'critical_status', default => '' }
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->change_macros(macros => ['unknown_status', 'warning_status', 'critical_status']);
}
my $map_system_status = {
1 => 'master', 2 => 'standby', 3 => 'noredundancy'
};
my $map_peer_connected_status = {
1 => 'connected', 2 => 'disconnected'
};
my $mapping = {
system_status => { oid => '.1.3.6.1.4.1.25053.1.2.1.1.1.1.30', map => $map_system_status }, # ruckusZDSystemStatus
peer_connected_status => { oid => '.1.3.6.1.4.1.25053.1.2.1.1.1.1.31', map => $map_peer_connected_status }, # ruckusZDSystemPeerConnectedStatus
cpu_util => { oid => '.1.3.6.1.4.1.25053.1.2.1.1.1.5.58' }, # ruckusZDSystemCPUUtil
memory_used_prct => { oid => '.1.3.6.1.4.1.25053.1.2.1.1.1.5.59' }, # ruckusZDSystemMemoryUtil (%)
memory_size => { oid => '.1.3.6.1.4.1.25053.1.2.1.1.1.5.60' }, # ruckusZDSystemMemorySize (MB)
ap => { oid => '.1.3.6.1.4.1.25053.1.2.1.1.1.15.1' }, # ruckusZDSystemStatsNumAP
authorized_clients => { oid => '.1.3.6.1.4.1.25053.1.2.1.1.1.15.2' }, # ruckusZDSystemStatsNumSta
rogues => { oid => '.1.3.6.1.4.1.25053.1.2.1.1.1.15.3' }, # ruckusZDSystemStatsNumRogue
traffic_in => { oid => '.1.3.6.1.4.1.25053.1.2.1.1.1.15.6' }, # ruckusZDSystemStatsWLANTotalRxBytes
traffic_out => { oid => '.1.3.6.1.4.1.25053.1.2.1.1.1.15.9' } # ruckusZDSystemStatsWLANTotalTxBytes
};
sub manage_selection {
my ($self, %options) = @_;
my $snmp_result = $options{snmp}->get_leef(
oids => [ map($_->{oid} . '.0', values(%$mapping)) ],
nothing_quit => 1
);
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => 0);
my $memory_total = $result->{memory_size} * 1024 * 1024;
my $memory_used = $result->{memory_used_prct} * $memory_total / 100;
$self->{system}->{global} = {
status => {
system_status => $result->{system_status},
peer_connected_status => $result->{peer_connected_status}
},
cpu => { cpu_util => $result->{cpu_util} },
memory => {
used => $memory_used,
free => $memory_total - $memory_used,
prct_used => $result->{memory_used_prct},
prct_free => 100 - $result->{memory_used_prct},
total => $memory_total
},
connection => {
ap => $result->{ap},
authorized_clients => $result->{authorized_clients},
rogues => $result->{rogues}
},
traffic => {
traffic_in => $result->{traffic_in} * 8,
traffic_out => $result->{traffic_out} * 8
}
};
$self->{cache_name} = 'ruckus_zd_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' .
(defined($self->{option_results}->{filter_counters_block}) ? md5_hex($self->{option_results}->{filter_counters_block}) : md5_hex('all')) . '_' .
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
}
1;
__END__
=head1 MODE
Check system.
=over 8
=item B<--unknown-status>
Set unknown threshold for status (Default: '').
Can used special variables like: %{system_status}, %{peer_connected_status}
=item B<--warning-status>
Set warning threshold for status (Default: '').
Can used special variables like: %{system_status}, %{peer_connected_status}
=item B<--critical-status>
Set critical threshold for status.
Can used special variables like: %{system_status}, %{peer_connected_status}
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'memory-usage', 'usage-free', 'usage-prct', 'traffic-in', 'traffic-out',
'cpu-utilization', 'connection-accesspoints', 'connection-client-devices-authorized',
'connection-rogue-devices'.
=back
=cut

View File

@ -0,0 +1,50 @@
#
# Copyright 2020 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package network::ruckus::zonedirector::snmp::plugin;
use strict;
use warnings;
use base qw(centreon::plugins::script_snmp);
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '0.5';
%{$self->{modes}} = (
'access-points' => 'network::ruckus::zonedirector::snmp::mode::accesspoints',
'list-access-points' => 'network::ruckus::zonedirector::snmp::mode::listaccesspoints',
'system' => 'network::ruckus::zonedirector::snmp::mode::system'
);
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check Ruckus ZoneDirector in SNMP.
=cut