+ Ref #468 (WIP)
This commit is contained in:
parent
27f8534cbf
commit
6c354027a9
|
@ -0,0 +1,67 @@
|
|||
#
|
||||
# Copyright 2016 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::nortel::standard::snmp::mode::components::card;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use network::nortel::standard::snmp::mode::components::resources qw($map_card_status);
|
||||
|
||||
my $mapping = {
|
||||
rcCardSerialNumber => { oid => '.1.3.6.1.4.1.2272.1.4.9.1.1.3' },
|
||||
rcCardOperStatus => { oid => '.1.3.6.1.4.1.2272.1.4.9.1.1.6', map => $map_card_status },
|
||||
};
|
||||
my $oid_rcCardEntry = '.1.3.6.1.4.1.2272.1.4.9.1.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_rcCardEntry };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking cards");
|
||||
$self->{components}->{card} = {name => 'cards', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'card'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rcCardEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{rcCardOperStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_rcCardEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'card', instance => $instance));
|
||||
$self->{components}->{card}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("card '%s' status is '%s' [instance: %s].",
|
||||
$result->{rcCardSerialNumber}, $result->{rcCardOperStatus},
|
||||
$instance
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'card', instance => $instance, value => $result->{rcCardOperStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Card '%s' status is '%s'",
|
||||
$result->{rcCardSerialNumber}, $result->{rcCardOperStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,69 @@
|
|||
#
|
||||
# Copyright 2016 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::nortel::standard::snmp::mode::components::entity;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use network::nortel::standard::snmp::mode::components::resources qw($map_comp_status);
|
||||
|
||||
my $mapping = {
|
||||
s5ChasComDescr => { oid => '.1.3.6.1.4.1.45.1.6.3.3.1.1.5' },
|
||||
s5ChasComOperState => { oid => '.1.3.6.1.4.1.45.1.6.3.3.1.1.10', map => $map_comp_status },
|
||||
};
|
||||
my $oid_s5ChasComEntry = '.1.3.6.1.4.1.45.1.6.3.3.1.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_s5ChasComEntry };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking entities");
|
||||
$self->{components}->{entity} = {name => 'entities', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'entity'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_s5ChasComEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{s5ChasComOperState}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_s5ChasComEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'entity', instance => $instance));
|
||||
$self->{components}->{entity}->{total}++;
|
||||
|
||||
my $name = defined($result->{s5ChasComDescr}) && $result->{s5ChasComDescr} ne '' ?
|
||||
$result->{s5ChasComDescr} : $instance;
|
||||
$self->{output}->output_add(long_msg => sprintf("entity '%s' status is '%s' [instance: %s].",
|
||||
$name, $result->{s5ChasComOperState},
|
||||
$instance
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'entity', instance => $instance, value => $result->{s5ChasComOperState});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Entity '%s' status is '%s'",
|
||||
$name, $result->{s5ChasComOperState}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,78 @@
|
|||
#
|
||||
# Copyright 2016 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::nortel::standard::snmp::mode::components::fan;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use network::nortel::standard::snmp::mode::components::resources qw($map_fan_status);
|
||||
|
||||
my $mapping = {
|
||||
rcChasFanOperStatus => { oid => '.1.3.6.1.4.1.2272.1.4.7.1.1.2', map => $map_fan_status },
|
||||
rcChasFanAmbientTemperature => { oid => '.1.3.6.1.4.1.2272.1.4.7.1.1.3' },
|
||||
};
|
||||
my $oid_rcChasFanEntry = '.1.3.6.1.4.1.2272.1.4.7.1.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_rcChasFanEntry };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking fans");
|
||||
$self->{components}->{fan} = {name => 'fans', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'fan'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rcChasFanEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{rcChasFanOperStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_rcChasFanEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'fan', instance => $instance));
|
||||
$self->{components}->{fan}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("fan '%s' status is '%s' [instance: %s, value: %s].",
|
||||
$instance, $result->{rcChasFanOperStatus},
|
||||
$instance, $result->{rcChasFanAmbientTemperature}
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'fan', instance => $instance, value => $result->{rcChasFanOperStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Fan '%s' status is '%s'",
|
||||
$instance, $result->{rcChasFanOperStatus}));
|
||||
}
|
||||
|
||||
my ($exit2, $warn, $crit) = $self->get_severity_numeric(section => 'fan.temperature', instance => $instance, value => $result->{rcChasFanAmbientTemperature});
|
||||
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit2,
|
||||
short_msg => sprintf("Fan temperature '%s' is %s degree centigrade", $instance, $result->{rcChasFanAmbientTemperature}));
|
||||
}
|
||||
$self->{output}->perfdata_add(label => 'fan_temp_' . $instance, unit => 'C',
|
||||
value => $result->{rcChasFanAmbientTemperature},
|
||||
warning => $warn,
|
||||
critical => $crit,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,66 @@
|
|||
#
|
||||
# Copyright 2016 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::nortel::standard::snmp::mode::components::psu;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use network::nortel::standard::snmp::mode::components::resources qw($map_psu_status);
|
||||
|
||||
my $mapping = {
|
||||
rcChasPowerSupplyOperStatus => { oid => '.1.3.6.1.4.1.2272.1.4.8.1.1.2', map => $map_psu_status },
|
||||
};
|
||||
my $oid_rcChasPowerSupplyEntry = '.1.3.6.1.4.1.2272.1.4.8.1.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_rcChasPowerSupplyEntry };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking power supplies");
|
||||
$self->{components}->{psu} = {name => 'psus', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'psu'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rcChasPowerSupplyEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{rcChasPowerSupplyOperStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_rcChasPowerSupplyEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'psu', instance => $instance));
|
||||
$self->{components}->{psu}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("power supply '%s' status is '%s' [instance: %s].",
|
||||
$instance, $result->{rcChasPowerSupplyOperStatus},
|
||||
$instance
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'psu', instance => $instance, value => $result->{rcChasPowerSupplyOperStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Power supply '%s' status is '%s'",
|
||||
$instance, $result->{rcChasPowerSupplyOperStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,68 @@
|
|||
#
|
||||
# Copyright 2016 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::nortel::standard::snmp::mode::components::resources;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Exporter;
|
||||
|
||||
our ($map_comp_status, $map_fan_status, $map_psu_status, $map_card_status);
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT_OK = qw($map_comp_status $map_fan_status $map_psu_status $map_card_status);
|
||||
|
||||
$map_fan_status = {
|
||||
1 => 'unknown',
|
||||
2 => 'up',
|
||||
3 => 'down',
|
||||
};
|
||||
|
||||
$map_psu_status = {
|
||||
1 => 'unknown',
|
||||
2 => 'empty',
|
||||
3 => 'up',
|
||||
4 => 'down',
|
||||
};
|
||||
|
||||
$map_card_status = {
|
||||
1 => 'up',
|
||||
2 => 'down',
|
||||
3 => 'testing',
|
||||
4 => 'unknown',
|
||||
5 => 'dormant',
|
||||
};
|
||||
|
||||
$map_comp_status = {
|
||||
1 => 'other',
|
||||
2 => 'notAvail',
|
||||
3 => 'removed',
|
||||
4 => 'disabled',
|
||||
5 => 'normal',
|
||||
6 => 'resetInProg',
|
||||
7 => 'testing',
|
||||
8 => 'warning',
|
||||
9 => 'nonFatalErr',
|
||||
10 => 'fatalErr',
|
||||
11 => 'notConfig',
|
||||
12 => 'obsoleted',
|
||||
};
|
||||
|
||||
1;
|
|
@ -0,0 +1,70 @@
|
|||
#
|
||||
# Copyright 2016 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::nortel::standard::snmp::mode::components::temperature;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $mapping = {
|
||||
s5ChasTmpSnrTmpValue => { oid => '.1.3.6.1.4.1.45.1.6.3.7.1.1.5' },
|
||||
};
|
||||
my $oid_s5ChasTmpSnrEntry = '.1.3.6.1.4.1.45.1.6.3.7.1.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_s5ChasTmpSnrEntry };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking temperatures");
|
||||
$self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'temperature'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_s5ChasTmpSnrEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{s5ChasTmpSnrTmpValue}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_s5ChasTmpSnrEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'temperature', instance => $instance));
|
||||
$self->{components}->{temperature}->{total}++;
|
||||
|
||||
$result->{s5ChasTmpSnrTmpValue} = sprintf("%.2f", $result->{s5ChasTmpSnrTmpValue} / 2);
|
||||
$self->{output}->output_add(long_msg => sprintf("temperature '%s' is %s degree centigrade [instance = %s]",
|
||||
$instance, $result->{s5ChasTmpSnrTmpValue}, $instance,
|
||||
));
|
||||
|
||||
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{s5ChasTmpSnrTmpValue});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Temperature '%s' is %s degree centigrade", $result->{slHdwTempSensorName}, $result->{s5ChasTmpSnrTmpValue}));
|
||||
}
|
||||
$self->{output}->perfdata_add(label => 'temp_' . $instance, unit => 'C',
|
||||
value => $result->{s5ChasTmpSnrTmpValue},
|
||||
warning => $warn,
|
||||
critical => $crit,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,155 @@
|
|||
#
|
||||
# Copyright 2016 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::nortel::standard::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 => 1, cb_prefix_output => 'prefix_cpu_output', message_multiple => 'All CPU usages are ok', skipped_code => { -10 => 1 } }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{cpu} = [
|
||||
{ label => 'total', set => {
|
||||
key_values => [ { name => 'total' }, { name => 'num' } ],
|
||||
output_template => 'Total CPU Usage : %.2f %%',
|
||||
perfdatas => [
|
||||
{ label => 'cpu_total', value => 'total_absolute', template => '%.2f', min => 0, max => 100, unit => '%',
|
||||
label_extra_instance => 1, instance_use => 'num_absolute' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => '1m', set => {
|
||||
key_values => [ { name => '1m' }, { name => 'num' } ],
|
||||
output_template => '1 minute : %.2f %%',
|
||||
perfdatas => [
|
||||
{ label => 'cpu_1min', value => '1m_absolute', template => '%.2f',
|
||||
min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'num_absolute' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => '10m', set => {
|
||||
key_values => [ { name => '10m' }, { name => 'num' } ],
|
||||
output_template => '10 minutes : %.2f %%',
|
||||
perfdatas => [
|
||||
{ label => 'cpu_10min', value => '10m_absolute', template => '%.2f',
|
||||
min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'num_absolute' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => '1h', set => {
|
||||
key_values => [ { name => '1h' }, { name => 'num' } ],
|
||||
output_template => '1 hour : %.2f %%',
|
||||
perfdatas => [
|
||||
{ label => 'cpu_1h', value => '1h_absolute', template => '%.2f',
|
||||
min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'num_absolute' },
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_cpu_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "CPU '" . $options{instance_value}->{num} . "' ";
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
my $mapping = {
|
||||
s5ChasUtilTotalCPUUsage => { oid => '.1.3.6.1.4.1.45.1.6.3.8.1.1.4' },
|
||||
s5ChasUtilCPUUsageLast1Minute => { oid => '.1.3.6.1.4.1.45.1.6.3.8.1.1.5' },
|
||||
s5ChasUtilCPUUsageLast10Minutes => { oid => '.1.3.6.1.4.1.45.1.6.3.8.1.1.6' },
|
||||
s5ChasUtilCPUUsageLast1Hour => { oid => '.1.3.6.1.4.1.45.1.6.3.8.1.1.7' },
|
||||
};
|
||||
|
||||
my $oid_rcSysCpuUtil = '.1.3.6.1.4.1.2272.1.1.20'; # without .0
|
||||
my $oid_s5ChasUtilEntry = '.1.3.6.1.4.1.45.1.6.3.8.1.1';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{results} = $options{snmp}->get_multiple_table(oids => [
|
||||
{ oid => $oid_rcSysCpuUtil },
|
||||
{ oid => $oid_s5ChasUtilEntry },
|
||||
], nothing_quit => 1);
|
||||
|
||||
$self->{cpu} = {};
|
||||
foreach my $oid (keys %{$self->{results}->{$oid_s5ChasUtilEntry}}) {
|
||||
next if ($oid !~ /^$mapping->{s5ChasUtilTotalCPUUsage}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_s5ChasUtilEntry}, instance => $instance);
|
||||
|
||||
$self->{cpu}->{$instance} = { num => $instance, total => $result->{s5ChasUtilTotalCPUUsage},
|
||||
'1m' => $result->{s5ChasUtilCPUUsageLast1Minute}, '10m' => $result->{s5ChasUtilCPUUsageLast10Minutes},
|
||||
'1h' => $result->{s5ChasUtilCPUUsageLast1Hour} };
|
||||
}
|
||||
|
||||
if (scalar(keys %{$self->{results}->{$oid_rcSysCpuUtil}}) > 0) {
|
||||
$self->{cpu}->{0} = { num => 0, total => $self->{results}->{$oid_rcSysCpuUtil}->{$oid_rcSysCpuUtil . '.0'} };
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check CPU usages.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='^(1m|10m)$'
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Threshold warning.
|
||||
Can be: 'total', '1m', '5m', '10m', '1h'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Threshold critical.
|
||||
Can be: 'total', '1m', '5m', '10m', '1h'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,138 @@
|
|||
#
|
||||
# Copyright 2016 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::nortel::standard::snmp::mode::hardware;
|
||||
|
||||
use base qw(centreon::plugins::templates::hardware);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub set_system {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{regexp_threshold_overload_check_section_option} = '^(fan|psu|card|entity)$';
|
||||
$self->{regexp_threshold_numeric_check_section_option} = '^(temperature|fan.temperature)$';
|
||||
|
||||
$self->{cb_hook2} = 'snmp_execute';
|
||||
|
||||
$self->{thresholds} = {
|
||||
fan => [
|
||||
['up', 'OK'],
|
||||
['down', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
],
|
||||
psu => [
|
||||
['up', 'OK'],
|
||||
['down', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['empty', 'OK'],
|
||||
],
|
||||
card => [
|
||||
['up', 'OK'],
|
||||
['down', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['testing', 'OK'],
|
||||
['dormant', 'OK'],
|
||||
],
|
||||
entity => [
|
||||
['other', 'UNKNOWN'],
|
||||
['notAvail', 'OK'],
|
||||
['removed', 'OK'],
|
||||
['disabled', 'OK'],
|
||||
['normal', 'OK'],
|
||||
['resetInProg', 'OK'],
|
||||
['testing', 'OK'],
|
||||
['warning', 'WARNING'],
|
||||
['nonFatalErr', 'WARNING'],
|
||||
['fatalErr', 'CRITICAL'],
|
||||
['notConfig', 'OK'],
|
||||
['obsoleted', 'WARNING'],
|
||||
],
|
||||
};
|
||||
|
||||
$self->{components_path} = 'network::nortel::standard::snmp::mode::components';
|
||||
$self->{components_module} = ['fan', 'psu', 'card', 'entity'];
|
||||
}
|
||||
|
||||
sub snmp_execute {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{snmp} = $options{snmp};
|
||||
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check hardware.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--component>
|
||||
|
||||
Which component to check (Default: '.*').
|
||||
Can be: 'fan', 'psu', 'card', 'entity'.
|
||||
|
||||
=item B<--filter>
|
||||
|
||||
Exclude some parts (comma seperated list) (Example: --filter=psu)
|
||||
Can also exclude specific instance: --filter=psu,1
|
||||
|
||||
=item B<--no-component>
|
||||
|
||||
Return an error if no compenents are checked.
|
||||
If total (with skipped) is 0. (Default: 'critical' returns).
|
||||
|
||||
=item B<--threshold-overload>
|
||||
|
||||
Set to overload default threshold values (syntax: section,[instance,]status,regexp)
|
||||
It used before default thresholds (order stays).
|
||||
Example: --threshold-overload='entity,WARNING,disabled'
|
||||
|
||||
=item B<--warning>
|
||||
|
||||
Set warning threshold (syntax: type,regexp,threshold)
|
||||
Example: --warning='temperature,.*,30' --warning=fan.temperature,.*,10
|
||||
|
||||
=item B<--critical>
|
||||
|
||||
Set critical threshold (syntax: type,regexp,threshold)
|
||||
Example: --critical='temperature,.*,40'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,52 @@
|
|||
#
|
||||
# Copyright 2016 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::nortel::standard::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} = '1.0';
|
||||
%{$self->{modes}} = (
|
||||
'cpu' => 'network::nortel::standard::snmp::mode::cpu',
|
||||
'hardware' => 'network::nortel::standard::snmp::mode::hardware',
|
||||
'interfaces' => 'snmp_standard::mode::interfaces',
|
||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||
);
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Nortel switch/routers in SNMP.
|
||||
Can be used for avaya equipments also.
|
||||
|
||||
=cut
|
Loading…
Reference in New Issue