2014-08-04 11:24:38 +02:00
|
|
|
#
|
2015-07-21 11:51:02 +02:00
|
|
|
# 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.
|
|
|
|
#
|
2014-08-04 11:24:38 +02:00
|
|
|
|
|
|
|
package hardware::server::cisco::ucs::mode::components::blade;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
2014-08-04 14:59:57 +02:00
|
|
|
use hardware::server::cisco::ucs::mode::components::resources qw($thresholds);
|
2014-08-04 11:24:38 +02:00
|
|
|
|
|
|
|
sub check {
|
|
|
|
my ($self) = @_;
|
|
|
|
|
|
|
|
# In MIB 'CISCO-UNIFIED-COMPUTING-EQUIPMENT-MIB'
|
|
|
|
$self->{output}->output_add(long_msg => "Checking blades");
|
|
|
|
$self->{components}->{blade} = {name => 'blades', total => 0, skip => 0};
|
|
|
|
return if ($self->check_exclude(section => 'blade'));
|
|
|
|
|
|
|
|
my $oid_cucsComputeBladePresence = '.1.3.6.1.4.1.9.9.719.1.9.2.1.45';
|
|
|
|
my $oid_cucsComputeBladeOperState = '.1.3.6.1.4.1.9.9.719.1.9.2.1.42';
|
|
|
|
my $oid_cucsComputeBladeDn = '.1.3.6.1.4.1.9.9.719.1.9.2.1.2';
|
|
|
|
|
|
|
|
my $result = $self->{snmp}->get_multiple_table(oids => [
|
|
|
|
{ oid => $oid_cucsComputeBladePresence },
|
|
|
|
{ oid => $oid_cucsComputeBladeOperState },
|
|
|
|
{ oid => $oid_cucsComputeBladeDn },
|
|
|
|
]
|
|
|
|
);
|
|
|
|
foreach my $key ($self->{snmp}->oid_lex_sort(keys %{$result->{$oid_cucsComputeBladePresence}})) {
|
|
|
|
# index
|
|
|
|
$key =~ /\.(\d+)$/;
|
|
|
|
my $blade_index = $1;
|
|
|
|
my $blade_dn = $result->{$oid_cucsComputeBladeDn}->{$oid_cucsComputeBladeDn . '.' . $blade_index};
|
|
|
|
my $blade_operstate = defined($result->{$oid_cucsComputeBladeOperState}->{$oid_cucsComputeBladeOperState . '.' . $blade_index}) ?
|
|
|
|
$result->{$oid_cucsComputeBladeOperState}->{$oid_cucsComputeBladeOperState . '.' . $blade_index} : 0; # unknown
|
|
|
|
my $blade_presence = defined($result->{$oid_cucsComputeBladePresence}->{$oid_cucsComputeBladePresence . '.' . $blade_index}) ?
|
|
|
|
$result->{$oid_cucsComputeBladePresence}->{$oid_cucsComputeBladePresence . '.' . $blade_index} : 0;
|
|
|
|
|
|
|
|
next if ($self->absent_problem(section => 'blade', instance => $blade_dn));
|
|
|
|
next if ($self->check_exclude(section => 'blade', instance => $blade_dn));
|
|
|
|
|
2014-08-04 14:59:57 +02:00
|
|
|
my $exit = $self->get_severity(section => 'blade', threshold => 'presence', value => $blade_presence);
|
|
|
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
|
|
|
$self->{output}->output_add(severity => $exit,
|
2014-08-04 11:24:38 +02:00
|
|
|
short_msg => sprintf("blade '%s' presence is: '%s'",
|
2014-08-04 14:59:57 +02:00
|
|
|
$blade_dn, ${$thresholds->{presence}{$blade_presence}}[0])
|
2014-08-04 11:24:38 +02:00
|
|
|
);
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
$self->{components}->{blade}->{total}++;
|
|
|
|
|
|
|
|
$self->{output}->output_add(long_msg => sprintf("blade '%s' state is '%s' [presence: %s].",
|
2014-10-24 09:32:00 +02:00
|
|
|
$blade_dn, ${$thresholds->{overall_status}->{$blade_operstate}}[0],
|
2014-08-04 14:59:57 +02:00
|
|
|
${$thresholds->{presence}->{$blade_presence}}[0]
|
2014-08-04 11:24:38 +02:00
|
|
|
));
|
2014-10-24 09:32:00 +02:00
|
|
|
$exit = $self->get_severity(section => 'blade', threshold => 'overall_status', value => $blade_operstate);
|
2014-08-04 14:59:57 +02:00
|
|
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
|
|
|
$self->{output}->output_add(severity => $exit,
|
2014-08-04 11:24:38 +02:00
|
|
|
short_msg => sprintf("blade '%s' state is '%s'.",
|
2014-10-24 09:32:00 +02:00
|
|
|
$blade_dn, ${$thresholds->{overall_status}->{$blade_operstate}}[0]
|
2014-08-04 11:24:38 +02:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-24 09:32:00 +02:00
|
|
|
1;
|