mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-26 23:24:27 +02:00
enh(ups/powerware): output-source mode - can use empty option (#3095)
This commit is contained in:
parent
62cf7b5df1
commit
e44aadcf00
@ -30,8 +30,8 @@ my $oid_xupsOutputSource = '.1.3.6.1.4.1.534.1.4.5.0';
|
|||||||
my $thresholds = {
|
my $thresholds = {
|
||||||
osource => [
|
osource => [
|
||||||
['normal', 'OK'],
|
['normal', 'OK'],
|
||||||
['.*', 'CRITICAL'],
|
['.*', 'CRITICAL']
|
||||||
],
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
my %map_osource_status = (
|
my %map_osource_status = (
|
||||||
@ -45,7 +45,7 @@ my %map_osource_status = (
|
|||||||
8 => 'parallelCapacity',
|
8 => 'parallelCapacity',
|
||||||
9 => 'parallelRedundant',
|
9 => 'parallelRedundant',
|
||||||
10 => 'highEfficiencyMode',
|
10 => 'highEfficiencyMode',
|
||||||
11 => 'maintenanceBypass',
|
11 => 'maintenanceBypass'
|
||||||
);
|
);
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
@ -53,9 +53,8 @@ sub new {
|
|||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments => {
|
||||||
{
|
'threshold-overload:s@' => { name => 'threshold_overload' }
|
||||||
"threshold-overload:s@" => { name => 'threshold_overload' },
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
@ -67,6 +66,8 @@ sub check_options {
|
|||||||
|
|
||||||
$self->{overload_th} = {};
|
$self->{overload_th} = {};
|
||||||
foreach my $val (@{$self->{option_results}->{threshold_overload}}) {
|
foreach my $val (@{$self->{option_results}->{threshold_overload}}) {
|
||||||
|
next if ($val eq '');
|
||||||
|
|
||||||
if ($val !~ /^(.*?),(.*)$/) {
|
if ($val !~ /^(.*?),(.*)$/) {
|
||||||
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload option '" . $val . "'.");
|
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload option '" . $val . "'.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
@ -87,9 +88,13 @@ sub run {
|
|||||||
|
|
||||||
my $result = $self->{snmp}->get_leef(oids => [$oid_xupsOutputSource], nothing_quit => 1);
|
my $result = $self->{snmp}->get_leef(oids => [$oid_xupsOutputSource], nothing_quit => 1);
|
||||||
my $exit = $self->get_severity(section => 'osource', value => $map_osource_status{$result->{$oid_xupsOutputSource}});
|
my $exit = $self->get_severity(section => 'osource', value => $map_osource_status{$result->{$oid_xupsOutputSource}});
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(
|
||||||
short_msg => sprintf("Output source status is %s",
|
severity => $exit,
|
||||||
$map_osource_status{$result->{$oid_xupsOutputSource}}));
|
short_msg => sprintf(
|
||||||
|
"Output source status is %s",
|
||||||
|
$map_osource_status{$result->{$oid_xupsOutputSource}}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$self->{output}->display();
|
$self->{output}->display();
|
||||||
$self->{output}->exit();
|
$self->{output}->exit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user