Refs #5833
This commit is contained in:
parent
9a33aebfb7
commit
795a8b412c
|
@ -38,16 +38,18 @@ package network::checkpoint::mode::components::fan;
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_status = (
|
||||
0 => 'OK',
|
||||
my %map_states_fan = (
|
||||
0 => 'false',
|
||||
1 => 'true',
|
||||
2 => 'reading error',
|
||||
);
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{components}->{fans} = {name => 'fans', total => 0};
|
||||
$self->{output}->output_add(long_msg => "Checking fans");
|
||||
return if ($self->check_exclude(section => 'fans'));
|
||||
$self->{components}->{fan} = {name => 'fans', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'fan'));
|
||||
|
||||
my $oid_fanSpeedSensorEntry = '.1.3.6.1.4.1.2620.1.6.7.8.2.1';
|
||||
my $oid_fanSpeedSensorStatus = '.1.3.6.1.4.1.2620.1.6.7.8.2.1.6';
|
||||
|
@ -61,24 +63,23 @@ sub check {
|
|||
next if ($key !~ /^$oid_fanSpeedSensorStatus\.(\d+)$/);
|
||||
my $instance = $1;
|
||||
|
||||
next if ($self->check_exclude(section => 'fans', instance => $instance));
|
||||
next if ($self->check_exclude(section => 'fan', instance => $instance));
|
||||
|
||||
my $fan_name = $result->{$oid_fanSpeedSensorName . '.' . $instance};
|
||||
my $status = $result->{$oid_fanSpeedSensorStatus . '.' . $instance};
|
||||
my $fan_state = $result->{$oid_fanSpeedSensorStatus . '.' . $instance};
|
||||
|
||||
$self->{components}->{fans}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Fan '%s' status is %s.",
|
||||
$instance, $map_status{$status}));
|
||||
if ($status != 2) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => sprintf("Fan '%s' status is in an error state",
|
||||
$instance));
|
||||
$self->{components}->{fan}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Fan '%s' sensor out of range status is '%s'",
|
||||
$fan_name, $map_states_fan{$fan_state}));
|
||||
my $exit = $self->get_severity(section => 'fan', value => $map_states_fan{$fan_state});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Fan '%s' sensor out of range status is '%s'", $fan_name, $map_states_fan{$fan_state}));
|
||||
}
|
||||
|
||||
$self->{output}->perfdata_add(label => $fan_name , unit => 'rpm', value => sprintf("%d", $result->{$oid_fanSpeedSensorValue . '.' . $instance})),
|
||||
|
||||
$self->{output}->perfdata_add(label => $fan_name , unit => 'rpm',
|
||||
value => sprintf("%d", $result->{$oid_fanSpeedSensorValue . '.' . $instance}));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -37,44 +37,35 @@ package network::checkpoint::mode::components::psu;
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_status = (
|
||||
0 => 'OK',
|
||||
);
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{components}->{psus} = {name => 'psus', total => 0};
|
||||
$self->{output}->output_add(long_msg => "Checking power supplies");
|
||||
return if ($self->check_exclude(section => 'psus'));
|
||||
$self->{components}->{psu} = {name => 'psus', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'psu'));
|
||||
|
||||
my $oid_voltageSensorEntry = '.1.3.6.1.4.1.2620.1.6.7.8.3.1';
|
||||
my $oid_voltageSensorStatus = '.1.3.6.1.4.1.2620.1.6.7.8.3.1.6';
|
||||
my $oid_voltageSensorValue = '.1.3.6.1.4.1.2620.1.6.7.8.3.1.3';
|
||||
my $oid_voltageSensorName = '.1.3.6.1.4.1.2620.1.6.7.8.3.1.2';
|
||||
my $oid_powerSupplyStatus = '.1.3.6.1.4.1.2620.1.6.7.9.1.1.2';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_voltageSensorEntry);
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_powerSupplyStatus);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
|
||||
next if ($key !~ /^$oid_voltageSensorStatus\.(\d+)$/);
|
||||
$key =~ /^$oid_powerSupplyStatus\.(\d+)$/;
|
||||
my $instance = $1;
|
||||
|
||||
next if ($self->check_exclude(section => 'psus', instance => $instance));
|
||||
my $psu_name = $result->{$oid_voltageSensorName . '.' . $instance};
|
||||
my $status = $result->{$oid_voltageSensorStatus . '.' . $instance};
|
||||
|
||||
$self->{components}->{psus}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Power Supply '%s' status is %s.",
|
||||
$instance, $map_status{$status}));
|
||||
if ($status != 0) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => sprintf("Power Supply '%s' status is in an error state",
|
||||
$instance));
|
||||
}
|
||||
$self->{output}->perfdata_add(label => $psu_name , unit => 'V', value => sprintf("%d", $result->{$oid_voltageSensorValue . '.' . $instance})),
|
||||
next if ($self->check_exclude(section => 'psu', instance => $instance));
|
||||
|
||||
my $psu_state = $result->{$key};
|
||||
|
||||
$self->{components}->{psu}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Power supply '%s' status is '%s'",
|
||||
$instance, $psu_state));
|
||||
my $exit = $self->get_severity(section => 'psu', value => $psu_state);
|
||||
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'", $instance, $psu_state));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,16 +38,19 @@ package network::checkpoint::mode::components::temperature;
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_status = (
|
||||
0 => 'OK',
|
||||
my %map_states_temperature = (
|
||||
0 => 'false',
|
||||
1 => 'true',
|
||||
2 => 'reading error',
|
||||
);
|
||||
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking temperatures");
|
||||
$self->{components}->{temperatures} = {name => 'temperatures', total => 0};
|
||||
return if ($self->check_exclude('temperatures'));
|
||||
$self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'temperature'));
|
||||
|
||||
my $oid_tempertureSensorEntry = '.1.3.6.1.4.1.2620.1.6.7.8.1.1';
|
||||
my $oid_tempertureSensorName = '.1.3.6.1.4.1.2620.1.6.7.8.1.1.2';
|
||||
|
@ -61,23 +64,21 @@ sub check {
|
|||
next if ($key !~ /^$oid_tempertureSensorValue\.(\d+)$/);
|
||||
my $instance = $1;
|
||||
|
||||
next if ($self->check_exclude(section => 'temperatures', instance => $instance));
|
||||
|
||||
my $temperature_name = $result->{$oid_tempertureSensorName . '.' . $instance};
|
||||
my $status = $result->{$oid_tempertureSensorStatus . '.' . $instance};
|
||||
next if ($self->check_exclude(section => 'temperature', instance => $instance));
|
||||
my $temperature_name = $result->{$oid_tempertureSensorName . '.' . $instance};
|
||||
my $temperature_state = $result->{$oid_tempertureSensorStatus . '.' . $instance};
|
||||
|
||||
$self->{components}->{temperatures}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("Temperature '%s' status is %s.",
|
||||
$instance, $map_status{$status}));
|
||||
if ($status != 0) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => sprintf("Temperature '%s' status is in an error state",
|
||||
$instance));
|
||||
$self->{components}->{temperature}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Temperature '%s' sensor out of range status is '%s'",
|
||||
$temperature_name, $map_states_temperature{$temperature_state}));
|
||||
my $exit = $self->get_severity(section => 'temperature', value => $map_states_temperature{$temperature_state});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Temperature '%s' sensor out of range status is '%s'", $voltage_name, $map_states_temperature{$temperature_state}));
|
||||
}
|
||||
|
||||
$self->{output}->perfdata_add(label => $temperature_name , unit => 'C', value => sprintf("%.2f", $result->{$oid_tempertureSensorValue . '.' . $instance})),
|
||||
|
||||
$self->{output}->perfdata_add(label => $temperature_name , unit => 'C',
|
||||
value => sprintf("%.2f", $result->{$oid_tempertureSensorValue . '.' . $instance}));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
################################################################################
|
||||
# Copyright 2005-2013 MERETHIS
|
||||
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
|
||||
# GPL Licence 2.0.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it under
|
||||
# the terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation ; either version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program; if not, see <http://www.gnu.org/licenses>.
|
||||
#
|
||||
# Linking this program statically or dynamically with other modules is making a
|
||||
# combined work based on this program. Thus, the terms and conditions of the GNU
|
||||
# General Public License cover the whole combination.
|
||||
#
|
||||
# As a special exception, the copyright holders of this program give MERETHIS
|
||||
# permission to link this program with independent modules to produce an executable,
|
||||
# regardless of the license terms of these independent modules, and to copy and
|
||||
# distribute the resulting executable under terms of MERETHIS choice, provided that
|
||||
# MERETHIS also meet, for each linked independent module, the terms and conditions
|
||||
# of the license of that module. An independent module is a module which is not
|
||||
# derived from this program. If you modify this program, you may extend this
|
||||
# exception to your version of the program, but you are not obliged to do so. If you
|
||||
# do not wish to do so, delete this exception statement from your version.
|
||||
#
|
||||
# For more information : contact@centreon.com
|
||||
# Authors : Stephane Duret <sduret@merethis.com>
|
||||
#
|
||||
####################################################################################
|
||||
|
||||
package network::checkpoint::mode::components::voltage;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_states_voltage = (
|
||||
0 => 'false',
|
||||
1 => 'true',
|
||||
2 => 'reading error',
|
||||
);
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking voltages");
|
||||
$self->{components}->{voltage} = {name => 'voltages', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'voltage'));
|
||||
|
||||
my $oid_voltageSensorEntry = '.1.3.6.1.4.1.2620.1.6.7.8.3.1';
|
||||
my $oid_voltageSensorStatus = '.1.3.6.1.4.1.2620.1.6.7.8.3.1.6';
|
||||
my $oid_voltageSensorValue = '.1.3.6.1.4.1.2620.1.6.7.8.3.1.3';
|
||||
my $oid_voltageSensorName = '.1.3.6.1.4.1.2620.1.6.7.8.3.1.2';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_voltageSensorEntry);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
|
||||
next if ($key !~ /^$oid_voltageSensorStatus\.(\d+)$/);
|
||||
my $instance = $1;
|
||||
|
||||
next if ($self->check_exclude(section => 'voltage', instance => $instance));
|
||||
my $voltage_name = $result->{$oid_voltageSensorName . '.' . $instance};
|
||||
my $voltage_state = $result->{$oid_voltageSensorStatus . '.' . $instance};
|
||||
|
||||
$self->{components}->{voltage}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Voltage '%s' sensor out of range status is '%s'",
|
||||
$voltage_name, $map_states_voltage{$voltage_state}));
|
||||
my $exit = $self->get_severity(section => 'voltage', value => $map_states_voltage{$voltage_state});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Voltage '%s' sensor out of range status is '%s'", $voltage_name, $map_states_voltage{$voltage_state}));
|
||||
}
|
||||
$self->{output}->perfdata_add(label => $voltage_name , unit => 'V',
|
||||
value => sprintf("%d", $result->{$oid_voltageSensorValue . '.' . $instance}));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -48,8 +48,8 @@ sub new {
|
|||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"warning:s" => { name => 'warning', },
|
||||
"critical:s" => { name => 'critical', },
|
||||
"warning:s" => { name => 'warning' },
|
||||
"critical:s" => { name => 'critical' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -75,7 +75,6 @@ sub run {
|
|||
$self->{snmp} = $options{snmp};
|
||||
|
||||
my $oid_fwNumCom = '.1.3.6.1.4.1.2620.1.1.25.3.0';
|
||||
|
||||
my $result = $self->{snmp}->get_leef(oids => $oid_fwNumCom, nothing_quit => 1);
|
||||
|
||||
my $exit = $self->{perfdata}->threshold_check(value => $result->{$oid_fwNumCom},
|
||||
|
@ -86,6 +85,7 @@ sub run {
|
|||
value => $result->{$oid_fwNumCom},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
||||
min => 0
|
||||
);
|
||||
|
||||
$self->{output}->display();
|
||||
|
|
|
@ -48,8 +48,8 @@ sub new {
|
|||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"warning:s" => { name => 'warning', },
|
||||
"critical:s" => { name => 'critical', },
|
||||
"warning:s" => { name => 'warning', },
|
||||
"critical:s" => { name => 'critical', },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
|
|
@ -41,8 +41,32 @@ use strict;
|
|||
use warnings;
|
||||
|
||||
use network::checkpoint::mode::components::fan;
|
||||
use network::checkpoint::mode::components::psu;
|
||||
use network::checkpoint::mode::components::voltage;
|
||||
use network::checkpoint::mode::components::temperature;
|
||||
use network::checkpoint::mode::components::psu;
|
||||
|
||||
my $thresholds = {
|
||||
temperature => [
|
||||
['true', 'CRITICAL'],
|
||||
['reading error', 'CRITICAL'],
|
||||
['false', 'OK'],
|
||||
],
|
||||
voltage => [
|
||||
['true', 'CRITICAL'],
|
||||
['reading error', 'CRITICAL'],
|
||||
['false', 'OK'],
|
||||
],
|
||||
fan => [
|
||||
['true', 'CRITICAL'],
|
||||
['reading error', 'CRITICAL'],
|
||||
['false', 'OK'],
|
||||
],
|
||||
psu => [
|
||||
['up', 'OK'],
|
||||
['down', 'CRITICAL'],
|
||||
['.*', 'UNKNOWN'],
|
||||
],
|
||||
};
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
|
@ -52,17 +76,42 @@ sub new {
|
|||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"exclude:s" => { name => 'exclude' },
|
||||
"component:s" => { name => 'component', default => 'all' },
|
||||
"exclude:s" => { name => 'exclude' },
|
||||
"component:s" => { name => 'component', default => 'all' },
|
||||
"no-component:s" => { name => 'no_component' },
|
||||
"threshold-overload:s@" => { name => 'threshold_overload' },
|
||||
});
|
||||
$self->{components} = {};
|
||||
$self->{no_components} = undef;
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
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 treshold-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 treshold-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};
|
||||
}
|
||||
}
|
||||
|
||||
sub global {
|
||||
|
@ -70,6 +119,7 @@ sub global {
|
|||
|
||||
network::checkpoint::mode::components::temperature::check($self);
|
||||
network::checkpoint::mode::components::fan::check($self);
|
||||
network::checkpoint::mode::components::voltage::check($self);
|
||||
network::checkpoint::mode::components::psu::check($self);
|
||||
}
|
||||
|
||||
|
@ -82,10 +132,12 @@ sub run {
|
|||
$self->global();
|
||||
} elsif ($self->{option_results}->{component} eq 'fan') {
|
||||
network::checkpoint::mode::components::fan::check($self);
|
||||
} elsif ($self->{option_results}->{component} eq 'psu') {
|
||||
network::checkpoint::mode::components::psu::check($self);
|
||||
} elsif ($self->{option_results}->{component} eq 'voltage') {
|
||||
network::checkpoint::mode::components::voltage::check($self);
|
||||
} elsif ($self->{option_results}->{component} eq 'temperature') {
|
||||
network::checkpoint::mode::components::temperature::check($self);
|
||||
} elsif ($self->{option_results}->{component} eq 'psu') {
|
||||
network::checkpoint::mode::components::psu::check($self);
|
||||
} else {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
|
@ -96,52 +148,101 @@ sub run {
|
|||
my $display_by_component_append = '';
|
||||
foreach my $comp (sort(keys %{$self->{components}})) {
|
||||
# Skipping short msg when no components
|
||||
next if ($self->{components}->{$comp}->{total} == 0);
|
||||
$total_components += $self->{components}->{$comp}->{total};
|
||||
$display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . ' ' . $self->{components}->{$comp}->{name};
|
||||
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 [%s] are ok.",
|
||||
short_msg => sprintf("All %s components are ok [%s].",
|
||||
$total_components,
|
||||
$display_by_component
|
||||
)
|
||||
$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, $section) = @_;
|
||||
my ($self, %options) = @_;
|
||||
|
||||
if (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)$section(\s|,|$)/) {
|
||||
$self->{output}->output_add(long_msg => sprintf("Skipping $section section."));
|
||||
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 {
|
||||
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__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check hardware (fans, power supplies, temperatures).
|
||||
Check hardware (fans, power supplies, temperatures, voltages).
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--component>
|
||||
|
||||
Which component to check (Default: 'all').
|
||||
Can be: 'fan', 'psu', 'temperature'.
|
||||
Can be: 'psu', 'fan', 'temperature', 'voltage'.
|
||||
|
||||
=item B<--exclude>
|
||||
|
||||
Exclude some parts (comma seperated list) (Example: --exclude=fans,modules)
|
||||
Can also exclude specific instance: --exclude=fans#1#2#,psus#1
|
||||
Exclude some parts (comma seperated list) (Example: --exclude=psu)
|
||||
Can also exclude specific instance: --exclude='psu#1#'
|
||||
|
||||
=item B<--absent-problem>
|
||||
|
||||
Return an error if an entity is not 'present' (default is skipping) (comma seperated list)
|
||||
Can be specific or global: --absent-problem=fan#1#
|
||||
|
||||
=item B<--no-component>
|
||||
|
||||
Return an error if no compenents are checked.
|
||||
If total (with skipped) is 0. (Default: 'critical' returns).
|
||||
|
||||
=item B<--threshold-overload>
|
||||
|
||||
Set to overload default threshold values (syntax: section,status,regexp)
|
||||
It used before default thresholds (order stays).
|
||||
Example: --threshold-overload='fan,CRITICAL,^(?!(false)$)'
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -48,8 +48,8 @@ sub new {
|
|||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"warning:s" => { name => 'warning', },
|
||||
"critical:s" => { name => 'critical', },
|
||||
"warning:s" => { name => 'warning', },
|
||||
"critical:s" => { name => 'critical', },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -88,11 +88,9 @@ sub run {
|
|||
short_msg => sprintf("Memory Usage: %.2f %s used (%.2f%%)", $memActiveReal64_value, $memActiveReal64_unit, $memPrctUsage));
|
||||
$self->{output}->perfdata_add(label => "used", unit => 'B',
|
||||
value => $result->{$oid_memActiveReal64},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
||||
);
|
||||
$self->{output}->perfdata_add(label => "size", unit => 'B',
|
||||
value => $result->{$oid_memTotalReal64},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $result->{$oid_memTotalReal64}, cast_int => 1),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $result->{$oid_memTotalReal64}, cast_int => 1),
|
||||
min => 0, max => $result->{$oid_memTotalReal64}
|
||||
);
|
||||
|
||||
$self->{output}->display();
|
||||
|
|
|
@ -47,10 +47,10 @@ sub new {
|
|||
|
||||
$self->{version} = '0.5';
|
||||
%{$self->{modes}} = (
|
||||
'cpu' => 'network::checkpoint::mode::cpu',
|
||||
'memory' => 'network::checkpoint::mode::memory',
|
||||
'connections' => 'network::checkpoint::mode::connections',
|
||||
'hardware' => 'network::checkpoint::mode::hardware',
|
||||
'cpu' => 'network::checkpoint::mode::cpu',
|
||||
'memory' => 'network::checkpoint::mode::memory',
|
||||
'connections' => 'network::checkpoint::mode::connections',
|
||||
'hardware' => 'network::checkpoint::mode::hardware',
|
||||
);
|
||||
|
||||
return $self;
|
||||
|
|
Loading…
Reference in New Issue