Merge pull request #2396 from centreon/fix-pr-2381

Fix #2381
This commit is contained in:
qgarnier 2020-12-01 15:23:41 +01:00 committed by GitHub
commit 0526cde58e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 390 additions and 148 deletions

View File

@ -33,7 +33,7 @@ my $mapping = {
amperageProbeUpperCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.30.1.10' }, amperageProbeUpperCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.30.1.10' },
amperageProbeUpperNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.30.1.11' }, amperageProbeUpperNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.30.1.11' },
amperageProbeLowerNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.30.1.12' }, amperageProbeLowerNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.30.1.12' },
amperageProbeLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.30.1.13' }, amperageProbeLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.30.1.13' }
}; };
my $oid_amperageProbeTableEntry = '.1.3.6.1.4.1.674.10892.5.4.600.30.1'; my $oid_amperageProbeTableEntry = '.1.3.6.1.4.1.674.10892.5.4.600.30.1';
@ -70,21 +70,30 @@ sub check {
$divisor = 1; $divisor = 1;
} }
$result->{amperageProbeReading} = (defined($result->{amperageProbeReading})) ? $result->{amperageProbeReading} / $divisor : 'unknown'; $result->{amperageProbeReading} = (defined($result->{amperageProbeReading})) ? $result->{amperageProbeReading} / $divisor : 'unknown';
$self->{output}->output_add(long_msg => sprintf("amperage '%s' status is '%s' [instance = %s] [state = %s] [value = %s]", $self->{output}->output_add(
$result->{amperageProbeLocationName}, $result->{amperageProbeStatus}, $instance, long_msg => sprintf(
$result->{amperageProbeStateSettings}, $result->{amperageProbeReading})); "amperage '%s' status is '%s' [instance = %s] [state = %s] [value = %s]",
$result->{amperageProbeLocationName}, $result->{amperageProbeStatus}, $instance,
$result->{amperageProbeStateSettings}, $result->{amperageProbeReading}
)
);
my $exit = $self->get_severity(label => 'default.state', section => 'amperage.state', value => $result->{amperageProbeStateSettings}); my $exit = $self->get_severity(label => 'default.state', section => 'amperage.state', value => $result->{amperageProbeStateSettings});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Amperage '%s' state is '%s'", $result->{amperageProbeLocationName}, $result->{amperageProbeStateSettings})); severity => $exit,
short_msg => sprintf("Amperage '%s' state is '%s'", $result->{amperageProbeLocationName}, $result->{amperageProbeStateSettings})
);
next; next;
} }
$exit = $self->get_severity(label => 'probe.status', section => 'amperage.status', value => $result->{amperageProbeStatus}); $exit = $self->get_severity(label => 'probe.status', section => 'amperage.status', value => $result->{amperageProbeStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Amperage '%s' status is '%s'", $result->{amperageProbeLocationName}, $result->{amperageProbeStatus})); severity => $exit,
short_msg => sprintf(
"Amperage '%s' status is '%s'", $result->{amperageProbeLocationName}, $result->{amperageProbeStatus})
);
} }
next if ($result->{amperageProbeType} =~ /amperageProbeTypeIsDiscrete/); next if ($result->{amperageProbeType} =~ /amperageProbeTypeIsDiscrete/);
@ -105,15 +114,22 @@ sub check {
$self->{perfdata}->threshold_validate(label => 'warning-amperage-instance-' . $instance, value => $warn_th); $self->{perfdata}->threshold_validate(label => 'warning-amperage-instance-' . $instance, value => $warn_th);
$self->{perfdata}->threshold_validate(label => 'critical-amperage-instance-' . $instance, value => $crit_th); $self->{perfdata}->threshold_validate(label => 'critical-amperage-instance-' . $instance, value => $crit_th);
$exit = $self->{perfdata}->threshold_check(value => $result->{amperageProbeReading}, threshold => [ { label => 'critical-amperage-instance-' . $instance, exit_litteral => 'critical' }, $exit = $self->{perfdata}->threshold_check(
{ label => 'warning-amperage-instance-' . $instance, exit_litteral => 'warning' } ]); value => $result->{amperageProbeReading},
threshold => [
{ label => 'critical-amperage-instance-' . $instance, exit_litteral => 'critical' },
{ label => 'warning-amperage-instance-' . $instance, exit_litteral => 'warning' }
]
);
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-amperage-instance-' . $instance); $warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-amperage-instance-' . $instance);
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-amperage-instance-' . $instance); $crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-amperage-instance-' . $instance);
} }
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Amperage '%s' is %s %s", $result->{amperageProbeLocationName}, $result->{amperageProbeReading}, $unit)); severity => $exit,
short_msg => sprintf("Amperage '%s' is %s %s", $result->{amperageProbeLocationName}, $result->{amperageProbeReading}, $unit)
);
} }
$self->{output}->perfdata_add( $self->{output}->perfdata_add(
label => 'amperage', unit => $unit, label => 'amperage', unit => $unit,
@ -121,7 +137,7 @@ sub check {
instances => $result->{amperageProbeLocationName}, instances => $result->{amperageProbeLocationName},
value => $result->{amperageProbeReading}, value => $result->{amperageProbeReading},
warning => $warn, warning => $warn,
critical => $crit, critical => $crit
); );
} }
} }

View File

@ -32,7 +32,7 @@ my $mapping = {
coolingDeviceUpperCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.10' }, coolingDeviceUpperCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.10' },
coolingDeviceUpperNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.11' }, coolingDeviceUpperNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.11' },
coolingDeviceLowerNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.12' }, coolingDeviceLowerNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.12' },
coolingDeviceLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.12.1.13' }, coolingDeviceLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.12.1.13' }
}; };
my $oid_coolingDeviceTableEntry = '.1.3.6.1.4.1.674.10892.5.4.700.12.1'; my $oid_coolingDeviceTableEntry = '.1.3.6.1.4.1.674.10892.5.4.700.12.1';
@ -62,10 +62,14 @@ sub check {
$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(long_msg => sprintf("cooling device '%s' status is '%s' [instance = %s] [state = %s] [value = %s]", $self->{output}->output_add(
$result->{coolingDeviceLocationName}, $result->{coolingDeviceStatus}, $instance, long_msg => sprintf(
$result->{coolingDeviceStateSettings}, $result->{coolingDeviceReading})); "cooling device '%s' status is '%s' [instance = %s] [state = %s] [value = %s]",
$result->{coolingDeviceLocationName}, $result->{coolingDeviceStatus}, $instance,
$result->{coolingDeviceStateSettings}, $result->{coolingDeviceReading}
)
);
my $exit = $self->get_severity(label => 'default.state', section => 'coolingdevice.state', value => $result->{coolingDeviceStateSettings}); my $exit = $self->get_severity(label => 'default.state', section => 'coolingdevice.state', value => $result->{coolingDeviceStateSettings});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(severity => $exit,
@ -75,8 +79,10 @@ sub check {
$exit = $self->get_severity(label => 'probe.status', section => 'coolingdevice.status', value => $result->{coolingDeviceStatus}); $exit = $self->get_severity(label => 'probe.status', section => 'coolingdevice.status', value => $result->{coolingDeviceStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Cooling device '%s' status is '%s'", $result->{coolingDeviceLocationName}, $result->{coolingDeviceStatus})); severity => $exit,
short_msg => sprintf("Cooling device '%s' status is '%s'", $result->{coolingDeviceLocationName}, $result->{coolingDeviceStatus})
);
} }
if (defined($result->{coolingDeviceReading}) && $result->{coolingDeviceReading} =~ /[0-9]/) { if (defined($result->{coolingDeviceReading}) && $result->{coolingDeviceReading} =~ /[0-9]/) {
@ -95,15 +101,22 @@ sub check {
$self->{perfdata}->threshold_validate(label => 'warning-coolingdevice-instance-' . $instance, value => $warn_th); $self->{perfdata}->threshold_validate(label => 'warning-coolingdevice-instance-' . $instance, value => $warn_th);
$self->{perfdata}->threshold_validate(label => 'critical-coolingdevice-instance-' . $instance, value => $crit_th); $self->{perfdata}->threshold_validate(label => 'critical-coolingdevice-instance-' . $instance, value => $crit_th);
$exit = $self->{perfdata}->threshold_check(value => $result->{coolingDeviceReading}, threshold => [ { label => 'critical-coolingdevice-instance-' . $instance, exit_litteral => 'critical' }, $exit = $self->{perfdata}->threshold_check(
{ label => 'warning-coolingdevice-instance-' . $instance, exit_litteral => 'warning' } ]); value => $result->{coolingDeviceReading},
threshold => [
{ label => 'critical-coolingdevice-instance-' . $instance, exit_litteral => 'critical' },
{ label => 'warning-coolingdevice-instance-' . $instance, exit_litteral => 'warning' }
]
);
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-coolingdevice-instance-' . $instance); $warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-coolingdevice-instance-' . $instance);
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-coolingdevice-instance-' . $instance); $crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-coolingdevice-instance-' . $instance);
} }
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Cooling device '%s' is %s rpm", $result->{coolingDeviceLocationName}, $result->{coolingDeviceReading})); severity => $exit,
short_msg => sprintf("Cooling device '%s' is %s rpm", $result->{coolingDeviceLocationName}, $result->{coolingDeviceReading})
);
} }
$self->{output}->perfdata_add( $self->{output}->perfdata_add(
label => 'fan', unit => 'rpm', label => 'fan', unit => 'rpm',

View File

@ -27,7 +27,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta
my $mapping = { my $mapping = {
coolingUnitStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.10.1.4', map => \%map_state }, coolingUnitStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.10.1.4', map => \%map_state },
coolingUnitName => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.10.1.7' }, coolingUnitName => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.10.1.7' },
coolingUnitStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.10.1.8', map => \%map_status }, coolingUnitStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.10.1.8', map => \%map_status }
}; };
my $oid_coolingUnitTableEntry = '.1.3.6.1.4.1.674.10892.5.4.700.10.1'; my $oid_coolingUnitTableEntry = '.1.3.6.1.4.1.674.10892.5.4.700.10.1';
@ -56,21 +56,29 @@ sub check {
next if ($self->check_filter(section => 'coolingunit', instance => $instance)); next if ($self->check_filter(section => 'coolingunit', instance => $instance));
$self->{components}->{coolingunit}->{total}++; $self->{components}->{coolingunit}->{total}++;
$self->{output}->output_add(long_msg => sprintf("cooling unit '%s' status is '%s' [instance = %s] [state = %s]", $self->{output}->output_add(
$result->{coolingUnitName}, $result->{coolingUnitStatus}, $instance, long_msg => sprintf(
$result->{coolingUnitStateSettings})); "cooling unit '%s' status is '%s' [instance = %s] [state = %s]",
$result->{coolingUnitName}, $result->{coolingUnitStatus}, $instance,
$result->{coolingUnitStateSettings}
)
);
my $exit = $self->get_severity(label => 'default.state', section => 'coolingunit.state', value => $result->{coolingUnitStateSettings}); my $exit = $self->get_severity(label => 'default.state', section => 'coolingunit.state', value => $result->{coolingUnitStateSettings});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Cooling unit '%s' state is '%s'", $result->{coolingUnitName}, $result->{coolingUnitStateSettings})); severity => $exit,
short_msg => sprintf("Cooling unit '%s' state is '%s'", $result->{coolingUnitName}, $result->{coolingUnitStateSettings})
);
next; next;
} }
$exit = $self->get_severity(label => 'default.status', section => 'coolingunit.status', value => $result->{coolingUnitStatus}); $exit = $self->get_severity(label => 'default.status', section => 'coolingunit.status', value => $result->{coolingUnitStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Cooling unit '%s' status is '%s'", $result->{coolingUnitName}, $result->{coolingUnitStatus})); severity => $exit,
short_msg => sprintf("Cooling unit '%s' status is '%s'", $result->{coolingUnitName}, $result->{coolingUnitStatus})
);
} }
} }
} }

View File

@ -0,0 +1,90 @@
#
# Copyright 2020 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::enclosure;
use strict;
use warnings;
use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_status %map_enclosure_state);
my $mapping = {
enclosureName => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.3.1.2' },
enclosureState => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.3.1.4', map => \%map_enclosure_state },
enclosureRollUpStatus => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.3.1.23', map => \%map_status }
};
my $oid_enclosureTableEntry = '.1.3.6.1.4.1.674.10892.5.5.1.20.130.3';
sub load {
my ($self) = @_;
push @{$self->{request}}, {
oid => $oid_enclosureTableEntry,
start => $mapping->{enclosureName}->{oid},
end => $mapping->{enclosureRollUpStatus}->{oid}
};
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking enclosures");
$self->{components}->{enclosure} = {name => 'enclosures', total => 0, skip => 0};
return if ($self->check_filter(section => 'enclosure'));
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_enclosureTableEntry}})) {
next if ($oid !~ /^$mapping->{enclosureRollUpStatus}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_enclosureTableEntry}, instance => $instance);
next if ($self->check_filter(section => 'enclosure', instance => $instance));
$self->{components}->{enclosure}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"enclosure '%s' status is '%s' [instance = %s] [state = %s]",
$result->{enclosureName}, $result->{enclosureRollUpStatus}, $instance,
$result->{enclosureState}
)
);
my $exit = $self->get_severity(section => 'enclosure.state', value => $result->{enclosureState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"Enclosure '%s' state is '%s'", $result->{enclosureName}, $result->{enclosureState}
)
);
next;
}
$exit = $self->get_severity(label => 'default.status', section => 'enclosure.status', value => $result->{enclosureRollUpStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"Enclosure '%s' status is '%s'", $result->{enclosureName}, $result->{enclosureRollUpStatus}
)
);
}
}
}
1;

View File

@ -26,7 +26,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta
my $mapping = { my $mapping = {
fruInformationStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.2000.10.1.3', map => \%map_status }, fruInformationStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.2000.10.1.3', map => \%map_status },
fruSerialNumberName => { oid => '.1.3.6.1.4.1.674.10892.5.4.2000.10.1.7' }, fruSerialNumberName => { oid => '.1.3.6.1.4.1.674.10892.5.4.2000.10.1.7' }
}; };
my $oid_fruTableEntry = '.1.3.6.1.4.1.674.10892.5.4.2000.10.1'; my $oid_fruTableEntry = '.1.3.6.1.4.1.674.10892.5.4.2000.10.1';
@ -55,14 +55,19 @@ sub check {
next if ($self->check_filter(section => 'fru', instance => $instance)); next if ($self->check_filter(section => 'fru', instance => $instance));
$self->{components}->{fru}->{total}++; $self->{components}->{fru}->{total}++;
$self->{output}->output_add(long_msg => sprintf("fru '%s' status is '%s' [instance = %s]", $self->{output}->output_add(
$result->{fruSerialNumberName}, $result->{fruInformationStatus}, $instance, long_msg => sprintf(
)); "fru '%s' status is '%s' [instance = %s]",
$result->{fruSerialNumberName}, $result->{fruInformationStatus}, $instance,
)
);
my $exit = $self->get_severity(label => 'default.status', section => 'fru.status', value => $result->{fruInformationStatus}); my $exit = $self->get_severity(label => 'default.status', section => 'fru.status', value => $result->{fruInformationStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Fru '%s' status is '%s'", $result->{fruSerialNumberName}, $result->{fruInformationStatus})); severity => $exit,
short_msg => sprintf("Fru '%s' status is '%s'", $result->{fruSerialNumberName}, $result->{fruInformationStatus})
);
} }
} }
} }

View File

@ -27,7 +27,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta
my $mapping = { my $mapping = {
memoryDeviceStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.50.1.4', map => \%map_state }, memoryDeviceStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.50.1.4', map => \%map_state },
memoryDeviceStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.50.1.5', map => \%map_status }, memoryDeviceStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.50.1.5', map => \%map_status },
memoryDeviceLocationName => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.50.1.8' }, memoryDeviceLocationName => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.50.1.8' }
}; };
my $oid_memoryDeviceTableEntry = '.1.3.6.1.4.1.674.10892.5.4.1100.50.1'; my $oid_memoryDeviceTableEntry = '.1.3.6.1.4.1.674.10892.5.4.1100.50.1';
@ -56,21 +56,29 @@ sub check {
next if ($self->check_filter(section => 'memory', instance => $instance)); next if ($self->check_filter(section => 'memory', instance => $instance));
$self->{components}->{memory}->{total}++; $self->{components}->{memory}->{total}++;
$self->{output}->output_add(long_msg => sprintf("memory '%s' status is '%s' [instance = %s] [state = %s]", $self->{output}->output_add(
$result->{memoryDeviceLocationName}, $result->{memoryDeviceStatus}, $instance, long_msg => sprintf(
$result->{memoryDeviceStateSettings})); "memory '%s' status is '%s' [instance = %s] [state = %s]",
$result->{memoryDeviceLocationName}, $result->{memoryDeviceStatus}, $instance,
$result->{memoryDeviceStateSettings}
)
);
my $exit = $self->get_severity(label => 'default.state', section => 'memory.state', value => $result->{memoryDeviceStateSettings}); my $exit = $self->get_severity(label => 'default.state', section => 'memory.state', value => $result->{memoryDeviceStateSettings});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Memory '%s' state is '%s'", $result->{memoryDeviceLocationName}, $result->{memoryDeviceStateSettings})); severity => $exit,
short_msg => sprintf("Memory '%s' state is '%s'", $result->{memoryDeviceLocationName}, $result->{memoryDeviceStateSettings})
);
next; next;
} }
$exit = $self->get_severity(label => 'default.status', section => 'memory.status', value => $result->{memoryDeviceStatus}); $exit = $self->get_severity(label => 'default.status', section => 'memory.status', value => $result->{memoryDeviceStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Memory '%s' status is '%s'", $result->{memoryDeviceLocationName}, $result->{memoryDeviceStatus})); severity => $exit,
short_msg => sprintf("Memory '%s' status is '%s'", $result->{memoryDeviceLocationName}, $result->{memoryDeviceStatus})
);
} }
} }
} }

View File

@ -26,7 +26,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta
my $mapping = { my $mapping = {
networkDeviceStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.90.1.3', map => \%map_status }, networkDeviceStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.90.1.3', map => \%map_status },
networkDeviceProductName => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.90.1.6' }, networkDeviceProductName => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.90.1.6' }
}; };
my $oid_networkDeviceTableEntry = '.1.3.6.1.4.1.674.10892.5.4.1100.90.1'; my $oid_networkDeviceTableEntry = '.1.3.6.1.4.1.674.10892.5.4.1100.90.1';
@ -55,14 +55,19 @@ sub check {
next if ($self->check_filter(section => 'network', instance => $instance)); next if ($self->check_filter(section => 'network', instance => $instance));
$self->{components}->{network}->{total}++; $self->{components}->{network}->{total}++;
$self->{output}->output_add(long_msg => sprintf("network '%s' status is '%s' [instance = %s]", $self->{output}->output_add(
$result->{networkDeviceProductName}, $result->{networkDeviceStatus}, $instance, long_msg => sprintf(
)); "network '%s' status is '%s' [instance = %s]",
$result->{networkDeviceProductName}, $result->{networkDeviceStatus}, $instance
)
);
my $exit = $self->get_severity(label => 'default.status', section => 'network.status', value => $result->{networkDeviceStatus}); my $exit = $self->get_severity(label => 'default.status', section => 'network.status', value => $result->{networkDeviceStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Network '%s' status is '%s'", $result->{networkDeviceProductName}, $result->{networkDeviceStatus})); severity => $exit,
short_msg => sprintf("Network '%s' status is '%s'", $result->{networkDeviceProductName}, $result->{networkDeviceStatus})
);
} }
} }
} }

View File

@ -27,7 +27,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta
my $mapping = { my $mapping = {
pCIDeviceStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.80.1.4', map => \%map_state }, pCIDeviceStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.80.1.4', map => \%map_state },
pCIDeviceStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.80.1.5', map => \%map_status }, pCIDeviceStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.80.1.5', map => \%map_status },
pCIDeviceDescriptionName => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.80.1.9' }, pCIDeviceDescriptionName => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.80.1.9' }
}; };
my $oid_pCIDeviceTableEntry = '.1.3.6.1.4.1.674.10892.5.4.1100.80.1'; my $oid_pCIDeviceTableEntry = '.1.3.6.1.4.1.674.10892.5.4.1100.80.1';
@ -56,21 +56,29 @@ sub check {
next if ($self->check_filter(section => 'pci', instance => $instance)); next if ($self->check_filter(section => 'pci', instance => $instance));
$self->{components}->{pci}->{total}++; $self->{components}->{pci}->{total}++;
$self->{output}->output_add(long_msg => sprintf("pci '%s' status is '%s' [instance = %s] [state = %s]", $self->{output}->output_add(
$result->{pCIDeviceDescriptionName}, $result->{pCIDeviceStatus}, $instance, long_msg => sprintf(
$result->{pCIDeviceStateSettings})); "pci '%s' status is '%s' [instance = %s] [state = %s]",
$result->{pCIDeviceDescriptionName}, $result->{pCIDeviceStatus}, $instance,
$result->{pCIDeviceStateSettings}
)
);
my $exit = $self->get_severity(label => 'default.state', section => 'pci.state', value => $result->{pCIDeviceStateSettings}); my $exit = $self->get_severity(label => 'default.state', section => 'pci.state', value => $result->{pCIDeviceStateSettings});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("PCI '%s' state is '%s'", $result->{pCIDeviceDescriptionName}, $result->{pCIDeviceStateSettings})); severity => $exit,
short_msg => sprintf("PCI '%s' state is '%s'", $result->{pCIDeviceDescriptionName}, $result->{pCIDeviceStateSettings})
);
next; next;
} }
$exit = $self->get_severity(label => 'default.status', section => 'pci.status', value => $result->{pCIDeviceStatus}); $exit = $self->get_severity(label => 'default.status', section => 'pci.status', value => $result->{pCIDeviceStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("PCI '%s' status is '%s'", $result->{pCIDeviceDescriptionName}, $result->{pCIDeviceStatus})); severity => $exit,
short_msg => sprintf("PCI '%s' status is '%s'", $result->{pCIDeviceDescriptionName}, $result->{pCIDeviceStatus})
);
} }
} }
} }

View File

@ -27,7 +27,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta
my $mapping = { my $mapping = {
processorDeviceStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.30.1.4', map => \%map_state }, processorDeviceStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.30.1.4', map => \%map_state },
processorDeviceStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.30.1.5', map => \%map_status }, processorDeviceStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.30.1.5', map => \%map_status },
processorDeviceFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.30.1.26' }, processorDeviceFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.30.1.26' }
}; };
my $oid_processorDeviceTableEntry = '.1.3.6.1.4.1.674.10892.5.4.1100.30.1'; my $oid_processorDeviceTableEntry = '.1.3.6.1.4.1.674.10892.5.4.1100.30.1';
@ -56,21 +56,29 @@ sub check {
next if ($self->check_filter(section => 'processor', instance => $instance)); next if ($self->check_filter(section => 'processor', instance => $instance));
$self->{components}->{processor}->{total}++; $self->{components}->{processor}->{total}++;
$self->{output}->output_add(long_msg => sprintf("processor '%s' status is '%s' [instance = %s] [state = %s]", $self->{output}->output_add(
$result->{processorDeviceFQDD}, $result->{processorDeviceStatus}, $instance, long_msg => sprintf(
$result->{processorDeviceStateSettings})); "processor '%s' status is '%s' [instance = %s] [state = %s]",
$result->{processorDeviceFQDD}, $result->{processorDeviceStatus}, $instance,
$result->{processorDeviceStateSettings}
)
);
my $exit = $self->get_severity(label => 'default.state', section => 'processor.state', value => $result->{processorDeviceStateSettings}); my $exit = $self->get_severity(label => 'default.state', section => 'processor.state', value => $result->{processorDeviceStateSettings});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Processor '%s' state is '%s'", $result->{processorDeviceFQDD}, $result->{processorDeviceStateSettings})); severity => $exit,
short_msg => sprintf("Processor '%s' state is '%s'", $result->{processorDeviceFQDD}, $result->{processorDeviceStateSettings})
);
next; next;
} }
$exit = $self->get_severity(label => 'default.status', section => 'processor.status', value => $result->{processorDeviceStatus}); $exit = $self->get_severity(label => 'default.status', section => 'processor.status', value => $result->{processorDeviceStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Processor '%s' status is '%s'", $result->{processorDeviceFQDD}, $result->{processorDeviceStatus})); severity => $exit,
short_msg => sprintf("Processor '%s' status is '%s'", $result->{processorDeviceFQDD}, $result->{processorDeviceStatus})
);
} }
} }
} }

View File

@ -26,7 +26,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta
my $mapping = { my $mapping = {
powerSupplyStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.12.1.5', map => \%map_status }, powerSupplyStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.12.1.5', map => \%map_status },
powerSupplyLocationName => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.12.1.8' }, powerSupplyLocationName => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.12.1.8' }
}; };
my $oid_powerSupplyTableEntry = '.1.3.6.1.4.1.674.10892.5.4.600.12.1'; my $oid_powerSupplyTableEntry = '.1.3.6.1.4.1.674.10892.5.4.600.12.1';

View File

@ -27,7 +27,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta
my $mapping = { my $mapping = {
powerUnitStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.10.1.4', map => \%map_state }, powerUnitStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.10.1.4', map => \%map_state },
powerUnitName => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.10.1.7' }, powerUnitName => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.10.1.7' },
powerUnitStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.10.1.8', map => \%map_status }, powerUnitStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.10.1.8', map => \%map_status }
}; };
my $oid_powerUnitTableEntry = '.1.3.6.1.4.1.674.10892.5.4.600.10.1'; my $oid_powerUnitTableEntry = '.1.3.6.1.4.1.674.10892.5.4.600.10.1';
@ -56,21 +56,29 @@ sub check {
next if ($self->check_filter(section => 'punit', instance => $instance)); next if ($self->check_filter(section => 'punit', instance => $instance));
$self->{components}->{punit}->{total}++; $self->{components}->{punit}->{total}++;
$self->{output}->output_add(long_msg => sprintf("power unit '%s' status is '%s' [instance = %s] [state = %s]", $self->{output}->output_add(
$result->{powerUnitName}, $result->{powerUnitStatus}, $instance, long_msg => sprintf(
$result->{powerUnitStateSettings})); "power unit '%s' status is '%s' [instance = %s] [state = %s]",
$result->{powerUnitName}, $result->{powerUnitStatus}, $instance,
$result->{powerUnitStateSettings}
)
);
my $exit = $self->get_severity(label => 'default.state', section => 'punit.state', value => $result->{powerUnitStateSettings}); my $exit = $self->get_severity(label => 'default.state', section => 'punit.state', value => $result->{powerUnitStateSettings});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Power unit '%s' state is '%s'", $result->{powerUnitName}, $result->{powerUnitStateSettings})); severity => $exit,
short_msg => sprintf("Power unit '%s' state is '%s'", $result->{powerUnitName}, $result->{powerUnitStateSettings})
);
next; next;
} }
$exit = $self->get_severity(label => 'default.status', section => 'punit.status', value => $result->{powerUnitStatus}); $exit = $self->get_severity(label => 'default.status', section => 'punit.status', value => $result->{powerUnitStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Power unit '%s' status is '%s'", $result->{powerUnitName}, $result->{powerUnitStatus})); severity => $exit,
short_msg => sprintf("Power unit '%s' status is '%s'", $result->{powerUnitName}, $result->{powerUnitStatus})
);
} }
} }
} }

View File

@ -27,17 +27,22 @@ use Exporter;
our %map_state; our %map_state;
our %map_status; our %map_status;
our %map_probe_status; our %map_probe_status;
our %map_enclosure_state;
our %map_amperage_type; our %map_amperage_type;
our %map_pdisk_state; our %map_pdisk_state;
our %map_pdisk_smartstate; our %map_pdisk_smartstate;
our %map_vdisk_state; our %map_vdisk_state;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT_OK = qw(%map_probe_status %map_state %map_status %map_amperage_type %map_pdisk_state %map_pdisk_smartstate %map_vdisk_state); our @EXPORT_OK = qw(
%map_probe_status %map_enclosure_state %map_state
%map_status %map_amperage_type %map_pdisk_state
%map_pdisk_smartstate %map_vdisk_state
);
%map_pdisk_smartstate = ( %map_pdisk_smartstate = (
0 => 'off', 0 => 'off',
1 => 'on', 1 => 'on'
); );
%map_probe_status = ( %map_probe_status = (
@ -50,7 +55,7 @@ our @EXPORT_OK = qw(%map_probe_status %map_state %map_status %map_amperage_type
7 => 'nonCriticalLower', 7 => 'nonCriticalLower',
8 => 'criticalLower', 8 => 'criticalLower',
9 => 'nonRecoverableLower', 9 => 'nonRecoverableLower',
10 => 'failed', 10 => 'failed'
); );
%map_status = ( %map_status = (
@ -59,14 +64,22 @@ our @EXPORT_OK = qw(%map_probe_status %map_state %map_status %map_amperage_type
3 => 'ok', 3 => 'ok',
4 => 'nonCritical', 4 => 'nonCritical',
5 => 'critical', 5 => 'critical',
6 => 'nonRecoverable', 6 => 'nonRecoverable'
); );
%map_state = ( %map_state = (
1 => 'unknown', 1 => 'unknown',
2 => 'enabled', 2 => 'enabled',
4 => 'notReady', 4 => 'notReady',
6 => 'enabledAndNotReady', 6 => 'enabledAndNotReady'
);
%map_enclosure_state = (
1 => 'unknown',
2 => 'ready',
3 => 'failed',
4 => 'missing',
5 => 'degraded'
); );
%map_pdisk_state = ( %map_pdisk_state = (
@ -79,14 +92,14 @@ our @EXPORT_OK = qw(%map_probe_status %map_state %map_status %map_amperage_type
7 => 'failed', 7 => 'failed',
8 => 'non-raid', 8 => 'non-raid',
9 => 'removed', 9 => 'removed',
10 => 'readonly', 10 => 'readonly'
); );
%map_vdisk_state = ( %map_vdisk_state = (
1 => 'unknown', 1 => 'unknown',
2 => 'online', 2 => 'online',
3 => 'failed', 3 => 'failed',
4 => 'degraded', 4 => 'degraded'
); );
%map_amperage_type = ( %map_amperage_type = (
@ -109,7 +122,7 @@ our @EXPORT_OK = qw(%map_probe_status %map_state %map_status %map_amperage_type
23 => 'amperageProbeTypeIsPowerSupplyAmps', 23 => 'amperageProbeTypeIsPowerSupplyAmps',
24 => 'amperageProbeTypeIsPowerSupplyWatts', 24 => 'amperageProbeTypeIsPowerSupplyWatts',
25 => 'amperageProbeTypeIsSystemAmps', 25 => 'amperageProbeTypeIsSystemAmps',
26 => 'amperageProbeTypeIsSystemWatts', 26 => 'amperageProbeTypeIsSystemWatts'
); );
1; 1;

View File

@ -26,7 +26,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta
my $mapping = { my $mapping = {
systemSlotStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.1200.10.1.5', map => \%map_status }, systemSlotStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.1200.10.1.5', map => \%map_status },
systemSlotSlotExternalSlotName => { oid => '.1.3.6.1.4.1.674.10892.5.4.1200.10.1.8' }, systemSlotSlotExternalSlotName => { oid => '.1.3.6.1.4.1.674.10892.5.4.1200.10.1.8' }
}; };
my $oid_systemSlotTableEntry = '.1.3.6.1.4.1.674.10892.5.4.1200.10.1'; my $oid_systemSlotTableEntry = '.1.3.6.1.4.1.674.10892.5.4.1200.10.1';
@ -55,14 +55,19 @@ sub check {
next if ($self->check_filter(section => 'slot', instance => $instance)); next if ($self->check_filter(section => 'slot', instance => $instance));
$self->{components}->{slot}->{total}++; $self->{components}->{slot}->{total}++;
$self->{output}->output_add(long_msg => sprintf("slot '%s' status is '%s' [instance = %s]", $self->{output}->output_add(
$result->{systemSlotSlotExternalSlotName}, $result->{systemSlotStatus}, $instance, long_msg => sprintf(
)); "slot '%s' status is '%s' [instance = %s]",
$result->{systemSlotSlotExternalSlotName}, $result->{systemSlotStatus}, $instance,
)
);
my $exit = $self->get_severity(label => 'default.status', section => 'slot.status', value => $result->{systemSlotStatus}); my $exit = $self->get_severity(label => 'default.status', section => 'slot.status', value => $result->{systemSlotStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Slot '%s' status is '%s'", $result->{systemSlotSlotExternalSlotName}, $result->{systemSlotStatus})); severity => $exit,
short_msg => sprintf("Slot '%s' status is '%s'", $result->{systemSlotSlotExternalSlotName}, $result->{systemSlotStatus})
);
} }
} }
} }

View File

@ -26,7 +26,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta
my $mapping = { my $mapping = {
batteryComponentStatus => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.15.1.6', map => \%map_status }, batteryComponentStatus => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.15.1.6', map => \%map_status },
batteryFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.15.1.20' }, batteryFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.15.1.20' }
}; };
sub load { sub load {
@ -51,14 +51,19 @@ sub check {
next if ($self->check_filter(section => 'storagebattery', instance => $instance)); next if ($self->check_filter(section => 'storagebattery', instance => $instance));
$self->{components}->{storagebattery}->{total}++; $self->{components}->{storagebattery}->{total}++;
$self->{output}->output_add(long_msg => sprintf("storage battery '%s' status is '%s' [instance = %s]", $self->{output}->output_add(
$result->{batteryFQDD}, $result->{batteryComponentStatus}, $instance, long_msg => sprintf(
)); "storage battery '%s' status is '%s' [instance = %s]",
$result->{batteryFQDD}, $result->{batteryComponentStatus}, $instance,
)
);
my $exit = $self->get_severity(label => 'default.status', section => 'storagebattery.status', value => $result->{batteryComponentStatus}); my $exit = $self->get_severity(label => 'default.status', section => 'storagebattery.status', value => $result->{batteryComponentStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Storage battery '%s' status is '%s'", $result->{batteryFQDD}, $result->{batteryComponentStatus})); severity => $exit,
short_msg => sprintf("Storage battery '%s' status is '%s'", $result->{batteryFQDD}, $result->{batteryComponentStatus})
);
} }
} }
} }

View File

@ -26,7 +26,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta
my $mapping = { my $mapping = {
controllerComponentStatus => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.1.1.38', map => \%map_status }, controllerComponentStatus => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.1.1.38', map => \%map_status },
controllerFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.1.1.78' }, controllerFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.1.1.78' }
}; };
sub load { sub load {
@ -51,14 +51,19 @@ sub check {
next if ($self->check_filter(section => 'storagectrl', instance => $instance)); next if ($self->check_filter(section => 'storagectrl', instance => $instance));
$self->{components}->{storagectrl}->{total}++; $self->{components}->{storagectrl}->{total}++;
$self->{output}->output_add(long_msg => sprintf("storage controller '%s' status is '%s' [instance = %s]", $self->{output}->output_add(
$result->{controllerFQDD}, $result->{controllerComponentStatus}, $instance, long_msg => sprintf(
)); "storage controller '%s' status is '%s' [instance = %s]",
$result->{controllerFQDD}, $result->{controllerComponentStatus}, $instance,
)
);
my $exit = $self->get_severity(label => 'default.status', section => 'storagectrl.status', value => $result->{controllerComponentStatus}); my $exit = $self->get_severity(label => 'default.status', section => 'storagectrl.status', value => $result->{controllerComponentStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Storage controllers '%s' status is '%s'", $result->{controllerFQDD}, $result->{controllerComponentStatus})); severity => $exit,
short_msg => sprintf("Storage controllers '%s' status is '%s'", $result->{controllerFQDD}, $result->{controllerComponentStatus})
);
} }
} }
} }

View File

@ -27,7 +27,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta
my $mapping = { my $mapping = {
systemBatteryStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.50.1.4', map => \%map_state }, systemBatteryStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.50.1.4', map => \%map_state },
systemBatteryStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.50.1.5', map => \%map_status }, systemBatteryStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.50.1.5', map => \%map_status },
systemBatteryLocationName => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.50.1.7' }, systemBatteryLocationName => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.50.1.7' }
}; };
my $oid_systemBatteryTableEntry = '.1.3.6.1.4.1.674.10892.5.4.600.50.1'; my $oid_systemBatteryTableEntry = '.1.3.6.1.4.1.674.10892.5.4.600.50.1';

View File

@ -28,7 +28,7 @@ my %map_temp_type = (
1 => 'temperatureProbeTypeIsOther', 1 => 'temperatureProbeTypeIsOther',
2 => 'temperatureProbeTypeIsUnknown', 2 => 'temperatureProbeTypeIsUnknown',
3 => 'temperatureProbeTypeIsAmbientESM', 3 => 'temperatureProbeTypeIsAmbientESM',
16 => 'temperatureProbeTypeIsDiscrete', 16 => 'temperatureProbeTypeIsDiscrete'
); );
my $mapping = { my $mapping = {
@ -40,7 +40,7 @@ my $mapping = {
temperatureProbeUpperCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.10' }, temperatureProbeUpperCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.10' },
temperatureProbeUpperNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.11' }, temperatureProbeUpperNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.11' },
temperatureProbeLowerNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.12' }, temperatureProbeLowerNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.12' },
temperatureProbeLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.13' }, temperatureProbeLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.13' }
}; };
my $oid_temperatureProbeTableEntry = '.1.3.6.1.4.1.674.10892.5.4.700.20.1'; my $oid_temperatureProbeTableEntry = '.1.3.6.1.4.1.674.10892.5.4.700.20.1';
@ -70,21 +70,33 @@ sub check {
$self->{components}->{temperature}->{total}++; $self->{components}->{temperature}->{total}++;
$result->{temperatureProbeReading} = (defined($result->{temperatureProbeReading})) ? $result->{temperatureProbeReading} / 10 : 'unknown'; $result->{temperatureProbeReading} = (defined($result->{temperatureProbeReading})) ? $result->{temperatureProbeReading} / 10 : 'unknown';
$self->{output}->output_add(long_msg => sprintf("temperature '%s' status is '%s' [instance = %s] [state = %s] [value = %s]", $self->{output}->output_add(
$result->{temperatureProbeLocationName}, $result->{temperatureProbeStatus}, $instance, long_msg => sprintf(
$result->{temperatureProbeStateSettings}, $result->{temperatureProbeReading})); "temperature '%s' status is '%s' [instance = %s] [state = %s] [value = %s]",
$result->{temperatureProbeLocationName}, $result->{temperatureProbeStatus}, $instance,
$result->{temperatureProbeStateSettings}, $result->{temperatureProbeReading}
)
);
my $exit = $self->get_severity(label => 'default.state', section => 'temperature.state', value => $result->{temperatureProbeStateSettings}); my $exit = $self->get_severity(label => 'default.state', section => 'temperature.state', value => $result->{temperatureProbeStateSettings});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Temperature '%s' state is '%s'", $result->{temperatureProbeLocationName}, $result->{temperatureProbeStateSettings})); severity => $exit,
short_msg => sprintf(
"Temperature '%s' state is '%s'", $result->{temperatureProbeLocationName}, $result->{temperatureProbeStateSettings}
)
);
next; next;
} }
$exit = $self->get_severity(label => 'probe.status', section => 'temperature.status', value => $result->{temperatureProbeStatus}); $exit = $self->get_severity(label => 'probe.status', section => 'temperature.status', value => $result->{temperatureProbeStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Temperature '%s' status is '%s'", $result->{temperatureProbeLocationName}, $result->{temperatureProbeStatus})); severity => $exit,
short_msg => sprintf(
"Temperature '%s' status is '%s'", $result->{temperatureProbeLocationName}, $result->{temperatureProbeStatus}
)
);
} }
if (defined($result->{temperatureProbeReading}) && $result->{temperatureProbeReading} =~ /[0-9]/) { if (defined($result->{temperatureProbeReading}) && $result->{temperatureProbeReading} =~ /[0-9]/) {
@ -103,15 +115,24 @@ sub check {
$self->{perfdata}->threshold_validate(label => 'warning-temperature-instance-' . $instance, value => $warn_th); $self->{perfdata}->threshold_validate(label => 'warning-temperature-instance-' . $instance, value => $warn_th);
$self->{perfdata}->threshold_validate(label => 'critical-temperature-instance-' . $instance, value => $crit_th); $self->{perfdata}->threshold_validate(label => 'critical-temperature-instance-' . $instance, value => $crit_th);
$exit = $self->{perfdata}->threshold_check(value => $result->{temperatureProbeReading}, threshold => [ { label => 'critical-temperature-instance-' . $instance, exit_litteral => 'critical' }, $exit = $self->{perfdata}->threshold_check(
{ label => 'warning-temperature-instance-' . $instance, exit_litteral => 'warning' } ]); value => $result->{temperatureProbeReading},
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); $warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-temperature-instance-' . $instance);
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-temperature-instance-' . $instance); $crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-temperature-instance-' . $instance);
} }
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Temperature '%s' is %s degree centigrade", $result->{temperatureProbeLocationName}, $result->{temperatureProbeReading})); severity => $exit,
short_msg => sprintf(
"Temperature '%s' is %s degree centigrade", $result->{temperatureProbeLocationName}, $result->{temperatureProbeReading}
)
);
} }
$self->{output}->perfdata_add( $self->{output}->perfdata_add(
label => 'temp', unit => 'C', label => 'temp', unit => 'C',
@ -119,7 +140,7 @@ sub check {
instances => $result->{temperatureProbeLocationName}, instances => $result->{temperatureProbeLocationName},
value => $result->{temperatureProbeReading}, value => $result->{temperatureProbeReading},
warning => $warn, warning => $warn,
critical => $crit, critical => $crit
); );
} }
} }

View File

@ -25,8 +25,8 @@ use warnings;
use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_vdisk_state); use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_vdisk_state);
my $mapping = { my $mapping = {
virtualDiskState => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.4', map => \%map_vdisk_state }, virtualDiskState => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.4', map => \%map_vdisk_state },
virtualDiskFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.35' } virtualDiskFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.35' }
}; };
sub load { sub load {

View File

@ -32,7 +32,7 @@ my $mapping = {
voltageProbeUpperCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.20.1.10' }, voltageProbeUpperCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.20.1.10' },
voltageProbeUpperNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.20.1.11' }, voltageProbeUpperNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.20.1.11' },
voltageProbeLowerNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.20.1.12' }, voltageProbeLowerNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.20.1.12' },
voltageProbeLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.20.1.13' }, voltageProbeLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.20.1.13' }
}; };
my $oid_voltageProbeTableEntry = '.1.3.6.1.4.1.674.10892.5.4.600.20.1'; my $oid_voltageProbeTableEntry = '.1.3.6.1.4.1.674.10892.5.4.600.20.1';
@ -57,7 +57,7 @@ sub check {
next if ($oid !~ /^$mapping->{voltageProbeStatus}->{oid}\.(.*)$/); next if ($oid !~ /^$mapping->{voltageProbeStatus}->{oid}\.(.*)$/);
my $instance = $1; my $instance = $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)); next if ($self->check_filter(section => 'voltage', instance => $instance));
$self->{components}->{voltage}->{total}++; $self->{components}->{voltage}->{total}++;
@ -72,15 +72,23 @@ sub check {
my $exit = $self->get_severity(label => 'default.state', section => 'voltage.state', value => $result->{voltageProbeStateSettings}); my $exit = $self->get_severity(label => 'default.state', section => 'voltage.state', value => $result->{voltageProbeStateSettings});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Voltage '%s' state is '%s'", $result->{voltageProbeLocationName}, $result->{voltageProbeStateSettings})); severity => $exit,
short_msg => sprintf(
"Voltage '%s' state is '%s'", $result->{voltageProbeLocationName}, $result->{voltageProbeStateSettings}
)
);
next; next;
} }
$exit = $self->get_severity(label => 'probe.status', section => 'voltage.status', value => $result->{voltageProbeStatus}); $exit = $self->get_severity(label => 'probe.status', section => 'voltage.status', value => $result->{voltageProbeStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Voltage '%s' status is '%s'", $result->{voltageProbeLocationName}, $result->{voltageProbeStatus})); severity => $exit,
short_msg => sprintf(
"Voltage '%s' status is '%s'", $result->{voltageProbeLocationName}, $result->{voltageProbeStatus}
)
);
} }
if (defined($result->{voltageProbeReading}) && $result->{voltageProbeReading} =~ /[0-9]/) { if (defined($result->{voltageProbeReading}) && $result->{voltageProbeReading} =~ /[0-9]/) {
@ -98,17 +106,24 @@ sub check {
my $crit_th = $result->{voltageProbeLowerCriticalThreshold} . ':' . $result->{voltageProbeUpperCriticalThreshold}; my $crit_th = $result->{voltageProbeLowerCriticalThreshold} . ':' . $result->{voltageProbeUpperCriticalThreshold};
$self->{perfdata}->threshold_validate(label => 'warning-voltage-instance-' . $instance, value => $warn_th); $self->{perfdata}->threshold_validate(label => 'warning-voltage-instance-' . $instance, value => $warn_th);
$self->{perfdata}->threshold_validate(label => 'critical-voltage-instance-' . $instance, value => $crit_th); $self->{perfdata}->threshold_validate(label => 'critical-voltage-instance-' . $instance, value => $crit_th);
$exit = $self->{perfdata}->threshold_check(value => $result->{voltageProbeReading}, threshold => [ { label => 'critical-voltage-instance-' . $instance, exit_litteral => 'critical' }, $exit = $self->{perfdata}->threshold_check(
{ label => 'warning-voltage-instance-' . $instance, exit_litteral => 'warning' } ]); value => $result->{voltageProbeReading},
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); $warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-voltage-instance-' . $instance);
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-voltage-instance-' . $instance); $crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-voltage-instance-' . $instance);
} }
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add( $self->{output}->output_add(
severity => $exit, severity => $exit,
short_msg => sprintf("Voltage '%s' is %s V", $result->{voltageProbeLocationName}, $result->{voltageProbeReading}) short_msg => sprintf(
"Voltage '%s' is %s V", $result->{voltageProbeLocationName}, $result->{voltageProbeReading}
)
); );
} }
$self->{output}->perfdata_add( $self->{output}->perfdata_add(
@ -117,7 +132,7 @@ sub check {
instances => $result->{voltageProbeLocationName}, instances => $result->{voltageProbeLocationName},
value => $result->{voltageProbeReading}, value => $result->{voltageProbeReading},
warning => $warn, warning => $warn,
critical => $crit, critical => $crit
); );
} }
} }

View File

@ -28,10 +28,10 @@ use warnings;
sub set_system { sub set_system {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{regexp_threshold_numeric_check_section_option} = '^(temperature|voltage|amperage|coolingdevice)$'; $self->{regexp_threshold_numeric_check_section_option} = '^(?:temperature|voltage|amperage|coolingdevice)$';
$self->{cb_hook2} = 'snmp_execute'; $self->{cb_hook2} = 'snmp_execute';
$self->{thresholds} = { $self->{thresholds} = {
'default.state' => [ 'default.state' => [
['unknown', 'UNKNOWN'], ['unknown', 'UNKNOWN'],
@ -73,6 +73,13 @@ sub set_system {
['removed', 'OK'], ['removed', 'OK'],
['readonly', 'WARNING'] ['readonly', 'WARNING']
], ],
'enclosure.state' => [
['unknown', 'UNKNOWN'],
['ready', 'OK'],
['failed', 'CRITICAL'],
['missing', 'WARNING'],
['degraded', 'WARNING']
],
'pdisk.smartalert' => [ 'pdisk.smartalert' => [
['off', 'OK'], ['off', 'OK'],
['on', 'WARNING'] ['on', 'WARNING']
@ -87,15 +94,16 @@ 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} = [
'psu', 'punit', 'temperature', 'voltage', 'amperage', 'amperage', 'coolingdevice', 'coolingunit', 'enclosure',
'systembattery', 'coolingunit', 'coolingdevice', 'processor', 'memory', 'pci', 'network', 'fru', 'memory', 'network', 'pci', 'pdisk',
'slot', 'fru', 'storagectrl', 'storagebattery', 'pdisk', 'vdisk' 'processor', 'psu', 'punit', 'slot', 'storagebattery',
'storagectrl', 'systembattery', 'temperature', 'voltage', 'vdisk'
]; ];
} }
sub snmp_execute { sub snmp_execute {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{snmp} = $options{snmp}; $self->{snmp} = $options{snmp};
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request}); $self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
} }
@ -123,9 +131,10 @@ Check hardware components.
=item B<--component> =item B<--component>
Which component to check (Default: '.*'). Which component to check (Default: '.*').
Can be: 'psu', 'punit', 'temperature', 'voltage', 'amperage', Can be: 'amperage', 'coolingdevice', 'coolingunit', 'enclosure',
'systembattery', 'coolingunit', 'coolingdevice', 'processor', 'memory', 'pci', 'network', 'fru', 'memory', 'network', 'pci', 'pdisk',
'slot', 'fru', 'storagectrl', 'storagebattery', 'pdisk', 'vdisk'. 'processor', 'psu', 'punit', 'slot', 'storagebattery',
'storagectrl', 'systembattery', 'temperature', 'voltage', 'vdisk'.
=item B<--filter> =item B<--filter>