+ Update left hand hardware
This commit is contained in:
parent
00a89d0c5c
commit
e339019d11
|
@ -1,98 +0,0 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::mode::components::device;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{components}->{device} = {name => 'devices', total => 0};
|
||||
$self->{output}->output_add(long_msg => "Checking devices");
|
||||
return if ($self->check_exclude('device'));
|
||||
|
||||
my $device_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.4.1.0";
|
||||
my $device_name_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.14';
|
||||
my $device_serie_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.7';
|
||||
my $device_present_state_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.90';
|
||||
my $device_present_status_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.91';
|
||||
my $device_health_state_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.17'; # normal, marginal, faulty
|
||||
my $device_health_status_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.18';
|
||||
my $device_temperature_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.9';
|
||||
my $device_temperature_critical_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.10';
|
||||
my $device_temperature_limit_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.11';
|
||||
my $device_temperature_status_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.12';
|
||||
return if ($self->{global_information}->{$device_count_oid} == 0);
|
||||
|
||||
$self->{snmp}->load(oids => [$device_name_oid, $device_serie_oid,
|
||||
$device_present_state_oid, $device_present_status_oid,
|
||||
$device_health_state_oid, $device_health_status_oid,
|
||||
$device_temperature_oid, $device_temperature_critical_oid,
|
||||
$device_temperature_limit_oid, $device_temperature_status_oid],
|
||||
begin => 1, end => $self->{global_information}->{$device_count_oid});
|
||||
my $result = $self->{snmp}->get_leef();
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
my $number_device = $self->{global_information}->{$device_count_oid};
|
||||
for (my $i = 1; $i <= $number_device; $i++) {
|
||||
my $device_name = $result->{$device_name_oid . "." . $i};
|
||||
my $device_serie = $result->{$device_serie_oid . "." . $i};
|
||||
my $device_present_state = $result->{$device_present_state_oid . "." . $i};
|
||||
my $device_present_status = $result->{$device_present_status_oid . "." . $i};
|
||||
my $device_health_state = $result->{$device_health_state_oid . "." . $i};
|
||||
my $device_health_status = $result->{$device_health_status_oid . "." . $i};
|
||||
my $device_temperature = $result->{$device_temperature_oid . "." . $i};
|
||||
my $device_temperature_critical = $result->{$device_temperature_critical_oid . "." . $i};
|
||||
my $device_temperature_limit = $result->{$device_temperature_limit_oid . "." . $i};
|
||||
my $device_temperature_status = $result->{$device_temperature_status_oid . "." . $i};
|
||||
|
||||
$self->{components}->{device}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Storage Device '$device_name' and Serial Number '$device_serie', state = '$device_present_state'");
|
||||
# Check if present
|
||||
if ($device_present_state =~ /off_and_secured|off_or_removed/i) {
|
||||
next;
|
||||
}
|
||||
|
||||
# Check global health
|
||||
if ($device_health_status != 1) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => "Storage Device '" . $device_name . "' Smart Health problem '" . $device_health_state . "'");
|
||||
}
|
||||
$self->{output}->output_add(long_msg => " Smart Health status = '" . $device_health_status . "', Smart Health state = '" . $device_health_state . "'");
|
||||
|
||||
# Check temperature
|
||||
if ($device_temperature >= $device_temperature_critical) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => "Device Storage '" . $device_name . "' temperature too high");
|
||||
} elsif ($device_temperature >= $device_temperature_limit) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => "Device Storage '" . $device_name . "' over the limit");
|
||||
}
|
||||
$self->{output}->output_add(long_msg => " Temperature value = '" . $device_temperature . "' (limit >= $device_temperature_limit, critical >= $device_temperature_critical)");
|
||||
$self->{output}->perfdata_add(label => $device_name . "_temp",
|
||||
value => $device_temperature,
|
||||
warning => $device_temperature_limit, critical => $device_temperature_critical);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,81 +0,0 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::mode::components::fan;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{components}->{fan} = {name => 'fans', total => 0};
|
||||
$self->{output}->output_add(long_msg => "Checking fan");
|
||||
return if ($self->check_exclude('fan'));
|
||||
|
||||
my $fan_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.110.0"; # 0 means 'none'
|
||||
my $fan_name_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.111.1.2"; # begin .1
|
||||
my $fan_speed_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.111.1.3"; # dont have
|
||||
my $fan_min_speed_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.111.1.4"; # dont have
|
||||
my $fan_state_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.111.1.90"; # string explained
|
||||
my $fan_status_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.111.1.91";
|
||||
return if ($self->{global_information}->{$fan_count_oid} == 0);
|
||||
|
||||
$self->{snmp}->load(oids => [$fan_name_oid, $fan_name_oid,
|
||||
$fan_min_speed_oid, $fan_state_oid, $fan_status_oid],
|
||||
begin => 1, end => $self->{global_information}->{$fan_count_oid});
|
||||
my $result = $self->{snmp}->get_leef();
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
my $number_fans = $self->{global_information}->{$fan_count_oid};
|
||||
for (my $i = 1; $i <= $number_fans; $i++) {
|
||||
my $fan_name = $result->{$fan_name_oid . "." . $i};
|
||||
my $fan_speed = $result->{$fan_speed_oid . "." . $i};
|
||||
my $fan_min_speed = $result->{$fan_min_speed_oid . "." . $i};
|
||||
my $fan_status = $result->{$fan_status_oid . "." . $i};
|
||||
my $fan_state = $result->{$fan_state_oid . "." . $i};
|
||||
|
||||
$self->{components}->{fan}->{total}++;
|
||||
|
||||
# Check Fan Speed
|
||||
if (defined($fan_speed)) {
|
||||
my $low_limit = '';
|
||||
if (defined($fan_min_speed)) {
|
||||
$low_limit = '@:' . $fan_min_speed;
|
||||
if ($fan_speed <= $fan_min_speed) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => "Fan '" . $fan_name . "' speed too low");
|
||||
}
|
||||
}
|
||||
$self->{output}->output_add(long_msg => "Fan '" . $fan_name . "' speed = '" . $fan_speed . "' (<= $fan_min_speed)");
|
||||
$self->{output}->perfdata_add(label => $fan_name, unit => 'rpm',
|
||||
value => $fan_speed,
|
||||
critical => $low_limit);
|
||||
}
|
||||
|
||||
if ($fan_status != 1) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => "Fan '" . $fan_name . "' problem '" . $fan_state . "'");
|
||||
}
|
||||
$self->{output}->output_add(long_msg => "Fan '" . $fan_name . "' status = '" . $fan_status . "', state = '" . $fan_state . "'");
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,61 +0,0 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::mode::components::psu;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{components}->{psu} = {name => 'power supplies', total => 0};
|
||||
$self->{output}->output_add(long_msg => "Checking power supplies");
|
||||
return if ($self->check_exclude('psu'));
|
||||
|
||||
my $power_supply_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.130.0";
|
||||
my $power_supply_name_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.131.1.2";
|
||||
my $power_supply_state_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.131.1.90";
|
||||
my $power_supply_status_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.131.1.91";
|
||||
return if ($self->{global_information}->{$power_supply_count_oid} == 0);
|
||||
|
||||
$self->{snmp}->load(oids => [$power_supply_name_oid, $power_supply_name_oid,
|
||||
$power_supply_status_oid],
|
||||
begin => 1, end => $self->{global_information}->{$power_supply_count_oid});
|
||||
my $result = $self->{snmp}->get_leef();
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
my $number_ps = $self->{global_information}->{$power_supply_count_oid};
|
||||
for (my $i = 1; $i <= $number_ps; $i++) {
|
||||
my $ps_name = $result->{$power_supply_name_oid . "." . $i};
|
||||
my $ps_state = $result->{$power_supply_state_oid . "." . $i};
|
||||
my $ps_status = $result->{$power_supply_status_oid . "." . $i};
|
||||
|
||||
$self->{components}->{psu}->{total}++;
|
||||
|
||||
if ($ps_status != 1) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => "Power Supply '" . $ps_name . "' problem '" . $ps_state . "'");
|
||||
}
|
||||
$self->{output}->output_add(long_msg => "Power Supply '" . $ps_name . "' status = '" . $ps_status . "', state = '" . $ps_state . "'");
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,61 +0,0 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::mode::components::rc;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{components}->{rc} = {name => 'raid controllers', total => 0};
|
||||
$self->{output}->output_add(long_msg => "Checking raid controllers");
|
||||
return if ($self->check_exclude('rc'));
|
||||
|
||||
my $rc_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.4.3.0";
|
||||
my $rc_name_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.4.1.2';
|
||||
my $rc_state_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.4.1.90';
|
||||
my $rc_status_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.4.1.91';
|
||||
return if ($self->{global_information}->{$rc_count_oid} == 0);
|
||||
|
||||
$self->{snmp}->load(oids => [$rc_name_oid, $rc_state_oid,
|
||||
$rc_status_oid],
|
||||
begin => 1, end => $self->{global_information}->{$rc_count_oid});
|
||||
my $result = $self->{snmp}->get_leef();
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
my $number_rc = $self->{global_information}->{$rc_count_oid};
|
||||
for (my $i = 1; $i <= $number_rc; $i++) {
|
||||
my $rc_name = $result->{$rc_name_oid . "." . $i};
|
||||
my $rc_state = $result->{$rc_state_oid . "." . $i};
|
||||
my $rc_status = $result->{$rc_status_oid . "." . $i};
|
||||
|
||||
$self->{components}->{rc}->{total}++;
|
||||
|
||||
if ($rc_status != 1) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => "Raid Device (Controller) '" . $rc_name . "' problem '" . $rc_state . "'");
|
||||
}
|
||||
$self->{output}->output_add(long_msg => "Raid Device (Controller) '" . $rc_name . "' status = '" . $rc_status . "', state = '" . $rc_state . "'");
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,76 +0,0 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::mode::components::rcc;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{components}->{rcc} = {name => 'raid controller caches', total => 0};
|
||||
$self->{output}->output_add(long_msg => "Checking raid controller cache");
|
||||
return if ($self->check_exclude('rcc'));
|
||||
|
||||
my $rcc_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.90.0";
|
||||
my $rcc_name_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.91.1.2"; # begin .1
|
||||
my $rcc_state_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.91.1.90";
|
||||
my $rcc_status_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.91.1.91";
|
||||
my $bbu_enabled_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.91.1.50"; # 1 mean 'enabled'
|
||||
my $bbu_state_oid = '.1.3.6.1.4.1.9804.3.1.1.2.1.91.1.22';
|
||||
my $bbu_status_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.91.1.23"; # 1 mean 'ok'
|
||||
return if ($self->{global_information}->{$rcc_count_oid} == 0);
|
||||
|
||||
$self->{snmp}->load(oids => [$rcc_name_oid, $rcc_state_oid,
|
||||
$rcc_status_oid, $bbu_enabled_oid, $bbu_state_oid, $bbu_status_oid],
|
||||
begin => 1, end => $self->{global_information}->{$rcc_count_oid});
|
||||
my $result = $self->{snmp}->get_leef();
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
my $number_raid = $self->{global_information}->{$rcc_count_oid};
|
||||
for (my $i = 1; $i <= $number_raid; $i++) {
|
||||
my $raid_name = $result->{$rcc_name_oid . "." . $i};
|
||||
my $raid_state = $result->{$rcc_state_oid . "." . $i};
|
||||
my $raid_status = $result->{$rcc_status_oid . "." . $i};
|
||||
my $bbu_enabled = $result->{$bbu_enabled_oid . "." . $i};
|
||||
my $bbu_state = $result->{$bbu_state_oid . "." . $i};
|
||||
my $bbu_status = $result->{$bbu_status_oid . "." . $i};
|
||||
|
||||
$self->{components}->{rcc}->{total}++;
|
||||
|
||||
if ($raid_status != 1) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => "Raid Controller Caches '" . $raid_name . "' problem '" . $raid_state . "'");
|
||||
}
|
||||
$self->{output}->output_add(long_msg => "Raid Controller Caches '" . $raid_name . "' status = '" . $raid_status . "', state = '" . $raid_state . "'");
|
||||
if ($bbu_enabled == 1) {
|
||||
if ($bbu_status != 1) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => "BBU '" . $raid_name . "' problem '" . $bbu_state . "'");
|
||||
}
|
||||
$self->{output}->output_add(long_msg => " BBU status = '" . $bbu_status . "', state = '" . $bbu_state . "'");
|
||||
} else {
|
||||
$self->{output}->output_add(long_msg => " BBU disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,58 +0,0 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::mode::components::ro;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{components}->{ro} = {name => 'raid os devices', total => 0};
|
||||
$self->{output}->output_add(long_msg => "Checking raid os devices");
|
||||
return if ($self->check_exclude('ro'));
|
||||
|
||||
my $raid_os_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.4.50.0";
|
||||
my $raid_os_name_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.51.1.2';
|
||||
my $raid_os_state_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.51.1.90'; # != 'normal'
|
||||
return if ($self->{global_information}->{$raid_os_count_oid} == 0);
|
||||
|
||||
$self->{snmp}->load(oids => [$raid_os_name_oid, $raid_os_state_oid],
|
||||
begin => 1, end => $self->{global_information}->{$raid_os_count_oid});
|
||||
my $result = $self->{snmp}->get_leef();
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
my $number_ro = $self->{global_information}->{$raid_os_count_oid};
|
||||
for (my $i = 1; $i <= $number_ro; $i++) {
|
||||
my $ro_name = $result->{$raid_os_name_oid . "." . $i};
|
||||
my $ro_state = $result->{$raid_os_state_oid . "." . $i};
|
||||
|
||||
$self->{components}->{ro}->{total}++;
|
||||
|
||||
if ($ro_state !~ /normal/i) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => "Raid OS Device '" . $ro_name . "' problem '" . $ro_state . "'");
|
||||
}
|
||||
$self->{output}->output_add(long_msg => "Raid OS Device '" . $ro_name . "' state = '" . $ro_state . "'");
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,79 +0,0 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::mode::components::temperature;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{components}->{temperature} = {name => 'temperature sensors', total => 0};
|
||||
$self->{output}->output_add(long_msg => "Checking temperature sensors");
|
||||
return if ($self->check_exclude('temperature'));
|
||||
|
||||
my $temperature_sensor_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.120.0";
|
||||
my $temperature_sensor_name_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.121.1.2";
|
||||
my $temperature_sensor_value_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.121.1.3";
|
||||
my $temperature_sensor_critical_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.121.1.4";
|
||||
my $temperature_sensor_limit_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.121.1.5"; # warning. lower than critical
|
||||
my $temperature_sensor_state_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.121.1.90";
|
||||
my $temperature_sensor_status_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.121.1.91";
|
||||
return if ($self->{global_information}->{$temperature_sensor_count_oid} == 0);
|
||||
|
||||
$self->{snmp}->load(oids => [$temperature_sensor_name_oid, $temperature_sensor_value_oid,
|
||||
$temperature_sensor_critical_oid, $temperature_sensor_limit_oid, $temperature_sensor_state_oid, $temperature_sensor_status_oid],
|
||||
begin => 1, end => $self->{global_information}->{$temperature_sensor_count_oid});
|
||||
my $result = $self->{snmp}->get_leef();
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
my $number_temperature = $self->{global_information}->{$temperature_sensor_count_oid};
|
||||
for (my $i = 1; $i <= $number_temperature; $i++) {
|
||||
my $ts_name = $result->{$temperature_sensor_name_oid . "." . $i};
|
||||
my $ts_value = $result->{$temperature_sensor_value_oid . "." . $i};
|
||||
my $ts_critical = $result->{$temperature_sensor_critical_oid . "." . $i};
|
||||
my $ts_limit = $result->{$temperature_sensor_limit_oid . "." . $i};
|
||||
my $ts_state = $result->{$temperature_sensor_state_oid . "." . $i};
|
||||
my $ts_status = $result->{$temperature_sensor_status_oid . "." . $i};
|
||||
|
||||
$self->{components}->{temperature}->{total}++;
|
||||
|
||||
if ($ts_value >= $ts_critical) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => "Temperature sensor '" . $ts_name . "' too high");
|
||||
} elsif ($ts_value >= $ts_limit) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => "Temperature sensor '" . $ts_name . "' over the limit");
|
||||
}
|
||||
$self->{output}->output_add(long_msg => "Temperature sensor '" . $ts_name . "' value = '" . $ts_value . "' (limit >= $ts_limit, critical >= $ts_critical)");
|
||||
$self->{output}->perfdata_add(label => $ts_name . "_temp",
|
||||
value => $ts_value,
|
||||
warning => $ts_limit, critical => $ts_critical);
|
||||
|
||||
if ($ts_status != 1) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => "Temperature sensor '" . $ts_name . "' problem '" . $ts_state . "'");
|
||||
}
|
||||
$self->{output}->output_add(long_msg => "Temperature sensor '" . $ts_name . "' status = '" . $ts_status . "', state = '" . $ts_state . "'");
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,83 +0,0 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::mode::components::voltage;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{components}->{voltage} = {name => 'voltage sensors', total => 0};
|
||||
$self->{output}->output_add(long_msg => "Checking voltage sensors");
|
||||
return if ($self->check_exclude('voltage'));
|
||||
|
||||
my $vs_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.140.0";
|
||||
my $vs_name_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.141.1.2";
|
||||
my $vs_value_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.141.1.3";
|
||||
my $vs_low_limit_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.141.1.4";
|
||||
my $vs_high_limit_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.141.1.5";
|
||||
my $vs_state_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.141.1.90";
|
||||
my $vs_status_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.141.1.91";
|
||||
return if ($self->{global_information}->{$vs_count_oid} == 0);
|
||||
|
||||
$self->{snmp}->load(oids => [$vs_name_oid, $vs_value_oid,
|
||||
$vs_low_limit_oid, $vs_high_limit_oid,
|
||||
$vs_state_oid, $vs_status_oid],
|
||||
begin => 1, end => $self->{global_information}->{$vs_count_oid});
|
||||
my $result = $self->{snmp}->get_leef();
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
my $number_vs = $self->{global_information}->{$vs_count_oid};
|
||||
for (my $i = 1; $i <= $number_vs; $i++) {
|
||||
my $vs_name = $result->{$vs_name_oid . "." . $i};
|
||||
my $vs_value = $result->{$vs_value_oid . "." . $i};
|
||||
my $vs_low_limit = $result->{$vs_low_limit_oid . "." . $i};
|
||||
my $vs_high_limit = $result->{$vs_high_limit_oid . "." . $i};
|
||||
my $vs_state = $result->{$vs_state_oid . "." . $i};
|
||||
my $vs_status = $result->{$vs_status_oid . "." . $i};
|
||||
|
||||
$self->{components}->{voltage}->{total}++;
|
||||
|
||||
# Check Voltage limit
|
||||
if (defined($vs_low_limit) && defined($vs_high_limit)) {
|
||||
if ($vs_value <= $vs_low_limit) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => "Voltage sensor '" . $vs_name . "' too low");
|
||||
} elsif ($vs_value >= $vs_high_limit) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => "Voltage sensor '" . $vs_name . "' too high");
|
||||
}
|
||||
$self->{output}->output_add(long_msg => "Voltage sensor '" . $vs_name . "' value = '" . $vs_value . "' (<= $vs_low_limit, >= $vs_high_limit)");
|
||||
$self->{output}->perfdata_add(label => $vs_name . "_volt",
|
||||
value => $vs_value,
|
||||
warning => '@:' . $vs_low_limit, critical => $vs_high_limit);
|
||||
}
|
||||
|
||||
if ($vs_status != 1) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => "Voltage sensor '" . $vs_name . "' problem '" . $vs_state . "'");
|
||||
}
|
||||
$self->{output}->output_add(long_msg => "Voltage sensor '" . $vs_name . "' status = '" . $vs_status . "', state = '" . $vs_state . "'");
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,175 +0,0 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::mode::hardware;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::hp::lefthand::mode::components::fan;
|
||||
use storage::hp::lefthand::mode::components::rcc;
|
||||
use storage::hp::lefthand::mode::components::temperature;
|
||||
use storage::hp::lefthand::mode::components::psu;
|
||||
use storage::hp::lefthand::mode::components::voltage;
|
||||
use storage::hp::lefthand::mode::components::device;
|
||||
use storage::hp::lefthand::mode::components::rc;
|
||||
use storage::hp::lefthand::mode::components::ro;
|
||||
|
||||
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 =>
|
||||
{
|
||||
"exclude:s" => { name => 'exclude' },
|
||||
"component:s" => { name => 'component', default => 'all' },
|
||||
});
|
||||
$self->{components} = {};
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::init(%options);
|
||||
}
|
||||
|
||||
sub global {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
storage::hp::lefthand::mode::components::fan::check($self);
|
||||
storage::hp::lefthand::mode::components::rcc::check($self);
|
||||
storage::hp::lefthand::mode::components::temperature::check($self);
|
||||
storage::hp::lefthand::mode::components::psu::check($self);
|
||||
storage::hp::lefthand::mode::components::voltage::check($self);
|
||||
storage::hp::lefthand::mode::components::device::check($self);
|
||||
storage::hp::lefthand::mode::components::rc::check($self);
|
||||
storage::hp::lefthand::mode::components::ro::check($self);
|
||||
}
|
||||
|
||||
sub component {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
if ($self->{option_results}->{component} eq 'fan') {
|
||||
storage::hp::lefthand::mode::components::fan::check($self);
|
||||
} elsif ($self->{option_results}->{component} eq 'rcc') {
|
||||
storage::hp::lefthand::mode::components::rcc::check($self);
|
||||
} elsif ($self->{option_results}->{component} eq 'temperature') {
|
||||
storage::hp::lefthand::mode::components::temperature::check($self);
|
||||
} elsif ($self->{option_results}->{component} eq 'psu') {
|
||||
storage::hp::lefthand::mode::components::psu::check($self);
|
||||
} elsif ($self->{option_results}->{component} eq 'voltage') {
|
||||
storage::hp::lefthand::mode::components::voltage::check($self);
|
||||
} elsif ($self->{option_results}->{component} eq 'device') {
|
||||
storage::hp::lefthand::mode::components::device::check($self);
|
||||
} elsif ($self->{option_results}->{component} eq 'rc') {
|
||||
storage::hp::lefthand::mode::components::rc::check($self);
|
||||
} elsif ($self->{option_results}->{component} eq 'ro') {
|
||||
storage::hp::lefthand::mode::components::ro::check($self);
|
||||
} else {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
}
|
||||
|
||||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
$self->{snmp} = $options{snmp};
|
||||
|
||||
$self->get_global_information();
|
||||
|
||||
if ($self->{option_results}->{component} eq 'all') {
|
||||
$self->global();
|
||||
} else {
|
||||
$self->component();
|
||||
}
|
||||
|
||||
my $total_components = 0;
|
||||
my $display_by_component = '';
|
||||
my $display_by_component_append = '';
|
||||
foreach my $comp (sort(keys %{$self->{components}})) {
|
||||
# Skipping short msg when no components
|
||||
next if ($self->{components}->{$comp}->{total} == 0);
|
||||
$total_components += $self->{components}->{$comp}->{total};
|
||||
$display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . ' ' . $self->{components}->{$comp}->{name};
|
||||
$display_by_component_append = ', ';
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => sprintf("All %s components [%s] are ok.",
|
||||
$total_components,
|
||||
$display_by_component
|
||||
)
|
||||
);
|
||||
|
||||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
sub get_global_information {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{global_information} = $self->{snmp}->get_leef(oids => [
|
||||
'.1.3.6.1.4.1.9804.3.1.1.2.1.110.0', # fancount
|
||||
'.1.3.6.1.4.1.9804.3.1.1.2.1.90.0', # raid controlle cache count
|
||||
'.1.3.6.1.4.1.9804.3.1.1.2.1.120.0', # temperature sensor
|
||||
'.1.3.6.1.4.1.9804.3.1.1.2.1.130.0', # powersupply
|
||||
'.1.3.6.1.4.1.9804.3.1.1.2.1.140.0', # voltage sensor
|
||||
'.1.3.6.1.4.1.9804.3.1.1.2.4.1.0', # storage device
|
||||
'.1.3.6.1.4.1.9804.3.1.1.2.4.3.0', # raid controller
|
||||
'.1.3.6.1.4.1.9804.3.1.1.2.4.50.0' # raid internal
|
||||
], nothing_quit => 1);
|
||||
}
|
||||
|
||||
sub check_exclude {
|
||||
my ($self, $section) = @_;
|
||||
|
||||
if (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)$section(\s|,|$)/) {
|
||||
$self->{output}->output_add(long_msg => sprintf("Skipping $section section."));
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Hardware (fans, power supplies, temperatures, voltages, raid controller caches, devices, raid controllers, raid os).
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--component>
|
||||
|
||||
Which component to check (Default: 'all').
|
||||
Can be: 'fan', 'rcc', 'temperature', 'psu', 'voltage', 'device', 'rc', 'ro'.
|
||||
|
||||
=item B<--exclude>
|
||||
|
||||
Exclude some parts (comma seperated list) (Example: --exclude=psu,rcc).
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::snmp::mode::components::device;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::hp::lefthand::snmp::mode::components::resources qw($map_status);
|
||||
|
||||
my $mapping = {
|
||||
storageDeviceSerialNumber => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.7' },
|
||||
storageDeviceTemperature => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.9' },
|
||||
storageDeviceTemperatureCritical => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.10' },
|
||||
storageDeviceTemperatureLimit => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.11' },
|
||||
storageDeviceTemperatureStatus => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.12', map => $map_status },
|
||||
storageDeviceName => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.14' },
|
||||
storageDeviceSmartHealth => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.17' }, # normal, marginal, faulty
|
||||
storageDeviceState => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.90' },
|
||||
storageDeviceStatus => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.91', map => $map_status },
|
||||
};
|
||||
my $oid_storageDeviceEntry = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_storageDeviceEntry };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking devices");
|
||||
$self->{components}->{device} = {name => 'devices', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'device'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_storageDeviceEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{storageDeviceStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_storageDeviceEntry}, instance => $instance);
|
||||
|
||||
if ($result->{storageDeviceState} =~ /off_and_secured|off_or_removed/i) {
|
||||
$self->absent_problem(section => 'device', instance => $instance);
|
||||
next;
|
||||
}
|
||||
next if ($self->check_filter(section => 'device', instance => $instance));
|
||||
|
||||
$self->{components}->{device}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("storage device '%s' status is '%s' [instance = %s, state = %s, serial = %s, smart health = %s]",
|
||||
$result->{storageDeviceName}, $result->{storageDeviceStatus}, $instance, $result->{storageDeviceState},
|
||||
$result->{storageDeviceSerialNumber}, $result->{storageDeviceSmartHealth}));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'device', value => $result->{storageDeviceStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("storage device '%s' state is '%s'", $result->{storageDeviceName}, $result->{storageDeviceState}));
|
||||
}
|
||||
|
||||
$exit = $self->get_severity(label => 'smart', section => 'device.smart', value => $result->{storageDeviceSmartHealth});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("storage device '%s' smart health state is '%s'", $result->{storageDeviceName}, $result->{storageDeviceSmartHealth}));
|
||||
}
|
||||
|
||||
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'device.temperature', instance => $instance, value => $result->{storageDeviceTemperature});
|
||||
if ($checked == 0) {
|
||||
my $warn_th = '';
|
||||
my $crit_th = defined($result->{storageDeviceTemperatureCritical}) ? $result->{storageDeviceTemperatureCritical} : '';
|
||||
$self->{perfdata}->threshold_validate(label => 'warning-device.temperature-instance-' . $instance, value => $warn_th);
|
||||
$self->{perfdata}->threshold_validate(label => 'critical-device.temperature-instance-' . $instance, value => $crit_th);
|
||||
|
||||
$exit = $self->{perfdata}->threshold_check(
|
||||
value => $result->{storageDeviceTemperature},
|
||||
threshold => [ { label => 'critical-device.temperature-instance-' . $instance, exit_litteral => 'critical' },
|
||||
{ label => 'warning-device.temperature-instance-' . $instance, exit_litteral => 'warning' } ]);
|
||||
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-device.temperature-instance-' . $instance);
|
||||
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-device.temperature-instance-' . $instance)
|
||||
}
|
||||
|
||||
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit2,
|
||||
short_msg => sprintf("storage device '%s' temperature is %s C", $result->{storageDeviceName}, $result->{storageDeviceTemperature}));
|
||||
}
|
||||
$self->{output}->perfdata_add(label => 'temp_' . $result->{storageDeviceName}, unit => 'C',
|
||||
value => $result->{storageDeviceTemperature},
|
||||
warning => $warn,
|
||||
critical => $crit,
|
||||
max => $result->{storageDeviceTemperatureLimit},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,97 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::snmp::mode::components::fan;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::hp::lefthand::snmp::mode::components::resources qw($map_status);
|
||||
|
||||
my $mapping = {
|
||||
infoFanName => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.111.1.2' },
|
||||
infoFanSpeed => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.111.1.3' }, # not defined
|
||||
infoFanMinSpeed => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.111.1.4' }, # not defined
|
||||
infoFanState => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.111.1.90' },
|
||||
infoFanStatus => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.111.1.91', map => $map_status },
|
||||
};
|
||||
my $oid_infoFanEntry = '.1.3.6.1.4.1.9804.3.1.1.2.1.111.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_infoFanEntry };
|
||||
}
|
||||
|
||||
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_infoFanEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{infoFanStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_infoFanEntry}, 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, state = %s, speed = %s]",
|
||||
$result->{infoFanName}, $result->{infoFanStatus}, $instance, $result->{infoFanState},
|
||||
defined($result->{infoFanSpeed}) ? $result->{infoFanSpeed} : '-'));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'fan', value => $result->{infoFanStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("fan '%s' state is '%s'", $result->{infoFanName}, $result->{infoFanState}));
|
||||
}
|
||||
|
||||
next if (!defined($result->{infoFanSpeed}) || $result->{infoFanSpeed} !~ /[0-9]/);
|
||||
|
||||
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => $instance, value => $result->{infoFanSpeed});
|
||||
if ($checked == 0) {
|
||||
my $warn_th = '';
|
||||
my $crit_th = defined($result->{infoFanMinSpeed}) ? $result->{infoFanMinSpeed} . ':' : '';
|
||||
$self->{perfdata}->threshold_validate(label => 'warning-fan-instance-' . $instance, value => $warn_th);
|
||||
$self->{perfdata}->threshold_validate(label => 'critical-fan-instance-' . $instance, value => $crit_th);
|
||||
|
||||
$exit = $self->{perfdata}->threshold_check(
|
||||
value => $result->{infoFanSpeed},
|
||||
threshold => [ { label => 'critical-fan-instance-' . $instance, exit_litteral => 'critical' },
|
||||
{ label => 'warning-fan-instance-' . $instance, exit_litteral => 'warning' } ]);
|
||||
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-fan-instance-' . $instance);
|
||||
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-fan-instance-' . $instance)
|
||||
}
|
||||
|
||||
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit2,
|
||||
short_msg => sprintf("fan '%s' speed is %s rpm", $result->{infoFanName}, $result->{infoFanSpeed}));
|
||||
}
|
||||
$self->{output}->perfdata_add(label => 'fan_' . $result->{infoFanName}, unit => 'rpm',
|
||||
value => $result->{infoFanSpeed},
|
||||
warning => $warn,
|
||||
critical => $crit,
|
||||
min => 0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,68 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::snmp::mode::components::psu;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::hp::lefthand::snmp::mode::components::resources qw($map_status);
|
||||
|
||||
my $mapping = {
|
||||
infoPowerSupplyName => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.131.1.2' },
|
||||
infoPowerSupplyState => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.131.1.90' },
|
||||
infoPowerSupplyStatus => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.131.1.91', map => $map_status },
|
||||
};
|
||||
my $oid_infoPowerSupplyEntry = '.1.3.6.1.4.1.9804.3.1.1.2.1.131.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_infoPowerSupplyEntry };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking power supplies");
|
||||
$self->{components}->{psu} = {name => 'psu', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'psu'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_infoPowerSupplyEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{infoPowerSupplyStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_infoPowerSupplyEntry}, 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, state: %s].",
|
||||
$result->{infoPowerSupplyName}, $result->{infoPowerSupplyStatus},
|
||||
$instance, $result->{infoPowerSupplyState}
|
||||
));
|
||||
my $exit = $self->get_severity(label => 'default', section => 'psu', value => $result->{infoPowerSupplyStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("power supply '%s' state is '%s'",
|
||||
$result->{infoPowerSupplyName}, $result->{infoPowerSupplyState}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,68 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::snmp::mode::components::rc;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::hp::lefthand::snmp::mode::components::resources qw($map_status);
|
||||
|
||||
my $mapping = {
|
||||
storageRaidDeviceName => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.4.1.2' },
|
||||
storageRaidDeviceState => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.4.1.90' },
|
||||
storageRaidDeviceStatus => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.4.1.91', map => $map_status },
|
||||
};
|
||||
my $oid_storageRaidEntry = '.1.3.6.1.4.1.9804.3.1.1.2.4.4.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_storageRaidEntry };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking raid controllers");
|
||||
$self->{components}->{rc} = {name => 'raid controllers', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'rc'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_storageRaidEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{storageRaidDeviceStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_storageRaidEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'rc', instance => $instance));
|
||||
$self->{components}->{rc}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("raid device controller '%s' status is '%s' [instance: %s, state: %s].",
|
||||
$result->{storageRaidDeviceName}, $result->{storageRaidDeviceStatus},
|
||||
$instance, $result->{storageRaidDeviceState}
|
||||
));
|
||||
my $exit = $self->get_severity(label => 'default', section => 'rc', value => $result->{storageRaidDeviceStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("raid device controller '%s' state is '%s'",
|
||||
$result->{storageRaidDeviceName}, $result->{storageRaidDeviceState}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,84 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::snmp::mode::components::rcc;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::hp::lefthand::snmp::mode::components::resources qw($map_status);
|
||||
|
||||
my $mapping = {
|
||||
infoCacheName => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.91.1.2' },
|
||||
infoCacheBbuState => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.91.1.22' },
|
||||
infoCacheBbuStatus => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.91.1.23', map => $map_status },
|
||||
infoCacheEnabled => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.91.1.50' },
|
||||
infoCacheState => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.91.1.90' },
|
||||
infoCacheStatus => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.91.1.91', map => $map_status },
|
||||
};
|
||||
my $oid_infoCacheEntry = '.1.3.6.1.4.1.9804.3.1.1.2.1.91.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_infoCacheEntry };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking raid controller caches");
|
||||
$self->{components}->{rcc} = {name => 'raid controller caches', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'rcc'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_infoCacheEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{infoCacheStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_infoCacheEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'rcc', instance => $instance));
|
||||
$self->{components}->{rcc}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("raid controller cache '%s' status is '%s' [instance: %s, state: %s].",
|
||||
$result->{infoCacheName}, $result->{infoCacheStatus},
|
||||
$instance, $result->{infoCacheState}
|
||||
));
|
||||
my $exit = $self->get_severity(label => 'default', section => 'rcc', value => $result->{infoCacheStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("raid controller cache '%s' state is '%s'",
|
||||
$result->{infoCacheName}, $result->{infoCacheState}));
|
||||
}
|
||||
|
||||
next if ($result->{infoCacheEnabled} != 1);
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("bbu '%s' status is '%s' [instance: %s, state: %s].",
|
||||
$result->{infoCacheName}, $result->{infoCacheBbuStatus},
|
||||
$instance, $result->{infoCacheBbuState}
|
||||
));
|
||||
$exit = $self->get_severity(label => 'default', section => 'bbu', value => $result->{infoCacheBbuStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("bbu '%s' state is '%s'",
|
||||
$result->{infoCacheName}, $result->{infoCacheBbuState}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,37 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::snmp::mode::components::resources;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Exporter;
|
||||
|
||||
our $map_status;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT_OK = qw($map_status);
|
||||
|
||||
$map_status = {
|
||||
1 => 'pass',
|
||||
2 => 'fail',
|
||||
};
|
||||
|
||||
1;
|
|
@ -0,0 +1,66 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::snmp::mode::components::ro;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $mapping = {
|
||||
storageOsRaidName => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.51.1.2' },
|
||||
storageOsRaidState => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.51.1.90' },
|
||||
};
|
||||
my $oid_storageOsRaidEntry = '.1.3.6.1.4.1.9804.3.1.1.2.4.51.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_storageOsRaidEntry };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking raid os devices");
|
||||
$self->{components}->{ro} = {name => 'raid os devices', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'ro'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_storageOsRaidEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{storageOsRaidState}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_storageOsRaidEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'ro', instance => $instance));
|
||||
$self->{components}->{ro}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("raid device controller '%s' state is '%s' [instance: %s].",
|
||||
$result->{storageOsRaidName}, $result->{storageOsRaidState},
|
||||
$instance
|
||||
));
|
||||
my $exit = $self->get_severity(label => 'default2', section => 'ro', value => $result->{storageOsRaidState});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("raid device controller '%s' state is '%s'",
|
||||
$result->{storageOsRaidName}, $result->{storageOsRaidState}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,98 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::snmp::mode::components::temperature;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::hp::lefthand::snmp::mode::components::resources qw($map_status);
|
||||
|
||||
my $mapping = {
|
||||
infoTemperatureSensorName => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.121.1.2' },
|
||||
infoTemperatureSensorValue => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.121.1.3' },
|
||||
infoTemperatureSensorCritical => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.121.1.4' },
|
||||
infoTemperatureSensorLimit => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.121.1.5' },
|
||||
infoTemperatureSensorState => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.121.1.90' },
|
||||
infoTemperatureSensorStatus => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.121.1.91', map => $map_status },
|
||||
};
|
||||
my $oid_infoTemperatureSensorEntry = '.1.3.6.1.4.1.9804.3.1.1.2.1.121.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_infoTemperatureSensorEntry };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking temperature sensors");
|
||||
$self->{components}->{temperature} = {name => 'temperature sensors', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'temperature'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_infoTemperatureSensorEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{infoTemperatureSensorStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_infoTemperatureSensorEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'temperature', instance => $instance));
|
||||
|
||||
$self->{components}->{temperature}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("temperature sensor '%s' status is '%s' [instance = %s, state = %s, temperature = %s]",
|
||||
$result->{infoTemperatureSensorName}, $result->{infoTemperatureSensorStatus}, $instance, $result->{infoTemperatureSensorState},
|
||||
defined($result->{infoTemperatureSensorValue}) ? $result->{infoTemperatureSensorValue} : '-'));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'temperature', value => $result->{infoTemperatureSensorStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("temperature sensor '%s' state is '%s'", $result->{infoTemperatureSensorName}, $result->{infoTemperatureSensorState}));
|
||||
}
|
||||
|
||||
next if (!defined($result->{infoTemperatureSensorValue}) || $result->{infoTemperatureSensorValue} !~ /[0-9]/);
|
||||
|
||||
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{infoTemperatureSensorValue});
|
||||
if ($checked == 0) {
|
||||
my $warn_th = '';
|
||||
my $crit_th = defined($result->{infoTemperatureSensorCritical}) ? $result->{infoTemperatureSensorCritical} : '';
|
||||
$self->{perfdata}->threshold_validate(label => 'warning-temperature-instance-' . $instance, value => $warn_th);
|
||||
$self->{perfdata}->threshold_validate(label => 'critical-temperature-instance-' . $instance, value => $crit_th);
|
||||
|
||||
$exit = $self->{perfdata}->threshold_check(
|
||||
value => $result->{infoTemperatureSensorValue},
|
||||
threshold => [ { label => 'critical-temperature-instance-' . $instance, exit_litteral => 'critical' },
|
||||
{ label => 'warning-temperature-instance-' . $instance, exit_litteral => 'warning' } ]);
|
||||
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-temperature-instance-' . $instance);
|
||||
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-temperature-instance-' . $instance)
|
||||
}
|
||||
|
||||
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit2,
|
||||
short_msg => sprintf("temperature sensor '%s' is %s C", $result->{infoTemperatureSensorName}, $result->{infoTemperatureSensorValue}));
|
||||
}
|
||||
$self->{output}->perfdata_add(label => 'temp_' . $result->{infoTemperatureSensorName}, unit => 'C',
|
||||
value => $result->{infoTemperatureSensorValue},
|
||||
warning => $warn,
|
||||
critical => $crit,
|
||||
max => $result->{infoTemperatureSensorLimit}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,98 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::snmp::mode::components::voltage;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use storage::hp::lefthand::snmp::mode::components::resources qw($map_status);
|
||||
|
||||
my $mapping = {
|
||||
infoVoltageSensorName => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.141.1.2' },
|
||||
infoVoltageSensorValue => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.141.1.3' },
|
||||
infoVoltageSensorLowLimit => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.141.1.4' },
|
||||
infoVoltageSensorHighLimit => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.141.1.5' },
|
||||
infoVoltageSensorState => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.141.1.90' },
|
||||
infoVoltageSensorStatus => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.1.141.1.91', map => $map_status },
|
||||
};
|
||||
my $oid_infoVoltageSensorEntry = '.1.3.6.1.4.1.9804.3.1.1.2.1.141.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_infoVoltageSensorEntry };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking voltages");
|
||||
$self->{components}->{voltage} = {name => 'voltages', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'voltage'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_infoVoltageSensorEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{infoTemperatureSensorStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_infoVoltageSensorEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'voltage', instance => $instance));
|
||||
|
||||
$self->{components}->{voltage}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("voltage sensor '%s' status is '%s' [instance = %s, state = %s, voltage = %s]",
|
||||
$result->{infoVoltageSensorName}, $result->{infoTemperatureSensorStatus}, $instance, $result->{infoVoltageSensorState},
|
||||
defined($result->{infoVoltageSensorValue}) ? $result->{infoVoltageSensorValue} : '-'));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'voltage', value => $result->{infoTemperatureSensorStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("voltage sensor '%s' state is '%s'", $result->{infoVoltageSensorName}, $result->{infoVoltageSensorState}));
|
||||
}
|
||||
|
||||
next if (!defined($result->{infoVoltageSensorValue}) || $result->{infoVoltageSensorValue} !~ /[0-9]/);
|
||||
|
||||
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'voltage', instance => $instance, value => $result->{infoVoltageSensorValue});
|
||||
if ($checked == 0) {
|
||||
my $warn_th = '';
|
||||
my $crit_th = $result->{infoVoltageSensorLowLimit} . ':' . $result->{infoVoltageSensorHighLimit};
|
||||
$self->{perfdata}->threshold_validate(label => 'warning-voltage-instance-' . $instance, value => $warn_th);
|
||||
$self->{perfdata}->threshold_validate(label => 'critical-voltage-instance-' . $instance, value => $crit_th);
|
||||
|
||||
$exit = $self->{perfdata}->threshold_check(
|
||||
value => $result->{infoVoltageSensorValue},
|
||||
threshold => [ { label => 'critical-voltage-instance-' . $instance, exit_litteral => 'critical' },
|
||||
{ label => 'warning-voltage-instance-' . $instance, exit_litteral => 'warning' } ]);
|
||||
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-voltage-instance-' . $instance);
|
||||
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-voltage-instance-' . $instance)
|
||||
}
|
||||
|
||||
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit2,
|
||||
short_msg => sprintf("voltage sensor '%s' is %s V", $result->{infoVoltageSensorName}, $result->{infoVoltageSensorValue}));
|
||||
}
|
||||
$self->{output}->perfdata_add(label => 'voltage_' . $result->{infoVoltageSensorName}, unit => 'V',
|
||||
value => $result->{infoVoltageSensorValue},
|
||||
warning => $warn,
|
||||
critical => $crit,
|
||||
min => 0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,120 @@
|
|||
#
|
||||
# Copyright 2017 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 storage::hp::lefthand::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|temperature|rcc|voltage|device||device\.smart|rc|ro|bbu)$';
|
||||
$self->{regexp_threshold_numeric_check_section_option} = '^(temperature|voltage|fan|device\.temperature)$';
|
||||
|
||||
$self->{cb_hook2} = 'snmp_execute';
|
||||
|
||||
$self->{thresholds} = {
|
||||
default => [
|
||||
['pass', 'OK'],
|
||||
['fail', 'CRITICAL'],
|
||||
],
|
||||
default2 => [
|
||||
['normal', 'OK'],
|
||||
['.*', 'CRITICAL'],
|
||||
],
|
||||
smart => [
|
||||
['normal', 'OK'],
|
||||
['marginal', 'WARNING'],
|
||||
['faulty', 'CRITICAL'],
|
||||
],
|
||||
};
|
||||
|
||||
$self->{components_path} = 'storage::hp::lefthand::snmp::mode::components';
|
||||
$self->{components_module} = ['fan', 'device', 'rc', 'temperature', 'voltage', 'psu', 'ro', 'rcc'];
|
||||
}
|
||||
|
||||
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);
|
||||
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', 'rcc', 'temperature', 'psu', 'voltage', 'device', 'rc', 'ro'.
|
||||
|
||||
=item B<--filter>
|
||||
|
||||
Exclude some parts (comma seperated list) (Example: --filter=fan --filter=psu)
|
||||
Can also exclude specific instance: --filter=fan,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='psu,CRITICAL,fail'
|
||||
|
||||
=item B<--warning>
|
||||
|
||||
Set warning threshold for 'temperature', 'voltage', 'fan', 'device.temperature' (syntax: type,regexp,threshold)
|
||||
Example: --warning='temperature,.*,30'
|
||||
|
||||
=item B<--critical>
|
||||
|
||||
Set critical threshold for 'temperature', 'voltage', 'fan', 'device.temperature' (syntax: type,regexp,threshold)
|
||||
Example: --critical='temperature,.*,50'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package storage::hp::lefthand::plugin;
|
||||
package storage::hp::lefthand::snmp::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
@ -31,7 +31,7 @@ sub new {
|
|||
|
||||
$self->{version} = '1.0';
|
||||
%{$self->{modes}} = (
|
||||
'hardware' => 'storage::hp::lefthand::mode::hardware',
|
||||
'hardware' => 'storage::hp::lefthand::snmp::mode::hardware',
|
||||
);
|
||||
|
||||
return $self;
|
Loading…
Reference in New Issue