centreon-plugins/network/radware/alteon/snmp/mode/cpu.pm

127 lines
3.5 KiB
Perl
Raw Normal View History

2013-12-13 16:14:12 +01:00
#
2017-01-09 17:12:12 +01:00
# Copyright 2017 Centreon (http://www.centreon.com/)
2015-07-21 11:51:02 +02:00
#
# 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.
#
2013-12-13 16:14:12 +01:00
2017-03-28 14:35:52 +02:00
package network::radware::alteon::snmp::mode::cpu;
2013-12-13 16:14:12 +01:00
2017-03-29 17:01:02 +02:00
use base qw(centreon::plugins::templates::counter);
2013-12-13 16:14:12 +01:00
use strict;
use warnings;
2017-03-29 17:01:02 +02:00
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0, cb_prefix_output => 'prefix_cpu_output' }
];
$self->{maps_counters}->{global} = [
{ label => '1s', set => {
key_values => [ { name => '1s' } ],
output_template => '%.2f%% (1sec)',
perfdatas => [
{ label => 'cpu_1s', value => '1s_absolute', template => '%.2f',
min => 0, max => 100, unit => '%' },
],
}
},
{ label => '4s', set => {
key_values => [ { name => '4s' } ],
output_template => '%.2f%% (4sec)',
perfdatas => [
{ label => 'cpu_4s', value => '4s_absolute', template => '%.2f',
min => 0, max => 100, unit => '%' },
],
}
},
{ label => '64s', set => {
key_values => [ { name => '64s' } ],
output_template => '%.2f%% (64sec)',
perfdatas => [
{ label => 'cpu_64s', value => '64s_absolute', template => '%.2f',
min => 0, max => 100, unit => '%' },
],
}
},
];
}
sub prefix_cpu_output {
my ($self, %options) = @_;
return "MP CPU Usage: ";
}
2013-12-13 16:14:12 +01:00
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;
}
2017-03-29 17:01:02 +02:00
sub manage_selection {
2013-12-13 16:14:12 +01:00
my ($self, %options) = @_;
my $oid_mpCpuStatsUtil1Second = '.1.3.6.1.4.1.1872.2.5.1.2.2.1.0';
my $oid_mpCpuStatsUtil4Seconds = '.1.3.6.1.4.1.1872.2.5.1.2.2.2.0';
my $oid_mpCpuStatsUtil64Seconds = '.1.3.6.1.4.1.1872.2.5.1.2.2.3.0';
2017-03-29 17:01:02 +02:00
my $snmp_result = $options{snmp}->get_leef(oids => [
$oid_mpCpuStatsUtil1Second, $oid_mpCpuStatsUtil4Seconds,
$oid_mpCpuStatsUtil64Seconds], nothing_quit => 1);
$self->{global} = { '1s' => $snmp_result->{$oid_mpCpuStatsUtil1Second}, '4s' => $snmp_result->{$oid_mpCpuStatsUtil4Seconds},
'64s' => $snmp_result->{$oid_mpCpuStatsUtil64Seconds} };
2013-12-13 16:14:12 +01:00
}
1;
__END__
=head1 MODE
Check MP cpu usage (ALTEON-CHEETAH-SWITCH-MIB).
=over 8
2017-03-29 17:01:02 +02:00
=item B<--filter-counters>
Only display some counters (regexp can be used).
Example: --filter-counters='^(64s)$'
=item B<--warning-*>
2013-12-13 16:14:12 +01:00
2017-03-29 17:01:02 +02:00
Threshold warning.
Can be: '1s', '4s', '64s'.
2013-12-13 16:14:12 +01:00
2017-03-29 17:01:02 +02:00
=item B<--critical-*>
2013-12-13 16:14:12 +01:00
2017-03-29 17:01:02 +02:00
Threshold critical.
Can be: '1s', '4s', '64s'.
2013-12-13 16:14:12 +01:00
=back
=cut