mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-31 01:24:35 +02:00
enh(idrac/snmp): mode hardware - add health component (#3430)
This commit is contained in:
parent
33368c9f0a
commit
0944755a9f
@ -55,8 +55,9 @@ sub check {
|
|||||||
return if ($self->check_filter(section => 'amperage'));
|
return if ($self->check_filter(section => 'amperage'));
|
||||||
|
|
||||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_amperageProbeTableEntry}})) {
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_amperageProbeTableEntry}})) {
|
||||||
next if ($oid !~ /^$mapping->{amperageProbeStatus}->{oid}\.(.*)$/);
|
next if ($oid !~ /^$mapping->{amperageProbeStatus}->{oid}\.(\d+)\.(\d+)$/);
|
||||||
my $instance = $1;
|
my $instance = $1 . '.' . $2;
|
||||||
|
my $chassis_name = $self->get_chassis_name(id => $1);
|
||||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_amperageProbeTableEntry}, instance => $instance);
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_amperageProbeTableEntry}, instance => $instance);
|
||||||
|
|
||||||
next if ($self->check_filter(section => 'amperage', instance => $instance, name => $result->{amperageProbeLocationName}));
|
next if ($self->check_filter(section => 'amperage', instance => $instance, name => $result->{amperageProbeLocationName}));
|
||||||
@ -72,7 +73,7 @@ sub check {
|
|||||||
$result->{amperageProbeReading} = (defined($result->{amperageProbeReading})) ? $result->{amperageProbeReading} / $divisor : 'unknown';
|
$result->{amperageProbeReading} = (defined($result->{amperageProbeReading})) ? $result->{amperageProbeReading} / $divisor : 'unknown';
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"amperage '%s' status is '%s' [instance = %s] [state = %s] [value = %s]",
|
"amperage '%s' status is '%s' [instance: %s] [state: %s] [value: %s]",
|
||||||
$result->{amperageProbeLocationName}, $result->{amperageProbeStatus}, $instance,
|
$result->{amperageProbeLocationName}, $result->{amperageProbeStatus}, $instance,
|
||||||
$result->{amperageProbeStateSettings}, $result->{amperageProbeReading}
|
$result->{amperageProbeStateSettings}, $result->{amperageProbeReading}
|
||||||
)
|
)
|
||||||
@ -137,9 +138,9 @@ sub check {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'amperage', unit => $unit,
|
|
||||||
nlabel => 'hardware.probe.amperage.' . ($unit eq 'A' ? 'ampere' : 'watt'),
|
nlabel => 'hardware.probe.amperage.' . ($unit eq 'A' ? 'ampere' : 'watt'),
|
||||||
instances => $result->{amperageProbeLocationName},
|
unit => $unit,
|
||||||
|
instances => [$chassis_name, $result->{amperageProbeLocationName}],
|
||||||
value => $result->{amperageProbeReading},
|
value => $result->{amperageProbeReading},
|
||||||
warning => $warn,
|
warning => $warn,
|
||||||
critical => $crit
|
critical => $crit
|
||||||
|
@ -54,17 +54,18 @@ sub check {
|
|||||||
return if ($self->check_filter(section => 'coolingdevice'));
|
return if ($self->check_filter(section => 'coolingdevice'));
|
||||||
|
|
||||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_coolingDeviceTableEntry}})) {
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_coolingDeviceTableEntry}})) {
|
||||||
next if ($oid !~ /^$mapping->{coolingDeviceStatus}->{oid}\.(.*)$/);
|
next if ($oid !~ /^$mapping->{coolingDeviceStatus}->{oid}\.(\d+)\.(\d+)$/);
|
||||||
my $instance = $1;
|
my $instance = $1 . '.' . $2;
|
||||||
|
my $chassis_name = $self->get_chassis_name(id => $1);
|
||||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_coolingDeviceTableEntry}, instance => $instance);
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_coolingDeviceTableEntry}, instance => $instance);
|
||||||
|
|
||||||
next if ($self->check_filter(section => 'coolingdevice', instance => $instance, name => $result->{coolingDeviceLocationName}));
|
next if ($self->check_filter(section => 'coolingdevice', instance => $instance, name => $result->{coolingDeviceLocationName}));
|
||||||
$self->{components}->{coolingdevice}->{total}++;
|
$self->{components}->{coolingdevice}->{total}++;
|
||||||
|
|
||||||
$result->{coolingDeviceReading} = (defined($result->{coolingDeviceReading})) ? $result->{coolingDeviceReading} : 'unknown';
|
$result->{coolingDeviceReading} = (defined($result->{coolingDeviceReading})) ? $result->{coolingDeviceReading} : 'unknown';
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"cooling device '%s' status is '%s' [instance = %s] [state = %s] [value = %s]",
|
"cooling device '%s' status is '%s' [instance: %s] [state: %s] [value: %s]",
|
||||||
$result->{coolingDeviceLocationName}, $result->{coolingDeviceStatus}, $instance,
|
$result->{coolingDeviceLocationName}, $result->{coolingDeviceStatus}, $instance,
|
||||||
$result->{coolingDeviceStateSettings}, $result->{coolingDeviceReading}
|
$result->{coolingDeviceStateSettings}, $result->{coolingDeviceReading}
|
||||||
)
|
)
|
||||||
@ -126,12 +127,12 @@ sub check {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'fan', unit => 'rpm',
|
|
||||||
nlabel => 'hardware.fan.speed.rpm',
|
nlabel => 'hardware.fan.speed.rpm',
|
||||||
instances => $result->{coolingDeviceLocationName},
|
unit => 'rpm',
|
||||||
|
instances => [$chassis_name, $result->{coolingDeviceLocationName}],
|
||||||
value => $result->{coolingDeviceReading},
|
value => $result->{coolingDeviceReading},
|
||||||
warning => $warn,
|
warning => $warn,
|
||||||
critical => $crit,
|
critical => $crit
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ sub check {
|
|||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"cooling unit '%s' status is '%s' [instance = %s] [state = %s]",
|
"cooling unit '%s' status is '%s' [instance: %s] [state: %s]",
|
||||||
$result->{coolingUnitName}, $result->{coolingUnitStatus}, $instance,
|
$result->{coolingUnitName}, $result->{coolingUnitStatus}, $instance,
|
||||||
$result->{coolingUnitStateSettings}
|
$result->{coolingUnitStateSettings}
|
||||||
)
|
)
|
||||||
|
@ -58,7 +58,7 @@ sub check {
|
|||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"enclosure '%s' status is '%s' [instance = %s] [state = %s]",
|
"enclosure '%s' status is '%s' [instance: %s] [state: %s]",
|
||||||
$result->{enclosureName}, $result->{enclosureRollUpStatus}, $instance,
|
$result->{enclosureName}, $result->{enclosureRollUpStatus}, $instance,
|
||||||
$result->{enclosureState}
|
$result->{enclosureState}
|
||||||
)
|
)
|
||||||
|
@ -57,7 +57,7 @@ sub check {
|
|||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"fru '%s' status is '%s' [instance = %s]",
|
"fru '%s' status is '%s' [instance: %s]",
|
||||||
$result->{fruSerialNumberName}, $result->{fruInformationStatus}, $instance,
|
$result->{fruSerialNumberName}, $result->{fruInformationStatus}, $instance,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
93
hardware/server/dell/idrac/snmp/mode/components/health.pm
Normal file
93
hardware/server/dell/idrac/snmp/mode/components/health.pm
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
#
|
||||||
|
# Copyright 2022 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 hardware::server::dell::idrac::snmp::mode::components::health;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_status);
|
||||||
|
|
||||||
|
my $mapping_health = {
|
||||||
|
psuComb => { oid => '.1.3.6.1.4.1.674.10892.5.4.200.10.1.9', map => \%map_status, label => 'psuAll' }, # systemStatePowerSupplyStatusCombined
|
||||||
|
voltageComb => { oid => '.1.3.6.1.4.1.674.10892.5.4.200.10.1.12', map => \%map_status, label => 'voltageAll' }, # systemStateVoltageStatusCombined
|
||||||
|
amperageComb => { oid => '.1.3.6.1.4.1.674.10892.5.4.200.10.1.15', map => \%map_status, label => 'amperageAll' }, # systemStateAmperageStatusCombined
|
||||||
|
coolingDevComb => { oid => '.1.3.6.1.4.1.674.10892.5.4.200.10.1.21', map => \%map_status, label => 'coolingDeviceAll' }, # systemStateCoolingDeviceStatusCombined
|
||||||
|
tempComb => { oid => '.1.3.6.1.4.1.674.10892.5.4.200.10.1.24', map => \%map_status, label => 'temperatureAll' }, # systemStateTemperatureStatusCombined
|
||||||
|
memoryComb => { oid => '.1.3.6.1.4.1.674.10892.5.4.200.10.1.27', map => \%map_status, label => 'memoryAll' }, # systemStateMemoryDeviceStatusCombined
|
||||||
|
intrusionComb => { oid => '.1.3.6.1.4.1.674.10892.5.4.200.10.1.30', map => \%map_status, label => 'intrusionAll' }, # systemStateChassisIntrusionStatusCombined
|
||||||
|
powerComb => { oid => '.1.3.6.1.4.1.674.10892.5.4.200.10.1.42', map => \%map_status, label => 'powerUnitAll' }, # systemStatePowerUnitStatusCombined
|
||||||
|
coolingUnitComb => { oid => '.1.3.6.1.4.1.674.10892.5.4.200.10.1.44', map => \%map_status, label => 'coolingUnitAll' }, # systemStateCoolingUnitStatusCombined
|
||||||
|
processorComb => { oid => '.1.3.6.1.4.1.674.10892.5.4.200.10.1.50', map => \%map_status, label => 'processorAll' }, # systemStateProcessorDeviceStatusCombined
|
||||||
|
batteryComb => { oid => '.1.3.6.1.4.1.674.10892.5.4.200.10.1.52', map => \%map_status, label => 'batteryAll' }, # systemStateBatteryStatusCombined
|
||||||
|
sdCardUnitComb => { oid => '.1.3.6.1.4.1.674.10892.5.4.200.10.1.54', map => \%map_status, label => 'sdCardUnitAll' }, # systemStateSDCardUnitStatusCombined
|
||||||
|
sdCardDevComb => { oid => '.1.3.6.1.4.1.674.10892.5.4.200.10.1.56', map => \%map_status, label => 'sdCardDeviceAll' }, # systemStateSDCardDeviceStatusCombined
|
||||||
|
idsmCardDevComb => { oid => '.1.3.6.1.4.1.674.10892.5.4.200.10.1.60', map => \%map_status, label => 'idsmCardDeviceAll' } # systemStateIDSDMCardDeviceStatusCombined
|
||||||
|
};
|
||||||
|
|
||||||
|
sub load {}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking health");
|
||||||
|
$self->{components}->{health} = { name => 'health', total => 0, skip => 0 };
|
||||||
|
return if ($self->check_filter(section => 'health'));
|
||||||
|
|
||||||
|
my $instances = $self->get_chassis_instances();
|
||||||
|
|
||||||
|
return if (scalar(@$instances) <= 0);
|
||||||
|
|
||||||
|
$self->{snmp}->load(
|
||||||
|
oids => [map($_->{oid}, values(%$mapping_health))],
|
||||||
|
instances => $instances
|
||||||
|
);
|
||||||
|
my $results = $self->{snmp}->get_leef();
|
||||||
|
|
||||||
|
foreach my $instance (@$instances) {
|
||||||
|
my $result = $self->{snmp}->map_instance(mapping => $mapping_health, results => $results, instance => $instance);
|
||||||
|
my $chassis_name = $self->get_chassis_name(id => $instance);
|
||||||
|
|
||||||
|
foreach (keys %$mapping_health) {
|
||||||
|
next if (!defined($result->{$_}));
|
||||||
|
|
||||||
|
my $name = $chassis_name . ':' . $mapping_health->{$_}->{label};
|
||||||
|
next if ($self->check_filter(section => 'health', instance => $instance));
|
||||||
|
$self->{components}->{health}->{total}++;
|
||||||
|
|
||||||
|
$self->{output}->output_add(
|
||||||
|
long_msg => sprintf(
|
||||||
|
"health '%s' status is %s [instance: %s]",
|
||||||
|
$name,
|
||||||
|
$result->{$_},
|
||||||
|
$instance
|
||||||
|
)
|
||||||
|
);
|
||||||
|
my $exit = $self->get_severity(label => 'default.status', section => 'health', value => $result->{$_});
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(
|
||||||
|
severity => $exit,
|
||||||
|
short_msg => sprintf("Health '%s' status is %s", $name, $result->{$_})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
@ -58,7 +58,7 @@ sub check {
|
|||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"memory '%s' status is '%s' [instance = %s] [state = %s]",
|
"memory '%s' status is '%s' [instance: %s] [state: %s]",
|
||||||
$result->{memoryDeviceLocationName}, $result->{memoryDeviceStatus}, $instance,
|
$result->{memoryDeviceLocationName}, $result->{memoryDeviceStatus}, $instance,
|
||||||
$result->{memoryDeviceStateSettings}
|
$result->{memoryDeviceStateSettings}
|
||||||
)
|
)
|
||||||
|
@ -57,7 +57,7 @@ sub check {
|
|||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"network '%s' status is '%s' [instance = %s]",
|
"network '%s' status is '%s' [instance: %s]",
|
||||||
$result->{networkDeviceProductName}, $result->{networkDeviceStatus}, $instance
|
$result->{networkDeviceProductName}, $result->{networkDeviceStatus}, $instance
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -58,7 +58,7 @@ sub check {
|
|||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"pci '%s' status is '%s' [instance = %s] [state = %s]",
|
"pci '%s' status is '%s' [instance: %s] [state: %s]",
|
||||||
$result->{pCIDeviceDescriptionName}, $result->{pCIDeviceStatus}, $instance,
|
$result->{pCIDeviceDescriptionName}, $result->{pCIDeviceStatus}, $instance,
|
||||||
$result->{pCIDeviceStateSettings}
|
$result->{pCIDeviceStateSettings}
|
||||||
)
|
)
|
||||||
|
@ -73,7 +73,7 @@ sub check {
|
|||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"physical disk '%s' status is '%s' [instance = %s] [state = %s] [smart alert = %s]",
|
"physical disk '%s' status is '%s' [instance: %s] [state: %s] [smart alert: %s]",
|
||||||
$result->{physicalDiskFQDD}, $result->{physicalDiskComponentStatus}, $instance,
|
$result->{physicalDiskFQDD}, $result->{physicalDiskComponentStatus}, $instance,
|
||||||
$result->{physicalDiskState}, $result->{physicalDiskSmartAlertIndication}
|
$result->{physicalDiskState}, $result->{physicalDiskSmartAlertIndication}
|
||||||
)
|
)
|
||||||
|
@ -58,7 +58,7 @@ sub check {
|
|||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"processor '%s' status is '%s' [instance = %s] [state = %s]",
|
"processor '%s' status is '%s' [instance: %s] [state: %s]",
|
||||||
$result->{processorDeviceFQDD}, $result->{processorDeviceStatus}, $instance,
|
$result->{processorDeviceFQDD}, $result->{processorDeviceStatus}, $instance,
|
||||||
$result->{processorDeviceStateSettings}
|
$result->{processorDeviceStateSettings}
|
||||||
)
|
)
|
||||||
|
@ -57,7 +57,7 @@ sub check {
|
|||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"power supply '%s' status is '%s' [instance = %s]",
|
"power supply '%s' status is '%s' [instance: %s]",
|
||||||
$result->{powerSupplyLocationName}, $result->{powerSupplyStatus}, $instance
|
$result->{powerSupplyLocationName}, $result->{powerSupplyStatus}, $instance
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -58,7 +58,7 @@ sub check {
|
|||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"power unit '%s' status is '%s' [instance = %s] [state = %s]",
|
"power unit '%s' status is '%s' [instance: %s] [state: %s]",
|
||||||
$result->{powerUnitName}, $result->{powerUnitStatus}, $instance,
|
$result->{powerUnitName}, $result->{powerUnitStatus}, $instance,
|
||||||
$result->{powerUnitStateSettings}
|
$result->{powerUnitStateSettings}
|
||||||
)
|
)
|
||||||
|
@ -57,7 +57,7 @@ sub check {
|
|||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"slot '%s' status is '%s' [instance = %s]",
|
"slot '%s' status is '%s' [instance: %s]",
|
||||||
$result->{systemSlotSlotExternalSlotName}, $result->{systemSlotStatus}, $instance
|
$result->{systemSlotSlotExternalSlotName}, $result->{systemSlotStatus}, $instance
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -53,7 +53,7 @@ sub check {
|
|||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"storage battery '%s' status is '%s' [instance = %s]",
|
"storage battery '%s' status is '%s' [instance: %s]",
|
||||||
$result->{batteryFQDD}, $result->{batteryComponentStatus}, $instance
|
$result->{batteryFQDD}, $result->{batteryComponentStatus}, $instance
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -53,7 +53,7 @@ sub check {
|
|||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"storage controller '%s' status is '%s' [instance = %s]",
|
"storage controller '%s' status is '%s' [instance: %s]",
|
||||||
$result->{controllerFQDD}, $result->{controllerComponentStatus}, $instance
|
$result->{controllerFQDD}, $result->{controllerComponentStatus}, $instance
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -58,7 +58,7 @@ sub check {
|
|||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"system battery '%s' status is '%s' [instance = %s] [state = %s]",
|
"system battery '%s' status is '%s' [instance: %s] [state: %s]",
|
||||||
$result->{systemBatteryLocationName},
|
$result->{systemBatteryLocationName},
|
||||||
$result->{systemBatteryStatus}, $instance,
|
$result->{systemBatteryStatus}, $instance,
|
||||||
$result->{systemBatteryStateSettings}
|
$result->{systemBatteryStateSettings}
|
||||||
|
@ -62,8 +62,9 @@ sub check {
|
|||||||
return if ($self->check_filter(section => 'temperature'));
|
return if ($self->check_filter(section => 'temperature'));
|
||||||
|
|
||||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_temperatureProbeTableEntry}})) {
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_temperatureProbeTableEntry}})) {
|
||||||
next if ($oid !~ /^$mapping->{temperatureProbeStatus}->{oid}\.(.*)$/);
|
next if ($oid !~ /^$mapping->{temperatureProbeStatus}->{oid}\.(\d+)\.(\d+)$/);
|
||||||
my $instance = $1;
|
my $instance = $1 . '.' . $2;
|
||||||
|
my $chassis_name = $self->get_chassis_name(id => $1);
|
||||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_temperatureProbeTableEntry}, instance => $instance);
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_temperatureProbeTableEntry}, instance => $instance);
|
||||||
|
|
||||||
next if ($self->check_filter(section => 'temperature', instance => $instance, name => $result->{temperatureProbeLocationName}));
|
next if ($self->check_filter(section => 'temperature', instance => $instance, name => $result->{temperatureProbeLocationName}));
|
||||||
@ -72,7 +73,7 @@ sub check {
|
|||||||
$result->{temperatureProbeReading} = (defined($result->{temperatureProbeReading})) ? $result->{temperatureProbeReading} / 10 : 'unknown';
|
$result->{temperatureProbeReading} = (defined($result->{temperatureProbeReading})) ? $result->{temperatureProbeReading} / 10 : 'unknown';
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"temperature '%s' status is '%s' [instance = %s] [state = %s] [value = %s]",
|
"temperature '%s' status is '%s' [instance: %s] [state: %s] [value: %s]",
|
||||||
$result->{temperatureProbeLocationName}, $result->{temperatureProbeStatus}, $instance,
|
$result->{temperatureProbeLocationName}, $result->{temperatureProbeStatus}, $instance,
|
||||||
$result->{temperatureProbeStateSettings}, $result->{temperatureProbeReading}
|
$result->{temperatureProbeStateSettings}, $result->{temperatureProbeReading}
|
||||||
)
|
)
|
||||||
@ -140,9 +141,9 @@ sub check {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'temp', unit => 'C',
|
|
||||||
nlabel => 'hardware.probe.temperature.celsius',
|
nlabel => 'hardware.probe.temperature.celsius',
|
||||||
instances => $result->{temperatureProbeLocationName},
|
unit => 'C',
|
||||||
|
instances => [$chassis_name, $result->{temperatureProbeLocationName}],
|
||||||
value => $result->{temperatureProbeReading},
|
value => $result->{temperatureProbeReading},
|
||||||
warning => $warn,
|
warning => $warn,
|
||||||
critical => $crit
|
critical => $crit
|
||||||
|
@ -53,7 +53,7 @@ sub check {
|
|||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"virtual disk '%s' state is '%s' [instance = %s]",
|
"virtual disk '%s' state is '%s' [instance: %s]",
|
||||||
$result->{virtualDiskFQDD}, $result->{virtualDiskState}, $instance
|
$result->{virtualDiskFQDD}, $result->{virtualDiskState}, $instance
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -54,8 +54,9 @@ sub check {
|
|||||||
return if ($self->check_filter(section => 'voltage'));
|
return if ($self->check_filter(section => 'voltage'));
|
||||||
|
|
||||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_voltageProbeTableEntry}})) {
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_voltageProbeTableEntry}})) {
|
||||||
next if ($oid !~ /^$mapping->{voltageProbeStatus}->{oid}\.(.*)$/);
|
next if ($oid !~ /^$mapping->{voltageProbeStatus}->{oid}\.(\d+)\.(\d+)$/);
|
||||||
my $instance = $1;
|
my $instance = $1 . '.' . $2;
|
||||||
|
my $chassis_name = $self->get_chassis_name(id => $1);
|
||||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_voltageProbeTableEntry}, instance => $instance);
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_voltageProbeTableEntry}, instance => $instance);
|
||||||
|
|
||||||
next if ($self->check_filter(section => 'voltage', instance => $instance, name => $result->{voltageProbeLocationName}));
|
next if ($self->check_filter(section => 'voltage', instance => $instance, name => $result->{voltageProbeLocationName}));
|
||||||
@ -64,7 +65,7 @@ sub check {
|
|||||||
$result->{voltageProbeReading} = (defined($result->{voltageProbeReading})) ? $result->{voltageProbeReading} / 1000 : 'unknown';
|
$result->{voltageProbeReading} = (defined($result->{voltageProbeReading})) ? $result->{voltageProbeReading} / 1000 : 'unknown';
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"voltage '%s' status is '%s' [instance = %s] [state = %s] [value = %s]",
|
"voltage '%s' status is '%s' [instance: %s] [state: %s] [value: %s]",
|
||||||
$result->{voltageProbeLocationName}, $result->{voltageProbeStatus}, $instance,
|
$result->{voltageProbeLocationName}, $result->{voltageProbeStatus}, $instance,
|
||||||
$result->{voltageProbeStateSettings}, $result->{voltageProbeReading}
|
$result->{voltageProbeStateSettings}, $result->{voltageProbeReading}
|
||||||
)
|
)
|
||||||
@ -132,9 +133,9 @@ sub check {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'voltage', unit => 'V',
|
|
||||||
nlabel => 'hardware.probe.voltage.volt',
|
nlabel => 'hardware.probe.voltage.volt',
|
||||||
instances => $result->{voltageProbeLocationName},
|
unit => 'V',
|
||||||
|
instances => [$chassis_name, $result->{voltageProbeLocationName}],
|
||||||
value => $result->{voltageProbeReading},
|
value => $result->{voltageProbeReading},
|
||||||
warning => $warn,
|
warning => $warn,
|
||||||
critical => $crit
|
critical => $crit
|
||||||
|
@ -94,23 +94,49 @@ sub set_system {
|
|||||||
|
|
||||||
$self->{components_path} = 'hardware::server::dell::idrac::snmp::mode::components';
|
$self->{components_path} = 'hardware::server::dell::idrac::snmp::mode::components';
|
||||||
$self->{components_module} = [
|
$self->{components_module} = [
|
||||||
'amperage', 'coolingdevice', 'coolingunit', 'enclosure',
|
'amperage', 'coolingdevice', 'coolingunit', 'enclosure', 'health',
|
||||||
'fru', 'memory', 'network', 'pci', 'pdisk',
|
'fru', 'memory', 'network', 'pci', 'pdisk',
|
||||||
'processor', 'psu', 'punit', 'slot', 'storagebattery',
|
'processor', 'psu', 'punit', 'slot', 'storagebattery',
|
||||||
'storagectrl', 'systembattery', 'temperature', 'voltage', 'vdisk'
|
'storagectrl', 'systembattery', 'temperature', 'voltage', 'vdisk'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $oid_chassisName = '.1.3.6.1.4.1.674.10892.5.4.300.10.1.7';
|
||||||
|
|
||||||
sub snmp_execute {
|
sub snmp_execute {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{snmp} = $options{snmp};
|
$self->{snmp} = $options{snmp};
|
||||||
|
push @{$self->{request}}, { oid => $oid_chassisName };
|
||||||
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
|
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub get_chassis_name {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my $name = 'unknown';
|
||||||
|
if (defined($self->{results}->{$oid_chassisName}->{ $oid_chassisName . '.' . $options{id} })) {
|
||||||
|
$name = $self->{results}->{$oid_chassisName}->{ $oid_chassisName . '.' . $options{id} }
|
||||||
|
}
|
||||||
|
|
||||||
|
return $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_chassis_instances {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my $instances = [];
|
||||||
|
foreach (keys %{$self->{results}->{$oid_chassisName}}) {
|
||||||
|
/\.(\d+)$/;
|
||||||
|
push @$instances, $1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $instances;
|
||||||
|
}
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {});
|
$options{options}->add_options(arguments => {});
|
||||||
@ -132,7 +158,7 @@ Check hardware components.
|
|||||||
|
|
||||||
Which component to check (Default: '.*').
|
Which component to check (Default: '.*').
|
||||||
Can be: 'amperage', 'coolingdevice', 'coolingunit', 'enclosure',
|
Can be: 'amperage', 'coolingdevice', 'coolingunit', 'enclosure',
|
||||||
'fru', 'memory', 'network', 'pci', 'pdisk',
|
'health', 'fru', 'memory', 'network', 'pci', 'pdisk',
|
||||||
'processor', 'psu', 'punit', 'slot', 'storagebattery',
|
'processor', 'psu', 'punit', 'slot', 'storagebattery',
|
||||||
'storagectrl', 'systembattery', 'temperature', 'voltage', 'vdisk'.
|
'storagectrl', 'systembattery', 'temperature', 'voltage', 'vdisk'.
|
||||||
|
|
||||||
@ -169,4 +195,3 @@ Example: --critical='temperature,.*,40'
|
|||||||
=back
|
=back
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user