Merge pull request #295 from Sims24/trapeze-network
Add plugin for Juniper/Trapeze WLC
This commit is contained in:
commit
a37549ca1d
|
@ -0,0 +1,235 @@
|
||||||
|
#
|
||||||
|
# Copyright 2015 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::juniper::trapeze::snmp::mode::apstatus;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $instance_mode;
|
||||||
|
|
||||||
|
sub custom_threshold_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
my $status = 'ok';
|
||||||
|
my $message;
|
||||||
|
|
||||||
|
eval {
|
||||||
|
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||||
|
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||||
|
|
||||||
|
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||||
|
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||||
|
$status = 'critical';
|
||||||
|
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||||
|
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||||
|
$status = 'warning';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (defined($message)) {
|
||||||
|
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub custom_status_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
my $msg;
|
||||||
|
|
||||||
|
if ($self->{result_values}->{opstatus} eq 'disabled') {
|
||||||
|
$msg = ' is disabled';
|
||||||
|
} else {
|
||||||
|
$msg = 'Status : ' . $self->{result_values}->{opstatus};
|
||||||
|
}
|
||||||
|
return $msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub custom_status_calc {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{result_values}->{opstatus} = $options{new_datas}->{$self->{instance} . '_opstatus'};
|
||||||
|
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub set_counters {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{maps_counters_type} = [
|
||||||
|
{ name => 'global', type => 0, cb_init => 'skip_global', },
|
||||||
|
{ name => 'ap', type => 1, cb_prefix_output => 'prefix_ap_output', message_multiple => 'All AP status are ok' }
|
||||||
|
];
|
||||||
|
$self->{maps_counters}->{global} = [
|
||||||
|
{ label => 'total', set => {
|
||||||
|
key_values => [ { name => 'total' } ],
|
||||||
|
output_template => 'Total ap : %s',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'total', value => 'total_absolute', template => '%s',
|
||||||
|
min => 0 },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
];
|
||||||
|
$self->{maps_counters}->{ap} = [
|
||||||
|
{ label => 'status', threshold => 0, set => {
|
||||||
|
key_values => [ { name => 'opstatus' }, { name => 'display' } ],
|
||||||
|
closure_custom_calc => $self->can('custom_status_calc'),
|
||||||
|
closure_custom_output => $self->can('custom_status_output'),
|
||||||
|
closure_custom_perfdata => sub { return 0; },
|
||||||
|
closure_custom_threshold_check => $self->can('custom_threshold_output'),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
sub new {
|
||||||
|
my ($class, %options) = @_;
|
||||||
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
|
bless $self, $class;
|
||||||
|
|
||||||
|
$self->{version} = '1.0';
|
||||||
|
$options{options}->add_options(arguments =>
|
||||||
|
{
|
||||||
|
"filter-name:s" => { name => 'filter_name' },
|
||||||
|
"warning-status:s" => { name => 'warning_status', default => '' },
|
||||||
|
"critical-status:s" => { name => 'critical_status', default => '%{opstatus} !~ /init|redundant|operationnal/' },
|
||||||
|
});
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_options {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
$self->SUPER::init(%options);
|
||||||
|
|
||||||
|
$instance_mode = $self;
|
||||||
|
$self->change_macros();
|
||||||
|
}
|
||||||
|
|
||||||
|
sub skip_global {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
scalar(keys %{$self->{ap}}) > 1 ? return(0) : return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub prefix_ap_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "AP '" . $options{instance_value}->{display} . "' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub change_macros {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
foreach (('warning_status', 'critical_status')) {
|
||||||
|
if (defined($self->{option_results}->{$_})) {
|
||||||
|
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my %map_ap_status = (
|
||||||
|
1 => 'cleared',
|
||||||
|
2 => 'init',
|
||||||
|
3 => 'bootStarted',
|
||||||
|
4 => 'imageDownloaded',
|
||||||
|
5 => 'connectFailed',
|
||||||
|
6 => 'configuring',
|
||||||
|
7 => 'operationnal',
|
||||||
|
10 => 'redundant',
|
||||||
|
20 => 'connOutage',
|
||||||
|
);
|
||||||
|
|
||||||
|
my $mapping_name_oid = {
|
||||||
|
trpzApStatApStatusApName => { oid => '.1.3.6.1.4.1.14525.4.5.1.1.2.1.8' },
|
||||||
|
};
|
||||||
|
my $mapping_state_oid = {
|
||||||
|
trpzApStatApStatusApState => { oid => '.1.3.6.1.4.1.14525.4.5.1.1.2.1.5', map => \%map_ap_status },
|
||||||
|
};
|
||||||
|
|
||||||
|
sub manage_selection {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{ap} = {};
|
||||||
|
$self->{global} = { total => 0};
|
||||||
|
$self->{results} = $options{snmp}->get_multiple_table(oids => [{ oid => $mapping_name_oid->{trpzApStatApStatusApName}->{oid} },
|
||||||
|
{ oid => $mapping_state_oid->{trpzApStatApStatusApState}->{oid} },
|
||||||
|
],
|
||||||
|
nothing_quit => 1);
|
||||||
|
|
||||||
|
foreach my $oid (keys %{$self->{results}->{ $mapping_name_oid->{trpzApStatApStatusApName}->{oid} }}) {
|
||||||
|
$oid =~ /^$mapping_name_oid->{trpzApStatApStatusApName}->{oid}\.(.*)$/;
|
||||||
|
my $instance = $1;
|
||||||
|
my $result = $options{snmp}->map_instance(mapping => $mapping_name_oid, results => $self->{results}->{ $mapping_name_oid->{trpzApStatApStatusApName}->{oid} }, instance => $instance);
|
||||||
|
my $result2 = $options{snmp}->map_instance(mapping => $mapping_state_oid, results => $self->{results}->{ $mapping_state_oid->{trpzApStatApStatusApState}->{oid} }, instance => $instance);
|
||||||
|
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
|
||||||
|
$result->{trpzApStatApStatusApName} !~ /$self->{option_results}->{filter_name}/) {
|
||||||
|
$self->{output}->output_add(long_msg => "Skipping '" . $result->{trpzApStatApStatusApName} . "': no matching filter.", debug => 1);
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{global}->{total}++;
|
||||||
|
$self->{ap}->{$instance} = { display => $result->{trpzApStatApStatusApName},
|
||||||
|
opstatus => $result2->{trpzApStatApStatusApState}};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scalar(keys %{$self->{ap}}) <= 0) {
|
||||||
|
$self->{output}->output_add(severity => 'OK',
|
||||||
|
short_msg => 'No AP associated, check your filter ? ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 MODE
|
||||||
|
|
||||||
|
Check AP status.
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=item B<--filter-name>
|
||||||
|
|
||||||
|
Filter AP name (can be a regexp).
|
||||||
|
|
||||||
|
=item B<--warning-status>
|
||||||
|
|
||||||
|
Set warning threshold for status.
|
||||||
|
Can used special variables like: %{opstatus}, %{display}
|
||||||
|
|
||||||
|
=item B<--critical-status>
|
||||||
|
|
||||||
|
Set critical threshold for status (Default: '%{opstatus} !~ /init|redundant|operationnal/').
|
||||||
|
Can used special variables like: %{opstatus}, %{display}
|
||||||
|
|
||||||
|
=item B<--warning-total>
|
||||||
|
|
||||||
|
Set warning threshold for number of AP linked to the WLC
|
||||||
|
|
||||||
|
=item B<--critical-total>
|
||||||
|
|
||||||
|
Set critical threshold for number of AP linked to the WLC
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
|
@ -0,0 +1,191 @@
|
||||||
|
#
|
||||||
|
# Copyright 2015 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::juniper::trapeze::snmp::mode::apusers;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
sub set_counters {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$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' },
|
||||||
|
{ name => 'ap', type => 1, cb_prefix_output => 'prefix_ap_output', message_multiple => 'All users by AP are ok' },
|
||||||
|
];
|
||||||
|
|
||||||
|
$self->{maps_counters}->{global} = [
|
||||||
|
{ label => 'total', set => {
|
||||||
|
key_values => [ { name => 'total' } ],
|
||||||
|
output_template => 'Total Users : %s',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'total', value => 'total_absolute', template => '%s',
|
||||||
|
unit => 'users', min => 0 },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
$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' },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
$self->{maps_counters}->{ap} = [
|
||||||
|
{ label => 'ap', set => {
|
||||||
|
key_values => [ { name => 'total' }, { name => 'display' } ],
|
||||||
|
output_template => 'users : %s',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'ap', value => 'total_absolute', template => '%s',
|
||||||
|
unit => 'users', min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sub new {
|
||||||
|
my ($class, %options) = @_;
|
||||||
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
|
bless $self, $class;
|
||||||
|
|
||||||
|
$self->{version} = '1.0';
|
||||||
|
$options{options}->add_options(arguments =>
|
||||||
|
{
|
||||||
|
"filter-ssid:s" => { name => 'filter_ssid' },
|
||||||
|
"filter-ap:s" => { name => 'filter_ap' },
|
||||||
|
});
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub prefix_ssid_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "SSID '" . $options{instance_value}->{display} . "' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub prefix_ap_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "AP '" . $options{instance_value}->{display} . "' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
my $mapping = {
|
||||||
|
trpzClSessClientSessApSerialNum => { oid => '.1.3.6.1.4.1.14525.4.4.1.1.1.1.7' },
|
||||||
|
};
|
||||||
|
|
||||||
|
my $mapping1 = {
|
||||||
|
trpzClSessClientSessSsid => { oid => '.1.3.6.1.4.1.14525.4.4.1.1.1.1.15' },
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub manage_selection {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my $oid_trpzApStatApStatusApName = '.1.3.6.1.4.1.14525.4.5.1.1.2.1.8';
|
||||||
|
$self->{global} = { total => 0};
|
||||||
|
$self->{ssid} = {};
|
||||||
|
$self->{ap} = {};
|
||||||
|
|
||||||
|
$self->{results} = $options{snmp}->get_multiple_table(oids => [{ oid => $oid_trpzApStatApStatusApName }, { oid => $mapping->{trpzClSessClientSessApSerialNum}->{oid} },
|
||||||
|
{ oid => $mapping1->{trpzClSessClientSessSsid}->{oid} }],
|
||||||
|
nothing_quit => 1);
|
||||||
|
|
||||||
|
foreach my $oid (keys %{$self->{results}->{ $mapping->{trpzClSessClientSessApSerialNum}->{oid} }}) {
|
||||||
|
$oid =~ /^$mapping->{trpzClSessClientSessApSerialNum}->{oid}\.(.*)$/;
|
||||||
|
my $instance = $1;
|
||||||
|
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{ $mapping->{trpzClSessClientSessApSerialNum}->{oid} }, instance => $instance);
|
||||||
|
my $result1 = $options{snmp}->map_instance(mapping => $mapping1, results => $self->{results}->{ $mapping1->{trpzClSessClientSessSsid}->{oid} }, instance => $instance);
|
||||||
|
my @chars = split(//,$result->{trpzClSessClientSessApSerialNum});
|
||||||
|
my $ap_oid = '12';
|
||||||
|
foreach my $char (@chars) {
|
||||||
|
$ap_oid .= '.'.ord($char);
|
||||||
|
}
|
||||||
|
my $ap_name = $self->{results}->{$oid_trpzApStatApStatusApName}->{$oid_trpzApStatApStatusApName . '.' . $ap_oid};
|
||||||
|
if (defined($self->{option_results}->{filter_ap}) && $self->{option_results}->{filter_ap} ne '' &&
|
||||||
|
$ap_name !~ /$self->{option_results}->{filter_ap}/) {
|
||||||
|
$self->{output}->output_add(long_msg => "Skipping '" . $ap_name . "': no matching filter.", debug => 1);
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
if (defined($self->{option_results}->{filter_ssid}) && $self->{option_results}->{filter_ssid} ne '' &&
|
||||||
|
$result1->{trpzClSessClientSessSsid} !~ /$self->{option_results}->{filter_ssid}/) {
|
||||||
|
$self->{output}->output_add(long_msg => "Skipping '" . $result1->{trpzClSessClientSessSsid} . "': no matching filter.", debug => 1);
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{global}->{total}++;
|
||||||
|
$self->{ap}->{$ap_name} = { total => 0, display => $ap_name } if (!defined($self->{ap}->{$ap_name}));
|
||||||
|
$self->{ap}->{$ap_name}->{total}++;
|
||||||
|
$self->{ssid}->{$result1->{trpzClSessClientSessSsid}} = { total => 0, display => $result1->{trpzClSessClientSessSsid} } if (!defined($self->{ssid}->{$result1->{trpzClSessClientSessSsid}}));
|
||||||
|
$self->{ssid}->{$result1->{trpzClSessClientSessSsid}}->{total}++
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scalar(keys %{$self->{ap}}) <= 0 && scalar(keys %{$self->{ssid}}) <= 0) {
|
||||||
|
$self->{output}->output_add(severity => 'OK',
|
||||||
|
short_msg => 'No AP nor SSID finded, check your filter or maybe we are on a slave controller ? ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 MODE
|
||||||
|
|
||||||
|
Check AP status.
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=item B<--filter-counters>
|
||||||
|
|
||||||
|
Only display some counters (regexp can be used).
|
||||||
|
|
||||||
|
=item B<--filter-ap>
|
||||||
|
|
||||||
|
Filter AP name (can be a regexp).
|
||||||
|
|
||||||
|
=item B<--filter-ssid>
|
||||||
|
|
||||||
|
Filter SSID name (can be a regexp).
|
||||||
|
|
||||||
|
=item B<--warning-*>
|
||||||
|
|
||||||
|
Set warning threshold for number of user. Can be : 'total', 'ssid', 'ap' .
|
||||||
|
|
||||||
|
=item B<--critical-*>
|
||||||
|
|
||||||
|
Set critical threshold for number of user. Can be : 'total', 'ssid', 'ap' .
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
|
@ -0,0 +1,141 @@
|
||||||
|
#
|
||||||
|
# Copyright 2015 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::juniper::trapeze::snmp::mode::cpu;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
sub set_counters {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{maps_counters_type} = [
|
||||||
|
{ name => 'cpu', type => 0, cb_prefix_output => 'prefix_cpu_output' }
|
||||||
|
];
|
||||||
|
|
||||||
|
$self->{maps_counters}->{cpu} = [
|
||||||
|
{ label => 'average', set => {
|
||||||
|
key_values => [ { name => 'trpzSysCpuAverageLoad' } ],
|
||||||
|
output_template => 'average : %.2f %%',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'cpu_average', value => 'trpzSysCpuAverageLoad_absolute', template => '%.2f',
|
||||||
|
min => 0, max => 100, unit => '%' },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label => '1m', set => {
|
||||||
|
key_values => [ { name => 'trpzSysCpuLastMinuteLoad' } ],
|
||||||
|
output_template => '1 minute : %.2f %%',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'cpu_1m', value => 'trpzSysCpuLastMinuteLoad_absolute', template => '%.2f',
|
||||||
|
min => 0, max => 100, unit => '%' },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label => '5m', set => {
|
||||||
|
key_values => [ { name => 'trpzSysCpuLast5MinutesLoad' } ],
|
||||||
|
output_template => '5 minutes : %.2f %%',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'cpu_5m', value => 'trpzSysCpuLast5MinutesLoad_absolute', template => '%.2f',
|
||||||
|
min => 0, max => 100, unit => '%' },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label => '1h', set => {
|
||||||
|
key_values => [ { name => ' trpzSysCpuLastHourLoad' } ],
|
||||||
|
output_template => '1 hour : %.2f %%',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'cpu_1h', value => ' trpzSysCpuLastHourLoad_absolute', template => '%.2f',
|
||||||
|
min => 0, max => 100, unit => '%' },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
sub prefix_cpu_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "CPU Usage ";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub new {
|
||||||
|
my ($class, %options) = @_;
|
||||||
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
|
bless $self, $class;
|
||||||
|
|
||||||
|
$self->{version} = '1.0';
|
||||||
|
$options{options}->add_options(arguments =>
|
||||||
|
{
|
||||||
|
});
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub manage_selection {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
# TRAPEZE-NETWORKS-SYSTEM-MIB
|
||||||
|
my $oid_trpzSysCpuAverageLoad = '.1.3.6.1.4.1.14525.4.8.1.1.5.0';
|
||||||
|
my $oid_trpzSysCpuLastMinuteLoad = '.1.3.6.1.4.1.14525.4.8.1.1.11.2.0';
|
||||||
|
my $oid_trpzSysCpuLast5MinutesLoad = '.1.3.6.1.4.1.14525.4.8.1.1.11.3.0';
|
||||||
|
my $oid_trpzSysCpuLastHourLoad = '.1.3.6.1.4.1.14525.4.8.1.1.11.4.0';
|
||||||
|
|
||||||
|
my $results = $options{snmp}->get_leef(oids => [$oid_trpzSysCpuAverageLoad, $oid_trpzSysCpuLastMinuteLoad,
|
||||||
|
$oid_trpzSysCpuLast5MinutesLoad, $oid_trpzSysCpuLastHourLoad ],
|
||||||
|
nothing_quit => 1);
|
||||||
|
|
||||||
|
$self->{cpu} = { trpzSysCpuAverageLoad => $results->{$oid_trpzSysCpuAverageLoad},
|
||||||
|
trpzSysCpuLastMinuteLoad => $results->{$oid_trpzSysCpuLastMinuteLoad},
|
||||||
|
trpzSysCpuLast5MinutesLoad => $results->{$oid_trpzSysCpuLast5MinutesLoad},
|
||||||
|
trpzSysCpuLastHourLoad => $results->{$oid_trpzSysCpuLastHourLoad},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 MODE
|
||||||
|
|
||||||
|
Check CPU usage
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=item B<--filter-counters>
|
||||||
|
|
||||||
|
Only display some counters (regexp can be used).
|
||||||
|
Example: --filter-counters='^(1m|5m)$'
|
||||||
|
|
||||||
|
=item B<--warning-*>
|
||||||
|
|
||||||
|
Threshold warning.
|
||||||
|
Can be: '1m', '5m', '1h, 'average'
|
||||||
|
|
||||||
|
=item B<--critical-*>
|
||||||
|
|
||||||
|
Threshold critical.
|
||||||
|
Can be: '1m', '5m', '1h', 'average'
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
|
@ -0,0 +1,176 @@
|
||||||
|
#
|
||||||
|
# Copyright 2015 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::juniper::trapeze::snmp::mode::memory;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
sub custom_usage_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total_absolute});
|
||||||
|
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used_absolute});
|
||||||
|
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free_absolute});
|
||||||
|
|
||||||
|
my $msg = sprintf("Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)",
|
||||||
|
$total_size_value . " " . $total_size_unit,
|
||||||
|
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used_absolute},
|
||||||
|
$total_free_value . " " . $total_free_unit, 100 - $self->{result_values}->{prct_used_absolute});
|
||||||
|
return $msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub set_counters {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{maps_counters_type} = [
|
||||||
|
{ name => 'memory', type => 0, cb_prefix_output => 'prefix_memory_output' },
|
||||||
|
{ name => 'flash', type => 0, cb_prefix_output => 'prefix_flash_output' }
|
||||||
|
];
|
||||||
|
|
||||||
|
$self->{maps_counters}->{memory} = [
|
||||||
|
{ label => 'memory', set => {
|
||||||
|
key_values => [ { name => 'prct_used'}, { name => 'used' }, { name => 'free' }, { name => 'total' } ],
|
||||||
|
closure_custom_output => $self->can('custom_usage_output'),
|
||||||
|
threshold_use => 'prct_used_absolute',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'memory', value => 'used_absolute', template => '%.2f', threshold_total => 'total_absolute', cast_int => 1,
|
||||||
|
min => 0, max => 'total_absolute', unit => 'B' },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
];
|
||||||
|
$self->{maps_counters}->{flash} = [
|
||||||
|
{ label => 'flash', set => {
|
||||||
|
key_values => [ { name => 'prct_used' }, { name => 'used' }, { name => 'free' }, { name => 'total' } ],
|
||||||
|
closure_custom_output => $self->can('custom_usage_output'),
|
||||||
|
threshold_use => 'prct_used_absolute',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'flash', value => 'used_absolute', template => '%.2f', threshold_total => 'total_absolute', cast_int => 1,
|
||||||
|
min => 0, max => 'total_absolute', unit => 'B' },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
sub prefix_memory_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "Memory ";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub prefix_flash_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "Flash ";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub new {
|
||||||
|
my ($class, %options) = @_;
|
||||||
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
|
bless $self, $class;
|
||||||
|
|
||||||
|
$self->{version} = '1.0';
|
||||||
|
$options{options}->add_options(arguments =>
|
||||||
|
{
|
||||||
|
});
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub manage_selection {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my $total_bytes;
|
||||||
|
my $used_bytes;
|
||||||
|
my $free_bytes;
|
||||||
|
|
||||||
|
# TRAPEZE-NETWORKS-SYSTEM-MIB
|
||||||
|
my $oid_trpzSysFlashMemoryUsedBytes = '.1.3.6.1.4.1.14525.4.8.1.1.3.0';
|
||||||
|
my $oid_trpzSysFlashMemoryTotalBytes = '.1.3.6.1.4.1.14525.4.8.1.1.4.0';
|
||||||
|
my $oid_trpzSysCpuMemoryInstantUsage = '.1.3.6.1.4.1.14525.4.8.1.1.12.1.0';
|
||||||
|
my $oid_trpzSysCpuMemoryUsedBytes = '.1.3.6.1.4.1.14525.4.8.1.1.1.0';
|
||||||
|
my $oid_trpzSysCpuMemoryTotalBytes = '.1.3.6.1.4.1.14525.4.8.1.1.2.0';
|
||||||
|
my $oid_trpzSysCpuMemorySize = '.1.3.6.1.4.1.14525.4.8.1.1.6.0';
|
||||||
|
|
||||||
|
my $results = $options{snmp}->get_leef(oids => [$oid_trpzSysFlashMemoryUsedBytes, $oid_trpzSysFlashMemoryTotalBytes, $oid_trpzSysCpuMemoryUsedBytes,
|
||||||
|
$oid_trpzSysCpuMemoryInstantUsage, $oid_trpzSysCpuMemorySize, $oid_trpzSysCpuMemoryTotalBytes ],
|
||||||
|
nothing_quit => 1);
|
||||||
|
|
||||||
|
if (defined($results->{$oid_trpzSysCpuMemorySize}) || $results->{$oid_trpzSysCpuMemorySize} != 0) {
|
||||||
|
$total_bytes = $results->{$oid_trpzSysCpuMemorySize} * 1024;
|
||||||
|
$used_bytes = $results->{$oid_trpzSysCpuMemoryInstantUsage} * 1024;
|
||||||
|
$free_bytes = $total_bytes - $used_bytes;
|
||||||
|
} else {
|
||||||
|
$total_bytes = $results->{$oid_trpzSysCpuMemoryTotalBytes};
|
||||||
|
$used_bytes = $results->{$oid_trpzSysCpuMemoryUsedBytes};
|
||||||
|
$free_bytes = $total_bytes - $used_bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $free_bytes_flash = $results->{$oid_trpzSysFlashMemoryTotalBytes} - $results->{$oid_trpzSysFlashMemoryUsedBytes};
|
||||||
|
|
||||||
|
$self->{memory} = {display => 'memory',
|
||||||
|
prct_used => $used_bytes * 100 / $total_bytes,
|
||||||
|
used => $used_bytes,
|
||||||
|
free => $free_bytes,
|
||||||
|
total => $total_bytes,
|
||||||
|
};
|
||||||
|
|
||||||
|
$self->{flash} = {display => 'flash',
|
||||||
|
prct_used => $results->{$oid_trpzSysFlashMemoryUsedBytes} * 100 / $results->{$oid_trpzSysFlashMemoryTotalBytes},
|
||||||
|
used => $results->{$oid_trpzSysFlashMemoryUsedBytes},
|
||||||
|
free => $free_bytes_flash,
|
||||||
|
total => $results->{$oid_trpzSysFlashMemoryTotalBytes},
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 MODE
|
||||||
|
|
||||||
|
Check memory usage
|
||||||
|
|
||||||
|
=over 8
|
||||||
|
|
||||||
|
=item B<--filter-counters>
|
||||||
|
|
||||||
|
Only display some counters (regexp can be used).
|
||||||
|
Example: --filter-counters='^(1m|5m)$'
|
||||||
|
|
||||||
|
=item B<--warning-*>
|
||||||
|
|
||||||
|
Threshold warning.
|
||||||
|
Can be: 'memory', 'flash'
|
||||||
|
|
||||||
|
=item B<--critical-*>
|
||||||
|
|
||||||
|
Threshold critical.
|
||||||
|
Can be: 'memory', 'flash'
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
|
@ -0,0 +1,52 @@
|
||||||
|
#
|
||||||
|
# Copyright 2015 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::juniper::trapeze::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;
|
||||||
|
# $options->{options} = options object
|
||||||
|
|
||||||
|
$self->{version} = '0.1';
|
||||||
|
%{$self->{modes}} = (
|
||||||
|
'cpu' => 'network::juniper::trapeze::snmp::mode::cpu',
|
||||||
|
'memory' => 'network::juniper::trapeze::snmp::mode::memory',
|
||||||
|
'ap-status' => 'network::juniper::trapeze::snmp::mode::apstatus',
|
||||||
|
'ap-users' => 'network::juniper::trapeze::snmp::mode::apusers',
|
||||||
|
);
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 PLUGIN DESCRIPTION
|
||||||
|
|
||||||
|
Check Trapeze Network (Juniper) Wifi LAN Controller through SNMP
|
||||||
|
|
||||||
|
=cut
|
Loading…
Reference in New Issue