update hardware for dell cmc and openmanage
This commit is contained in:
parent
b93185090d
commit
acf55c2da1
|
@ -31,9 +31,9 @@ my $mapping = {
|
|||
my $oid_drsCMCPowerTableEntrydrsCMCPowerTableEntry = '.1.3.6.1.4.1.674.10892.2.4.1.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_drsCMCPowerTableEntrydrsCMCPowerTableEntry };
|
||||
push @{$self->{request}}, { oid => $oid_drsCMCPowerTableEntrydrsCMCPowerTableEntry };
|
||||
}
|
||||
|
||||
sub check {
|
||||
|
@ -41,14 +41,14 @@ sub check {
|
|||
|
||||
$self->{output}->output_add(long_msg => "Checking chassis");
|
||||
$self->{components}->{chassis} = { name => 'chassis', total => 0, skip => 0 };
|
||||
return if ($self->check_exclude(section => 'chassis'));
|
||||
return if ($self->check_filter(section => 'chassis'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_drsCMCPowerTableEntrydrsCMCPowerTableEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{drsWattsReading}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_drsCMCPowerTableEntrydrsCMCPowerTableEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'chassis', instance => $instance));
|
||||
next if ($self->check_filter(section => 'chassis', instance => $instance));
|
||||
$self->{components}->{chassis}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("Chassis '%s': power %s W, current %s A [instance: %s].",
|
||||
|
|
|
@ -46,9 +46,9 @@ my $mapping = {
|
|||
my $oid_drsStatusNowGroup = '.1.3.6.1.4.1.674.10892.2.3.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_drsStatusNowGroup, start => $mapping->{drsIOMCurrStatus}->{oid}, end => $mapping->{drsCMCCurrStatus}->{oid} };
|
||||
push @{$self->{request}}, { oid => $oid_drsStatusNowGroup, start => $mapping->{drsIOMCurrStatus}->{oid}, end => $mapping->{drsCMCCurrStatus}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
|
@ -56,7 +56,7 @@ sub check {
|
|||
|
||||
$self->{output}->output_add(long_msg => "Checking health");
|
||||
$self->{components}->{health} = {name => 'health', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'health'));
|
||||
return if ($self->check_filter(section => 'health'));
|
||||
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_drsStatusNowGroup}, instance => '0');
|
||||
foreach my $probe (keys %{$mapping}) {
|
||||
|
@ -64,7 +64,7 @@ sub check {
|
|||
$mapping->{$probe}->{oid} =~ /\.(\d+)$/;
|
||||
my $instance = $1;
|
||||
|
||||
next if ($self->check_exclude(section => 'health', instance => $instance));
|
||||
next if ($self->check_filter(section => 'health', instance => $instance));
|
||||
$self->{components}->{health}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("%s is %s [instance: %s].",
|
||||
|
|
|
@ -40,9 +40,9 @@ my $mapping = {
|
|||
my $oid_drsCMCPSUTableEntry = '.1.3.6.1.4.1.674.10892.2.4.2.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_drsCMCPSUTableEntry };
|
||||
push @{$self->{request}}, { oid => $oid_drsCMCPSUTableEntry };
|
||||
}
|
||||
|
||||
sub check {
|
||||
|
@ -50,14 +50,14 @@ sub check {
|
|||
|
||||
$self->{output}->output_add(long_msg => "Checking power supplies");
|
||||
$self->{components}->{psu} = {name => 'psus', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'psu'));
|
||||
return if ($self->check_filter(section => 'psu'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_drsCMCPSUTableEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{drsPSUMonitoringCapable}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_drsCMCPSUTableEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'psu', instance => $instance));
|
||||
next if ($self->check_filter(section => 'psu', instance => $instance));
|
||||
next if ($result->{drsPSUMonitoringCapable} !~ /basic/i);
|
||||
$self->{components}->{psu}->{total}++;
|
||||
|
||||
|
|
|
@ -32,9 +32,9 @@ my $mapping = {
|
|||
my $oid_drsChassisStatusGroup = '.1.3.6.1.4.1.674.10892.2.3';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_drsChassisStatusGroup, start => $mapping->{drsChassisFrontPanelAmbientTemperature}->{oid}, end => $mapping->{drsCMCProcessorTemperature}->{oid} };
|
||||
push @{$self->{request}}, { oid => $oid_drsChassisStatusGroup, start => $mapping->{drsChassisFrontPanelAmbientTemperature}->{oid}, end => $mapping->{drsCMCProcessorTemperature}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
|
@ -42,14 +42,14 @@ sub check {
|
|||
|
||||
$self->{output}->output_add(long_msg => "Checking temperatures");
|
||||
$self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'temperature'));
|
||||
return if ($self->check_filter(section => 'temperature'));
|
||||
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_drsChassisStatusGroup}, instance => '0');
|
||||
|
||||
foreach my $probe (keys %{$mapping}) {
|
||||
next if (!defined($result->{$probe}));
|
||||
|
||||
next if ($self->check_exclude(section => 'temperature', instance => $mapping->{$probe}->{instance}));
|
||||
next if ($self->check_filter(section => 'temperature', instance => $mapping->{$probe}->{instance}));
|
||||
$self->{components}->{temperature}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("%s is %dC [instance: %s].",
|
||||
|
|
|
@ -20,17 +20,21 @@
|
|||
|
||||
package hardware::server::dell::cmc::snmp::mode::hardware;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
use base qw(centreon::plugins::templates::hardware);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
my $oid_drsProductShortName = '.1.3.6.1.4.1.674.10892.2.1.1.2';
|
||||
my $oid_drsChassisServiceTag = '.1.3.6.1.4.1.674.10892.2.1.1.6';
|
||||
my $oid_drsFirmwareVersion = '.1.3.6.1.4.1.674.10892.2.1.2.1';
|
||||
sub set_system {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $thresholds = {
|
||||
$self->{regexp_threshold_overload_check_section_option} = '^(health|chassis|temperature|psu)$';
|
||||
$self->{regexp_threshold_numeric_check_section_option} = '^(temperature|psu\.(voltage|power|current)|chassis\.(power|current))$';
|
||||
|
||||
$self->{cb_hook2} = 'snmp_execute';
|
||||
|
||||
$self->{thresholds} = {
|
||||
health => [
|
||||
['other', 'UNKNOWN'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
|
@ -41,221 +45,43 @@ my $thresholds = {
|
|||
],
|
||||
};
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"exclude:s" => { name => 'exclude' },
|
||||
"component:s" => { name => 'component', default => '.*' },
|
||||
"no-component:s" => { name => 'no_component' },
|
||||
"threshold-overload:s@" => { name => 'threshold_overload' },
|
||||
"warning:s@" => { name => 'warning' },
|
||||
"critical:s@" => { name => 'critical' },
|
||||
});
|
||||
|
||||
$self->{components} = {};
|
||||
$self->{no_components} = undef;
|
||||
|
||||
return $self;
|
||||
$self->{components_path} = 'hardware::server::dell::cmc::snmp::mode::components';
|
||||
$self->{components_module} = ['health', 'chassis', 'temperature', 'psu'];
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
sub snmp_execute {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::init(%options);
|
||||
|
||||
if (defined($self->{option_results}->{no_component})) {
|
||||
if ($self->{option_results}->{no_component} ne '') {
|
||||
$self->{no_components} = $self->{option_results}->{no_component};
|
||||
} else {
|
||||
$self->{no_components} = 'critical';
|
||||
}
|
||||
}
|
||||
|
||||
$self->{overload_th} = {};
|
||||
foreach my $val (@{$self->{option_results}->{threshold_overload}}) {
|
||||
if ($val !~ /^(.*?),(.*?),(.*)$/) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload option '" . $val . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my ($section, $status, $filter) = ($1, $2, $3);
|
||||
if ($self->{output}->is_litteral_status(status => $status) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload status '" . $val . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
$self->{overload_th}->{$section} = [] if (!defined($self->{overload_th}->{$section}));
|
||||
push @{$self->{overload_th}->{$section}}, {filter => $filter, status => $status};
|
||||
}
|
||||
|
||||
$self->{numeric_threshold} = {};
|
||||
foreach my $option (('warning', 'critical')) {
|
||||
foreach my $val (@{$self->{option_results}->{$option}}) {
|
||||
if ($val !~ /^(.*?),(.*?),(.*)$/) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my ($section, $regexp, $value) = ($1, $2, $3);
|
||||
if ($section !~ /(temperature|psu\.(voltage|power|current)|chassis\.(power|current))/) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "' (type must be: temperature, psu.voltage, psu.power, psu.current, chassis.power or chassis.current).");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $position = 0;
|
||||
if (defined($self->{numeric_threshold}->{$section})) {
|
||||
$position = scalar(@{$self->{numeric_threshold}->{$section}});
|
||||
}
|
||||
if (($self->{perfdata}->threshold_validate(label => $option . '-' . $section . '-' . $position, value => $value)) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong $option threshold '" . $value . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
$self->{numeric_threshold}->{$section} = [] if (!defined($self->{numeric_threshold}->{$section}));
|
||||
push @{$self->{numeric_threshold}->{$section}}, { label => $option . '-' . $section . '-' . $position, threshold => $option, regexp => $regexp };
|
||||
}
|
||||
}
|
||||
$self->{snmp} = $options{snmp};
|
||||
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
|
||||
$self->display_system_information();
|
||||
}
|
||||
|
||||
sub display_system_information {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("Product Name: %s, Service Tag: %s, Firmware Version: %s",
|
||||
defined($self->{results}->{$oid_drsProductShortName}->{$oid_drsProductShortName . '.0'}) ? centreon::plugins::misc::trim($self->{results}->{$oid_drsProductShortName}->{$oid_drsProductShortName . '.0'}) : 'unknown',
|
||||
defined($self->{results}->{$oid_drsChassisServiceTag}->{$oid_drsChassisServiceTag . '.0'}) ? $self->{results}->{$oid_drsChassisServiceTag}->{$oid_drsChassisServiceTag . '.0'} : 'unknown',
|
||||
defined($self->{results}->{$oid_drsFirmwareVersion}->{$oid_drsFirmwareVersion . '.0'}) ? $self->{results}->{$oid_drsFirmwareVersion}->{$oid_drsFirmwareVersion . '.0'} : 'unknown')
|
||||
my $oid_drsProductShortName = '.1.3.6.1.4.1.674.10892.2.1.1.2.0';
|
||||
my $oid_drsChassisServiceTag = '.1.3.6.1.4.1.674.10892.2.1.1.6.0';
|
||||
my $oid_drsFirmwareVersion = '.1.3.6.1.4.1.674.10892.2.1.2.1.0';
|
||||
|
||||
my $snmp_result = $self->{snmp}->get_leef(oids => [$oid_drsProductShortName, $oid_drsChassisServiceTag, $oid_drsFirmwareVersion]);
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf("Product Name: %s, Service Tag: %s, Firmware Version: %s",
|
||||
defined($snmp_result->{$oid_drsProductShortName}) ? centreon::plugins::misc::trim($snmp_result->{$oid_drsProductShortName}) : 'unknown',
|
||||
defined($snmp_result->{$oid_drsChassisServiceTag}) ? $snmp_result->{$oid_drsChassisServiceTag} : 'unknown',
|
||||
defined($snmp_result->{$oid_drsFirmwareVersion}) ? $snmp_result->{$oid_drsFirmwareVersion} : 'unknown'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
$self->{snmp} = $options{snmp};
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
my $snmp_request = [ { oid => $oid_drsProductShortName }, { oid => $oid_drsChassisServiceTag }, { oid => $oid_drsFirmwareVersion } ];
|
||||
my @components = ('health', 'chassis', 'temperature', 'psu');
|
||||
foreach (@components) {
|
||||
if (/$self->{option_results}->{component}/) {
|
||||
my $mod_name = "hardware::server::dell::cmc::snmp::mode::components::$_";
|
||||
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $mod_name,
|
||||
error_msg => "Cannot load module '$mod_name'.");
|
||||
my $func = $mod_name->can('load');
|
||||
$func->(request => $snmp_request);
|
||||
}
|
||||
}
|
||||
$options{options}->add_options(arguments => {});
|
||||
|
||||
if (scalar(@{$snmp_request}) == 3) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
$self->{results} = $self->{snmp}->get_multiple_table(oids => $snmp_request);
|
||||
$self->display_system_information();
|
||||
|
||||
foreach (@components) {
|
||||
if (/$self->{option_results}->{component}/) {
|
||||
my $mod_name = "hardware::server::dell::cmc::snmp::mode::components::$_";
|
||||
my $func = $mod_name->can('check');
|
||||
$func->($self);
|
||||
}
|
||||
}
|
||||
|
||||
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 && $self->{components}->{$comp}->{skip} == 0);
|
||||
$total_components += $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip};
|
||||
my $count_by_components = $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip};
|
||||
$display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . '/' . $count_by_components . ' ' . $self->{components}->{$comp}->{name};
|
||||
$display_by_component_append = ', ';
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => sprintf("All %s components are ok [%s]",
|
||||
$total_components,
|
||||
$display_by_component)
|
||||
);
|
||||
|
||||
if (defined($self->{option_results}->{no_component}) && $total_components == 0) {
|
||||
$self->{output}->output_add(severity => $self->{no_components},
|
||||
short_msg => 'No components are checked.');
|
||||
}
|
||||
|
||||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
sub check_exclude {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
if (defined($options{instance})) {
|
||||
if (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)${options{section}}[^,]*#\Q$options{instance}\E#/) {
|
||||
$self->{components}->{$options{section}}->{skip}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section $options{instance} instance."));
|
||||
return 1;
|
||||
}
|
||||
} elsif (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)$options{section}(\s|,|$)/) {
|
||||
$self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section."));
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub absent_problem {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
if (defined($self->{option_results}->{absent}) &&
|
||||
$self->{option_results}->{absent} =~ /(^|\s|,)($options{section}(\s*,|$)|${options{section}}[^,]*#\Q$options{instance}\E#)/) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => sprintf("Component '%s' instance '%s' is not present",
|
||||
$options{section}, $options{instance}));
|
||||
}
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section $options{instance} instance (not present)"));
|
||||
$self->{components}->{$options{section}}->{skip}++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
sub get_severity_numeric {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'OK'; # default
|
||||
my $thresholds = { warning => undef, critical => undef };
|
||||
my $checked = 0;
|
||||
|
||||
if (defined($self->{numeric_threshold}->{$options{section}})) {
|
||||
my $exits = [];
|
||||
foreach (@{$self->{numeric_threshold}->{$options{section}}}) {
|
||||
if ($options{instance} =~ /$_->{regexp}/) {
|
||||
push @{$exits}, $self->{perfdata}->threshold_check(value => $options{value}, threshold => [ { label => $_->{label}, exit_litteral => $_->{threshold} } ]);
|
||||
$thresholds->{$_->{threshold}} = $self->{perfdata}->get_perfdata_for_output(label => $_->{label});
|
||||
$checked = 1;
|
||||
}
|
||||
}
|
||||
$status = $self->{output}->get_most_critical(status => $exits) if (scalar(@{$exits}) > 0);
|
||||
}
|
||||
|
||||
return ($status, $thresholds->{warning}, $thresholds->{critical}, $checked);
|
||||
}
|
||||
|
||||
sub get_severity {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'UNKNOWN'; # default
|
||||
|
||||
if (defined($self->{overload_th}->{$options{section}})) {
|
||||
foreach (@{$self->{overload_th}->{$options{section}}}) {
|
||||
if ($options{value} =~ /$_->{filter}/i) {
|
||||
$status = $_->{status};
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (@{$thresholds->{$options{section}}}) {
|
||||
if ($options{value} =~ /$$_[0]/i) {
|
||||
$status = $$_[1];
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
|
||||
return $status;
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -273,10 +99,10 @@ Check Hardware (Health, Temperatures, Power supplies metrics and chassis metrics
|
|||
Which component to check (Default: '.*').
|
||||
Can be: 'health', 'temperature', 'chassis', 'psu'.
|
||||
|
||||
=item B<--exclude>
|
||||
=item B<--filter>
|
||||
|
||||
Exclude some parts (comma seperated list) (Example: --exclude=fan)
|
||||
Can also exclude specific instance: --exclude=health#2#,psu#1.1#
|
||||
Exclude some parts (comma seperated list) (Example: --filter=fan)
|
||||
Can also exclude specific instance: --filter=health,2
|
||||
|
||||
=item B<--no-component>
|
||||
|
||||
|
|
|
@ -47,9 +47,9 @@ my $mapping = {
|
|||
my $oid_batteryTableEntry = '.1.3.6.1.4.1.674.10892.1.600.50.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_batteryTableEntry, start => $mapping->{batteryStatus}->{oid}, end => $mapping->{batteryLocationName}->{oid} };
|
||||
push @{$self->{request}}, { oid => $oid_batteryTableEntry, start => $mapping->{batteryStatus}->{oid}, end => $mapping->{batteryLocationName}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
|
@ -57,21 +57,21 @@ sub check {
|
|||
|
||||
$self->{output}->output_add(long_msg => "Checking batteries");
|
||||
$self->{components}->{battery} = {name => 'batteries', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'battery'));
|
||||
return if ($self->check_filter(section => 'battery'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_batteryTableEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{batteryStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_batteryTableEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'battery', instance => $instance));
|
||||
next if ($self->check_filter(section => 'battery', instance => $instance));
|
||||
|
||||
$self->{components}->{battery}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("Battery '%s' status is '%s' [instance: %s, reading: %s, location: %s]",
|
||||
$instance, $result->{batteryStatus}, $instance, $result->{batteryReading}, $result->{batteryLocationName}
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'battery', value => $result->{batteryStatus});
|
||||
my $exit = $self->get_severity(label => 'default', section => 'battery', value => $result->{batteryStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Battery '%s' status is '%s'",
|
||||
|
|
|
@ -72,9 +72,9 @@ my $mapping4 = {
|
|||
};
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $mapping->{batteryState}->{oid} }, { oid => $mapping2->{batteryComponentStatus}->{oid} },
|
||||
push @{$self->{request}}, { oid => $mapping->{batteryState}->{oid} }, { oid => $mapping2->{batteryComponentStatus}->{oid} },
|
||||
{ oid => $mapping3->{batteryPredictedCapicity}->{oid} }, { oid => $mapping4->{batteryLearnState}->{oid} };
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ sub check {
|
|||
|
||||
$self->{output}->output_add(long_msg => "Checking cache batteries");
|
||||
$self->{components}->{cachebattery} = {name => 'cache batteries', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'cachebattery'));
|
||||
return if ($self->check_filter(section => 'cachebattery'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping2->{batteryComponentStatus}->{oid}}})) {
|
||||
next if ($oid !~ /^$mapping2->{batteryComponentStatus}->{oid}\.(.*)$/);
|
||||
|
@ -95,7 +95,7 @@ sub check {
|
|||
$result4->{batteryLearnState} = defined($result4->{batteryLearnState}) ? $result4->{batteryLearnState} : '-';
|
||||
$result3->{batteryPredictedCapicity} = defined($result3->{batteryPredictedCapicity}) ? $result3->{batteryPredictedCapicity} : '-';
|
||||
|
||||
next if ($self->check_exclude(section => 'cachebattery', instance => $instance));
|
||||
next if ($self->check_filter(section => 'cachebattery', instance => $instance));
|
||||
|
||||
$self->{components}->{cachebattery}->{total}++;
|
||||
|
||||
|
@ -103,7 +103,7 @@ sub check {
|
|||
$instance, $result2->{batteryComponentStatus}, $instance,
|
||||
$result->{batteryState}, $result4->{batteryLearnState}, $result3->{batteryPredictedCapicity}
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'cachebattery', value => $result2->{batteryComponentStatus});
|
||||
my $exit = $self->get_severity(label => 'default', section => 'cachebattery', value => $result2->{batteryComponentStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Cache battery '%s' status is '%s'",
|
||||
|
|
|
@ -63,9 +63,9 @@ my $mapping3 = {
|
|||
my $oid_channelEntry = '.1.3.6.1.4.1.674.10893.1.20.130.2.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_channelEntry, start => $mapping->{channelName}->{oid}, end => $mapping->{channelState}->{oid} },
|
||||
push @{$self->{request}}, { oid => $oid_channelEntry, start => $mapping->{channelName}->{oid}, end => $mapping->{channelState}->{oid} },
|
||||
{ oid => $mapping2->{channelComponentStatus}->{oid} },
|
||||
{ oid => $mapping3->{channelBusType}->{oid} } ;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ sub check {
|
|||
|
||||
$self->{output}->output_add(long_msg => "Checking connectors (channels)");
|
||||
$self->{components}->{connector} = {name => 'connectors', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'connector'));
|
||||
return if ($self->check_filter(section => 'connector'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping2->{channelComponentStatus}->{oid}}})) {
|
||||
next if ($oid !~ /^$mapping2->{channelComponentStatus}->{oid}\.(.*)$/);
|
||||
|
@ -85,7 +85,7 @@ sub check {
|
|||
my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{$mapping3->{channelBusType}->{oid}}, instance => $instance);
|
||||
$result3->{channelBusType} = defined($result3->{channelBusType}) ? $result3->{channelBusType} : '-';
|
||||
|
||||
next if ($self->check_exclude(section => 'connector', instance => $instance));
|
||||
next if ($self->check_filter(section => 'connector', instance => $instance));
|
||||
|
||||
$self->{components}->{connector}->{total}++;
|
||||
|
||||
|
@ -93,7 +93,7 @@ sub check {
|
|||
$result->{channelName}, $result2->{channelComponentStatus}, $instance,
|
||||
$result->{channelState}, $result3->{channelBusType}
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'connector', value => $result2->{channelComponentStatus});
|
||||
my $exit = $self->get_severity(label => 'default', section => 'connector', value => $result2->{channelComponentStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Connector '%s' status is '%s'",
|
||||
|
|
|
@ -55,9 +55,9 @@ my $mapping4 = {
|
|||
};
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $mapping->{controllerName}->{oid} }, { oid => $mapping2->{controllerComponentStatus}->{oid} },
|
||||
push @{$self->{request}}, { oid => $mapping->{controllerName}->{oid} }, { oid => $mapping2->{controllerComponentStatus}->{oid} },
|
||||
{ oid => $mapping3->{controllerState}->{oid} }, { oid => $mapping4->{controllerFWVersion}->{oid} };
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ sub check {
|
|||
|
||||
$self->{output}->output_add(long_msg => "Checking controllers");
|
||||
$self->{components}->{controller} = {name => 'controllers', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'controller'));
|
||||
return if ($self->check_filter(section => 'controller'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping2->{controllerComponentStatus}->{oid}}})) {
|
||||
next if ($oid !~ /^$mapping2->{controllerComponentStatus}->{oid}\.(.*)$/);
|
||||
|
@ -76,7 +76,7 @@ sub check {
|
|||
my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{$mapping3->{controllerState}->{oid}}, instance => $instance);
|
||||
my $result4 = $self->{snmp}->map_instance(mapping => $mapping4, results => $self->{results}->{$mapping4->{controllerFWVersion}->{oid}}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'controller', instance => $instance));
|
||||
next if ($self->check_filter(section => 'controller', instance => $instance));
|
||||
|
||||
$self->{components}->{controller}->{total}++;
|
||||
|
||||
|
@ -84,7 +84,7 @@ sub check {
|
|||
$result->{controllerName}, $result2->{controllerComponentStatus}, $instance,
|
||||
$result3->{controllerState}, $result4->{controllerFWVersion}
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'controller', value => $result2->{controllerComponentStatus});
|
||||
my $exit = $self->get_severity(label => 'default', section => 'controller', value => $result2->{controllerComponentStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Controller '%s' status is '%s'",
|
||||
|
|
|
@ -57,9 +57,9 @@ my $mapping4 = {
|
|||
my $oid_processorDeviceTableEntry = '.1.3.6.1.4.1.674.10892.1.1100.30.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $mapping->{processorDeviceStatus}->{oid} },
|
||||
push @{$self->{request}}, { oid => $mapping->{processorDeviceStatus}->{oid} },
|
||||
{ oid => $oid_processorDeviceTableEntry, start => $mapping2->{processorDeviceManufacturerName}->{oid}, end => $mapping2->{processorDeviceStatusState}->{oid} },
|
||||
{ oid => $mapping3->{processorDeviceCurrentSpeed}->{oid} }, { oid => $mapping4->{processorDeviceBrandName}->{oid} };
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ sub check {
|
|||
|
||||
$self->{output}->output_add(long_msg => "Checking processor units");
|
||||
$self->{components}->{cpu} = {name => 'CPUs', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'cpu'));
|
||||
return if ($self->check_filter(section => 'cpu'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{processorDeviceStatus}->{oid}}})) {
|
||||
next if ($oid !~ /^$mapping->{processorDeviceStatus}->{oid}\.(.*)$/);
|
||||
|
@ -79,7 +79,7 @@ sub check {
|
|||
my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{$mapping3->{processorDeviceCurrentSpeed}->{oid}}, instance => $instance);
|
||||
my $result4 = $self->{snmp}->map_instance(mapping => $mapping4, results => $self->{results}->{$mapping4->{processorDeviceBrandName}->{oid}}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'cpu', instance => $instance));
|
||||
next if ($self->check_filter(section => 'cpu', instance => $instance));
|
||||
|
||||
$self->{components}->{cpu}->{total}++;
|
||||
|
||||
|
@ -89,7 +89,7 @@ sub check {
|
|||
defined($result4->{processorDeviceBrandName}) ? $result4->{processorDeviceBrandName} : '-',
|
||||
$result2->{processorDeviceStatusState}, $result3->{processorDeviceCurrentSpeed}
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'cpu', value => $result->{processorDeviceStatus});
|
||||
my $exit = $self->get_severity(label => 'default', section => 'cpu', value => $result->{processorDeviceStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Cpu '%s' status is '%s'",
|
||||
|
|
|
@ -38,9 +38,9 @@ my $mapping = {
|
|||
};
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $mapping->{systemStateEventLogStatus}->{oid} };
|
||||
push @{$self->{request}}, { oid => $mapping->{systemStateEventLogStatus}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
|
@ -48,21 +48,21 @@ sub check {
|
|||
|
||||
$self->{output}->output_add(long_msg => "Checking ESM log filling");
|
||||
$self->{components}->{esmlog} = {name => 'ESM log', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'esmlog'));
|
||||
return if ($self->check_filter(section => 'esmlog'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{systemStateEventLogStatus}->{oid}}})) {
|
||||
next if ($oid !~ /^$mapping->{systemStateEventLogStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{systemStateEventLogStatus}->{oid}}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'globalstatus', instance => $instance));
|
||||
next if ($self->check_filter(section => 'globalstatus', instance => $instance));
|
||||
|
||||
$self->{components}->{esmlog}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("ESM '%s' log status is '%s' [instance: %s]",
|
||||
$instance, $result->{systemStateEventLogStatus}, $instance
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'esmlog', value => $result->{systemStateEventLogStatus});
|
||||
my $exit = $self->get_severity(label => 'default', section => 'esmlog', value => $result->{systemStateEventLogStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("ESM '%s' log status is '%s'",
|
||||
|
|
|
@ -47,9 +47,9 @@ my $mapping2 = {
|
|||
my $oid_coolingDeviceTableEntry = '.1.3.6.1.4.1.674.10892.1.700.12.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_coolingDeviceTableEntry, start => $mapping->{coolingDeviceStatus}->{oid}, end => $mapping->{coolingDeviceReading}->{oid} },
|
||||
push @{$self->{request}}, { oid => $oid_coolingDeviceTableEntry, start => $mapping->{coolingDeviceStatus}->{oid}, end => $mapping->{coolingDeviceReading}->{oid} },
|
||||
{ oid => $mapping2->{coolingDeviceLocationName}->{oid} };
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ sub check {
|
|||
|
||||
$self->{output}->output_add(long_msg => "Checking fans");
|
||||
$self->{components}->{fan} = {name => 'fans', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'fan'));
|
||||
return if ($self->check_filter(section => 'fan'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_coolingDeviceTableEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{coolingDeviceStatus}->{oid}\.(.*)$/);
|
||||
|
@ -66,7 +66,7 @@ sub check {
|
|||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_coolingDeviceTableEntry}, instance => $instance);
|
||||
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$mapping2->{coolingDeviceLocationName}->{oid}}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'fan', instance => $instance));
|
||||
next if ($self->check_filter(section => 'fan', instance => $instance));
|
||||
|
||||
$self->{components}->{fan}->{total}++;
|
||||
|
||||
|
@ -74,7 +74,7 @@ sub check {
|
|||
$instance, $result->{coolingDeviceStatus}, $instance,
|
||||
$result2->{coolingDeviceLocationName}, $result->{coolingDeviceReading}
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'fan', value => $result->{coolingDeviceStatus});
|
||||
my $exit = $self->get_severity(label => 'default', section => 'fan', value => $result->{coolingDeviceStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Fan '%s' status is '%s'",
|
||||
|
|
|
@ -38,9 +38,9 @@ my $mapping = {
|
|||
};
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $mapping->{globalSystemStatus}->{oid} };
|
||||
push @{$self->{request}}, { oid => $mapping->{globalSystemStatus}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
|
@ -48,21 +48,21 @@ sub check {
|
|||
|
||||
$self->{output}->output_add(long_msg => "Checking global system status");
|
||||
$self->{components}->{globalstatus} = {name => 'global system status', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'globalstatus'));
|
||||
return if ($self->check_filter(section => 'globalstatus'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{globalSystemStatus}->{oid}}})) {
|
||||
next if ($oid !~ /^$mapping->{globalSystemStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{globalSystemStatus}->{oid}}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'globalstatus', instance => $instance));
|
||||
next if ($self->check_filter(section => 'globalstatus', instance => $instance));
|
||||
|
||||
$self->{components}->{globalstatus}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("Chassis '%s' global status is '%s' [instance: %s]",
|
||||
$instance, $result->{globalSystemStatus}, $instance
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'globalstatus', value => $result->{globalSystemStatus});
|
||||
my $exit = $self->get_severity(label => 'default', section => 'globalstatus', value => $result->{globalSystemStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Chassis '%s' global status is '%s'",
|
||||
|
|
|
@ -84,9 +84,9 @@ my $mapping4 = {
|
|||
my $oid_virtualDiskEntry = '.1.3.6.1.4.1.674.10893.1.20.140.1.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_virtualDiskEntry, start => $mapping->{virtualDiskName}->{oid}, end => $mapping->{virtualDiskState}->{oid} },
|
||||
push @{$self->{request}}, { oid => $oid_virtualDiskEntry, start => $mapping->{virtualDiskName}->{oid}, end => $mapping->{virtualDiskState}->{oid} },
|
||||
{ oid => $mapping2->{virtualDiskLengthInMB}->{oid} }, { oid => $mapping3->{virtualDiskLayout}->{oid} }, { oid => $mapping4->{virtualDiskComponentStatus}->{oid} };
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ sub check {
|
|||
|
||||
$self->{output}->output_add(long_msg => "Checking logical drives");
|
||||
$self->{components}->{logicaldrive} = {name => 'logical drives', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'logicaldrive'));
|
||||
return if ($self->check_filter(section => 'logicaldrive'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping4->{virtualDiskComponentStatus}->{oid}}})) {
|
||||
next if ($oid !~ /^$mapping4->{virtualDiskComponentStatus}->{oid}\.(.*)$/);
|
||||
|
@ -105,7 +105,7 @@ sub check {
|
|||
my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{$mapping3->{virtualDiskLayout}->{oid}}, instance => $instance);
|
||||
my $result4 = $self->{snmp}->map_instance(mapping => $mapping4, results => $self->{results}->{$mapping4->{virtualDiskComponentStatus}->{oid}}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'logicaldrive', instance => $instance));
|
||||
next if ($self->check_filter(section => 'logicaldrive', instance => $instance));
|
||||
|
||||
$self->{components}->{logicaldrive}->{total}++;
|
||||
|
||||
|
@ -114,7 +114,7 @@ sub check {
|
|||
$result2->{virtualDiskLengthInMB}, $result3->{virtualDiskLayout},
|
||||
$result->{virtualDiskState}, $result->{virtualDiskDeviceName}
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'logicaldrive', value => $result4->{virtualDiskComponentStatus});
|
||||
my $exit = $self->get_severity(label => 'default', section => 'logicaldrive', value => $result4->{virtualDiskComponentStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Logical drive '%s' status is '%s'",
|
||||
|
|
|
@ -55,9 +55,9 @@ my $mapping4 = {
|
|||
};
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $mapping->{memoryDeviceStatus}->{oid} }, { oid => $mapping2->{memoryDeviceLocationName}->{oid} },
|
||||
push @{$self->{request}}, { oid => $mapping->{memoryDeviceStatus}->{oid} }, { oid => $mapping2->{memoryDeviceLocationName}->{oid} },
|
||||
{ oid => $mapping3->{memoryDeviceSize}->{oid} }, { oid => $mapping4->{memoryDeviceFailureModes}->{oid} };
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ sub check {
|
|||
|
||||
$self->{output}->output_add(long_msg => "Checking memory modules");
|
||||
$self->{components}->{memory} = {name => 'memory modules', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'memory'));
|
||||
return if ($self->check_filter(section => 'memory'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{memoryDeviceStatus}->{oid}}})) {
|
||||
next if ($oid !~ /^$mapping->{memoryDeviceStatus}->{oid}\.(.*)$/);
|
||||
|
@ -77,7 +77,7 @@ sub check {
|
|||
my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{$mapping3->{memoryDeviceSize}->{oid}}, instance => $instance);
|
||||
my $result4 = $self->{snmp}->map_instance(mapping => $mapping4, results => $self->{results}->{$mapping4->{memoryDeviceFailureModes}->{oid}}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'memory', instance => $instance));
|
||||
next if ($self->check_filter(section => 'memory', instance => $instance));
|
||||
|
||||
$self->{components}->{memory}->{total}++;
|
||||
|
||||
|
@ -85,7 +85,7 @@ sub check {
|
|||
$instance, $result->{memoryDeviceStatus}, $instance,
|
||||
$result2->{memoryDeviceLocationName}, $result3->{memoryDeviceSize}, $result4->{memoryDeviceFailureModes}
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'memory', value => $result->{memoryDeviceStatus});
|
||||
my $exit = $self->get_severity(label => 'default', section => 'memory', value => $result->{memoryDeviceStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Memory module '%s' status is '%s'",
|
||||
|
|
|
@ -77,9 +77,9 @@ my $mapping5 = {
|
|||
};
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $mapping->{arrayDiskName}->{oid} }, { oid => $mapping2->{arrayDiskState}->{oid} },
|
||||
push @{$self->{request}}, { oid => $mapping->{arrayDiskName}->{oid} }, { oid => $mapping2->{arrayDiskState}->{oid} },
|
||||
{ oid => $mapping3->{arrayDiskSpareState}->{oid} }, { oid => $mapping4->{arrayDiskComponentStatus}->{oid} },
|
||||
{ oid => $mapping5->{arrayDiskSmartAlertIndication}->{oid} };
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ sub check {
|
|||
|
||||
$self->{output}->output_add(long_msg => "Checking physical disks");
|
||||
$self->{components}->{physicaldisk} = {name => 'physical disks', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'physicaldisk'));
|
||||
return if ($self->check_filter(section => 'physicaldisk'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping4->{arrayDiskComponentStatus}->{oid}}})) {
|
||||
next if ($oid !~ /^$mapping4->{arrayDiskComponentStatus}->{oid}\.(.*)$/);
|
||||
|
@ -101,7 +101,7 @@ sub check {
|
|||
my $result4 = $self->{snmp}->map_instance(mapping => $mapping4, results => $self->{results}->{$mapping4->{arrayDiskComponentStatus}->{oid}}, instance => $instance);
|
||||
my $result5 = $self->{snmp}->map_instance(mapping => $mapping5, results => $self->{results}->{$mapping5->{arrayDiskSmartAlertIndication}->{oid}}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'physicaldisk', instance => $instance));
|
||||
next if ($self->check_filter(section => 'physicaldisk', instance => $instance));
|
||||
|
||||
$self->{components}->{physicaldisk}->{total}++;
|
||||
|
||||
|
@ -110,7 +110,7 @@ sub check {
|
|||
$result2->{arrayDiskState}, $result3->{arrayDiskSpareState},
|
||||
defined($result5->{arrayDiskSmartAlertIndication}) ? $result5->{arrayDiskSmartAlertIndication} : '-'
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'physicaldisk', value => $result4->{arrayDiskComponentStatus});
|
||||
my $exit = $self->get_severity(label => 'default', section => 'physicaldisk', value => $result4->{arrayDiskComponentStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Physical Disk '%s' status is '%s'",
|
||||
|
|
|
@ -74,9 +74,9 @@ my $oid_powerSupplyTable = '.1.3.6.1.4.1.674.10892.1.600.12';
|
|||
my $oid_powerSupplyTableEntry = '.1.3.6.1.4.1.674.10892.1.600.12.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_powerSupplyTable, start => $mapping->{powerSupplyStatus}->{oid}, end => $mapping->{powerSupplyLocationName}->{oid} },
|
||||
push @{$self->{request}}, { oid => $oid_powerSupplyTable, start => $mapping->{powerSupplyStatus}->{oid}, end => $mapping->{powerSupplyLocationName}->{oid} },
|
||||
{ oid => $oid_powerSupplyTableEntry, start => $mapping2->{powerSupplySensorState}->{oid}, end => $mapping2->{powerSupplyConfigurationErrorType}->{oid} };
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ sub check {
|
|||
|
||||
$self->{output}->output_add(long_msg => "Checking power supplies");
|
||||
$self->{components}->{psu} = {name => 'power supplies', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'psu'));
|
||||
return if ($self->check_filter(section => 'psu'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_powerSupplyTable}})) {
|
||||
next if ($oid !~ /^$mapping->{powerSupplyStatus}->{oid}\.(.*)$/);
|
||||
|
@ -94,7 +94,7 @@ sub check {
|
|||
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_powerSupplyTableEntry}, instance => $instance);
|
||||
$result2->{powerSupplyConfigurationErrorType} = defined($result2->{powerSupplyConfigurationErrorType}) ? $result2->{powerSupplyConfigurationErrorType} : '-';
|
||||
|
||||
next if ($self->check_exclude(section => 'psu', instance => $instance));
|
||||
next if ($self->check_filter(section => 'psu', instance => $instance));
|
||||
|
||||
$self->{components}->{psu}->{total}++;
|
||||
|
||||
|
@ -104,7 +104,7 @@ sub check {
|
|||
defined($result->{powerSupplyOutputWatts}) ? $result->{powerSupplyOutputWatts} : '-',
|
||||
$result2->{powerSupplySensorState}, $result2->{powerSupplyConfigurationErrorType}
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'psu', value => $result->{powerSupplyStatus});
|
||||
my $exit = $self->get_severity(label => 'default', section => 'psu', value => $result->{powerSupplyStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Power supply '%s' status is '%s'",
|
||||
|
|
|
@ -52,9 +52,9 @@ my $mapping = {
|
|||
my $oid_temperatureProbeTable = '.1.3.6.1.4.1.674.10892.1.700.20';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_temperatureProbeTable, start => $mapping->{temperatureProbeStatus}->{oid}, end => $mapping->{temperatureProbeLocationName}->{oid} };
|
||||
push @{$self->{request}}, { oid => $oid_temperatureProbeTable, start => $mapping->{temperatureProbeStatus}->{oid}, end => $mapping->{temperatureProbeLocationName}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
|
@ -62,14 +62,14 @@ sub check {
|
|||
|
||||
$self->{output}->output_add(long_msg => "Checking temperatures");
|
||||
$self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'temperature'));
|
||||
return if ($self->check_filter(section => 'temperature'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_temperatureProbeTable}})) {
|
||||
next if ($oid !~ /^$mapping->{temperatureProbeStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_temperatureProbeTable}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'temperature', instance => $instance));
|
||||
next if ($self->check_filter(section => 'temperature', instance => $instance));
|
||||
|
||||
$self->{components}->{temperature}->{total}++;
|
||||
|
||||
|
@ -77,7 +77,7 @@ sub check {
|
|||
$instance, $result->{temperatureProbeStatus}, $instance,
|
||||
$result->{temperatureProbeLocationName}, $result->{temperatureProbeReading}
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'temperature', value => $result->{temperatureProbeStatus});
|
||||
my $exit = $self->get_severity(label => 'default', section => 'temperature', value => $result->{temperatureProbeStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Temperature '%s' status is '%s'",
|
||||
|
|
|
@ -20,336 +20,67 @@
|
|||
|
||||
package hardware::server::dell::openmanage::snmp::mode::hardware;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
use base qw(centreon::plugins::templates::hardware);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
my $thresholds = {
|
||||
globalstatus => [
|
||||
sub set_system {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{regexp_threshold_overload_check_section_option} =
|
||||
'^(globalstatus|fan|psu|temperature|cpu|cachebattery|memory|physicaldisk|logicaldrive|esmlog|battery|controller|connector)$';
|
||||
$self->{regexp_threshold_numeric_check_section_option} = '^(temperature|fan|psu\.power)$';
|
||||
|
||||
$self->{cb_hook2} = 'snmp_execute';
|
||||
|
||||
$self->{thresholds} = {
|
||||
default => [
|
||||
['other', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['nonCritical', 'WARNING'],
|
||||
['critical', 'CRITICAL'],
|
||||
['nonRecoverable', 'CRITICAL'],
|
||||
],
|
||||
battery => [
|
||||
['other', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['nonCritical', 'WARNING'],
|
||||
['critical', 'CRITICAL'],
|
||||
['nonRecoverable', 'CRITICAL'],
|
||||
],
|
||||
cachebattery => [
|
||||
['other', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['nonCritical', 'WARNING'],
|
||||
['critical', 'CRITICAL'],
|
||||
['nonRecoverable', 'CRITICAL'],
|
||||
],
|
||||
connector => [
|
||||
['other', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['nonCritical', 'WARNING'],
|
||||
['critical', 'CRITICAL'],
|
||||
['nonRecoverable', 'CRITICAL'],
|
||||
],
|
||||
controller => [
|
||||
['other', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['nonCritical', 'WARNING'],
|
||||
['critical', 'CRITICAL'],
|
||||
['nonRecoverable', 'CRITICAL'],
|
||||
],
|
||||
controller => [
|
||||
['other', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['nonCritical', 'WARNING'],
|
||||
['critical', 'CRITICAL'],
|
||||
['nonRecoverable', 'CRITICAL'],
|
||||
],
|
||||
cpu => [
|
||||
['other', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['nonCritical', 'WARNING'],
|
||||
['critical', 'CRITICAL'],
|
||||
['nonRecoverable', 'CRITICAL'],
|
||||
],
|
||||
esmlog => [
|
||||
['other', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['nonCritical', 'WARNING'],
|
||||
['critical', 'CRITICAL'],
|
||||
['nonRecoverable', 'CRITICAL'],
|
||||
],
|
||||
fan => [
|
||||
['other', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['nonCriticalUpper', 'WARNING'],
|
||||
['criticalUpper', 'CRITICAL'],
|
||||
['nonRecoverableUpper', 'CRITICAL'],
|
||||
['nonCriticalLower', 'WARNING'],
|
||||
['criticalLower', 'CRITICAL'],
|
||||
['nonRecoverableLower', 'CRITICAL'],
|
||||
['nonCritical', 'WARNING'], # nonCriticalUpper # nonCriticalLower
|
||||
['critical', 'CRITICAL'], # criticalUpper
|
||||
['nonRecoverable', 'CRITICAL'], # nonRecoverableUpper # nonRecoverableLower
|
||||
['failed', 'CRITICAL']
|
||||
],
|
||||
logicaldrive => [
|
||||
['other', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['nonCritical', 'WARNING'],
|
||||
['critical', 'CRITICAL'],
|
||||
['nonRecoverable', 'CRITICAL'],
|
||||
],
|
||||
memory => [
|
||||
['other', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['nonCritical', 'WARNING'],
|
||||
['critical', 'CRITICAL'],
|
||||
['nonRecoverable', 'CRITICAL'],
|
||||
],
|
||||
physicaldisk => [
|
||||
['other', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['nonCritical', 'WARNING'],
|
||||
['critical', 'CRITICAL'],
|
||||
['nonRecoverable', 'CRITICAL'],
|
||||
],
|
||||
physicaldisk_smartalert => [
|
||||
['yes', 'WARNING'],
|
||||
['no', 'OK'],
|
||||
],
|
||||
psu => [
|
||||
['other', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['nonCritical', 'WARNING'],
|
||||
['critical', 'CRITICAL'],
|
||||
['nonRecoverable', 'CRITICAL'],
|
||||
],
|
||||
temperature => [
|
||||
['other', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['nonCriticalUpper', 'WARNING'],
|
||||
['criticalUpper', 'CRITICAL'],
|
||||
['nonRecoverableUpper', 'CRITICAL'],
|
||||
['nonCriticalLower', 'WARNING'],
|
||||
['criticalLower', 'CRITICAL'],
|
||||
['nonRecoverableLower', 'CRITICAL'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
};
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"exclude:s" => { name => 'exclude' },
|
||||
"component:s" => { name => 'component', default => '.*' },
|
||||
"no-component:s" => { name => 'no_component' },
|
||||
"threshold-overload:s@" => { name => 'threshold_overload' },
|
||||
"warning:s@" => { name => 'warning' },
|
||||
"critical:s@" => { name => 'critical' },
|
||||
});
|
||||
|
||||
$self->{components} = {};
|
||||
return $self;
|
||||
$self->{components_path} = 'hardware::server::dell::openmanage::snmp::mode::components';
|
||||
$self->{components_module} = [
|
||||
'globalstatus', 'fan', 'psu', 'temperature', 'cpu', 'cachebattery', 'memory',
|
||||
'physicaldisk', 'logicaldrive', 'esmlog', 'battery', 'controller', 'connector'
|
||||
];
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
sub snmp_execute {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::init(%options);
|
||||
|
||||
if (defined($self->{option_results}->{no_component})) {
|
||||
if ($self->{option_results}->{no_component} ne '') {
|
||||
$self->{no_components} = $self->{option_results}->{no_component};
|
||||
} else {
|
||||
$self->{no_components} = 'critical';
|
||||
}
|
||||
}
|
||||
|
||||
$self->{overload_th} = {};
|
||||
foreach my $val (@{$self->{option_results}->{threshold_overload}}) {
|
||||
if ($val !~ /^(.*?),(.*?),(.*)$/) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload option '" . $val . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my ($section, $status, $filter) = ($1, $2, $3);
|
||||
if ($self->{output}->is_litteral_status(status => $status) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload status '" . $val . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
$self->{overload_th}->{$section} = [] if (!defined($self->{overload_th}->{$section}));
|
||||
push @{$self->{overload_th}->{$section}}, {filter => $filter, status => $status};
|
||||
}
|
||||
|
||||
$self->{numeric_threshold} = {};
|
||||
foreach my $option (('warning', 'critical')) {
|
||||
foreach my $val (@{$self->{option_results}->{$option}}) {
|
||||
if ($val !~ /^(.*?),(.*?),(.*)$/) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my ($section, $regexp, $value) = ($1, $2, $3);
|
||||
if ($section !~ /^(temperature|fan|psu\.power)$/) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "' (type must be: temperature, fan, psu.power).");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $position = 0;
|
||||
if (defined($self->{numeric_threshold}->{$section})) {
|
||||
$position = scalar(@{$self->{numeric_threshold}->{$section}});
|
||||
}
|
||||
if (($self->{perfdata}->threshold_validate(label => $option . '-' . $section . '-' . $position, value => $value)) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong $option threshold '" . $value . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
$self->{numeric_threshold}->{$section} = [] if (!defined($self->{numeric_threshold}->{$section}));
|
||||
push @{$self->{numeric_threshold}->{$section}}, { label => $option . '-' . $section . '-' . $position, threshold => $option, regexp => $regexp };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
$self->{snmp} = $options{snmp};
|
||||
|
||||
# In '10892-MIB'
|
||||
my $oid_chassisModelName = ".1.3.6.1.4.1.674.10892.1.300.10.1.9";
|
||||
my $snmp_request = [ { oid => $oid_chassisModelName } ];
|
||||
my $oid_chassisModelName = '.1.3.6.1.4.1.674.10892.1.300.10.1.9';
|
||||
|
||||
my @components = ('globalstatus', 'fan', 'psu', 'temperature', 'cpu', 'cachebattery', 'memory',
|
||||
'physicaldisk', 'logicaldrive', 'esmlog', 'battery', 'controller', 'connector');
|
||||
foreach (@components) {
|
||||
if (/$self->{option_results}->{component}/) {
|
||||
my $mod_name = "hardware::server::dell::openmanage::snmp::mode::components::$_";
|
||||
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $mod_name,
|
||||
error_msg => "Cannot load module '$mod_name'.");
|
||||
my $func = $mod_name->can('load');
|
||||
$func->(request => $snmp_request);
|
||||
}
|
||||
}
|
||||
|
||||
if (scalar(@{$snmp_request}) == 1) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
$self->{results} = $self->{snmp}->get_multiple_table(oids => $snmp_request);
|
||||
$self->{snmp} = $options{snmp};
|
||||
push @{$self->{request}}, { oid => $oid_chassisModelName };
|
||||
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_chassisModelName}})) {
|
||||
my $name = defined($self->{results}->{$oid_chassisModelName}->{$oid}) ?
|
||||
centreon::plugins::misc::trim($self->{results}->{$oid_chassisModelName}->{$oid}) : 'unknown';
|
||||
$self->{output}->output_add(long_msg => sprintf("Product Name: %s", $name));
|
||||
}
|
||||
|
||||
foreach (@components) {
|
||||
if (/$self->{option_results}->{component}/) {
|
||||
my $mod_name = "hardware::server::dell::openmanage::snmp::mode::components::$_";
|
||||
my $func = $mod_name->can('check');
|
||||
$func->($self);
|
||||
}
|
||||
}
|
||||
|
||||
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 && $self->{components}->{$comp}->{skip} == 0);
|
||||
$total_components += $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip};
|
||||
my $count_by_components = $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip};
|
||||
$display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . '/' . $count_by_components . ' ' . $self->{components}->{$comp}->{name};
|
||||
$display_by_component_append = ', ';
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => sprintf("All %s components are ok [%s].",
|
||||
$total_components,
|
||||
$display_by_component)
|
||||
);
|
||||
|
||||
if (defined($self->{option_results}->{no_component}) && $total_components == 0) {
|
||||
$self->{output}->output_add(severity => $self->{no_components},
|
||||
short_msg => 'No components are checked.');
|
||||
}
|
||||
|
||||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
sub check_exclude {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
if (defined($options{instance})) {
|
||||
if (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)${options{section}}[^,]*#\Q$options{instance}\E#/) {
|
||||
$self->{components}->{$options{section}}->{skip}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section $options{instance} instance."));
|
||||
return 1;
|
||||
}
|
||||
} elsif (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)$options{section}(\s|,|$)/) {
|
||||
$self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section."));
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub get_severity_numeric {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'OK'; # default
|
||||
my $thresholds = { warning => undef, critical => undef };
|
||||
my $checked = 0;
|
||||
|
||||
if (defined($self->{numeric_threshold}->{$options{section}})) {
|
||||
my $exits = [];
|
||||
foreach (@{$self->{numeric_threshold}->{$options{section}}}) {
|
||||
if ($options{instance} =~ /$_->{regexp}/) {
|
||||
push @{$exits}, $self->{perfdata}->threshold_check(value => $options{value}, threshold => [ { label => $_->{label}, exit_litteral => $_->{threshold} } ]);
|
||||
$thresholds->{$_->{threshold}} = $self->{perfdata}->get_perfdata_for_output(label => $_->{label});
|
||||
$checked = 1;
|
||||
}
|
||||
}
|
||||
$status = $self->{output}->get_most_critical(status => $exits) if (scalar(@{$exits}) > 0);
|
||||
}
|
||||
|
||||
return ($status, $thresholds->{warning}, $thresholds->{critical}, $checked);
|
||||
}
|
||||
|
||||
sub get_severity {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'UNKNOWN'; # default
|
||||
|
||||
if (defined($self->{overload_th}->{$options{section}})) {
|
||||
foreach (@{$self->{overload_th}->{$options{section}}}) {
|
||||
if ($options{value} =~ /$_->{filter}/i) {
|
||||
$status = $_->{status};
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (@{$thresholds->{$options{section}}}) {
|
||||
if ($options{value} =~ /$$_[0]/i) {
|
||||
$status = $$_[1];
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
@ -366,10 +97,10 @@ Which component to check (Default: '.*').
|
|||
Can be: 'globalstatus', 'fan', 'cpu', 'psu', 'temperature', 'cachebattery',
|
||||
'physicaldisk', 'logicaldrive', 'battery', 'controller', 'connector'.
|
||||
|
||||
=item B<--exclude>
|
||||
=item B<--filter>
|
||||
|
||||
Exclude some parts (comma seperated list) (Example: --exclude=fan,cpu)
|
||||
Can also exclude specific instance: --exclude=fan#1#,cpu
|
||||
Exclude some parts (comma seperated list) (Example: --filter=fan)
|
||||
Can also exclude specific instance: --filter=fan,1
|
||||
|
||||
=item B<--no-component>
|
||||
|
||||
|
|
Loading…
Reference in New Issue