mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 07:34:35 +02:00
enhance cisco sb
This commit is contained in:
parent
a904a8275a
commit
9a4554c8e8
@ -22,34 +22,96 @@ package centreon::common::cisco::smallbusiness::snmp::mode::components::fan;
|
|||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
use centreon::common::cisco::smallbusiness::snmp::mode::components::resources qw(
|
||||||
my %map_fan_status = (
|
$rl_envmon_state
|
||||||
1 => 'normal',
|
$oid_rlPhdUnitEnvParamMonitorAutoRecoveryEnable
|
||||||
2 => 'warning',
|
$oid_rlPhdUnitEnvParamEntry
|
||||||
3 => 'critical',
|
|
||||||
4 => 'shutdown',
|
|
||||||
5 => 'notPresent',
|
|
||||||
6 => 'notFunctioning'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
my $mapping_stack = {
|
||||||
|
new => {
|
||||||
|
rlPhdUnitEnvParamFan1Status => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.4', map => $rl_envmon_state },
|
||||||
|
rlPhdUnitEnvParamFan2Status => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.5', map => $rl_envmon_state },
|
||||||
|
rlPhdUnitEnvParamFan3Status => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.6', map => $rl_envmon_state },
|
||||||
|
rlPhdUnitEnvParamFan4Status => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.7', map => $rl_envmon_state },
|
||||||
|
rlPhdUnitEnvParamFan5Status => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.8', map => $rl_envmon_state },
|
||||||
|
rlPhdUnitEnvParamFan6Status => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.9', map => $rl_envmon_state }
|
||||||
|
},
|
||||||
|
old => {
|
||||||
|
rlPhdUnitEnvParamFan1Status => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.4', map => $rl_envmon_state },
|
||||||
|
rlPhdUnitEnvParamFan2Status => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.5', map => $rl_envmon_state },
|
||||||
|
rlPhdUnitEnvParamFan3Status => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.6', map => $rl_envmon_state },
|
||||||
|
rlPhdUnitEnvParamFan4Status => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.7', map => $rl_envmon_state },
|
||||||
|
rlPhdUnitEnvParamFan5Status => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.8', map => $rl_envmon_state }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
rlEnvMonFanStatusDescr => { oid => '.1.3.6.1.4.1.9.6.1.101.83.1.1.1.2' },
|
rlEnvMonFanStatusDescr => { oid => '.1.3.6.1.4.1.9.6.1.101.83.1.1.1.2' },
|
||||||
rlEnvMonFanState => { oid => '.1.3.6.1.4.1.9.6.1.101.83.1.1.1.3', map => \%map_fan_status },
|
rlEnvMonFanState => { oid => '.1.3.6.1.4.1.9.6.1.101.83.1.1.1.3', map => $rl_envmon_state }
|
||||||
};
|
};
|
||||||
my $oid_rlEnvMonFanStatusEntry = '.1.3.6.1.4.1.9.6.1.101.83.1.1.1';
|
my $oid_rlEnvMonFanStatusEntry = '.1.3.6.1.4.1.9.6.1.101.83.1.1.1';
|
||||||
|
|
||||||
sub load {
|
sub load {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
push @{$self->{request}}, { oid => $oid_rlEnvMonFanStatusEntry };
|
push @{$self->{request}}, {
|
||||||
|
oid => $oid_rlEnvMonFanStatusEntry,
|
||||||
|
start => $mapping->{rlEnvMonFanStatusDescr}->{oid},
|
||||||
|
end => $mapping->{rlEnvMonFanState}->{oid}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check {
|
sub check_fan_stack {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking fans");
|
my $num_fans = 5;
|
||||||
$self->{components}->{fan} = {name => 'fan', total => 0, skip => 0};
|
$num_fans = 6 if ($self->{sb_new} == 1);
|
||||||
return if ($self->check_filter(section => 'fan'));
|
|
||||||
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rlPhdUnitEnvParamEntry}})) {
|
||||||
|
next if ($oid !~ /^$mapping_stack->{new}->{rlPhdUnitEnvParamFan1Status}->{oid}\.(.*)$/);
|
||||||
|
my $instance = $1;
|
||||||
|
my $result = $self->{snmp}->map_instance(
|
||||||
|
mapping => $self->{sb_new} == 1 ? $mapping_stack->{new} : $mapping_stack->{old},
|
||||||
|
results => $self->{results}->{$oid_rlPhdUnitEnvParamEntry},
|
||||||
|
instance => $instance
|
||||||
|
);
|
||||||
|
|
||||||
|
for (my $i = 1; $i <= $num_fans; $i++) {
|
||||||
|
my $instance2 = 'stack.' . $instance . '.fan.' . $i;
|
||||||
|
my $name = 'rlPhdUnitEnvParamFan' . $i . 'Status';
|
||||||
|
|
||||||
|
next if ($self->check_filter(section => 'fan', instance => $instance2));
|
||||||
|
next if ($result->{$name} =~ /notPresent/i &&
|
||||||
|
$self->absent_problem(section => 'fan', instance => $instance2));
|
||||||
|
|
||||||
|
$self->{components}->{fan}->{total}++;
|
||||||
|
$self->{output}->output_add(
|
||||||
|
long_msg => sprintf(
|
||||||
|
"fan '%s' status is '%s' [instance: %s]",
|
||||||
|
$instance2,
|
||||||
|
$result->{$name},
|
||||||
|
$instance2
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
my $exit = $self->get_severity(label => 'default', section => 'fan', value => $result->{$name});
|
||||||
|
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'",
|
||||||
|
$instance2,
|
||||||
|
$result->{$name}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_fan {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rlEnvMonFanStatusEntry}})) {
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rlEnvMonFanStatusEntry}})) {
|
||||||
next if ($oid !~ /^$mapping->{rlEnvMonFanState}->{oid}\.(.*)$/);
|
next if ($oid !~ /^$mapping->{rlEnvMonFanState}->{oid}\.(.*)$/);
|
||||||
@ -63,14 +125,38 @@ sub check {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$self->{components}->{fan}->{total}++;
|
$self->{components}->{fan}->{total}++;
|
||||||
$self->{output}->output_add(long_msg => sprintf("Fan '%s' status is '%s' [instance = %s]",
|
$self->{output}->output_add(
|
||||||
$result->{rlEnvMonFanStatusDescr}, $result->{rlEnvMonFanState}, $instance));
|
long_msg => sprintf(
|
||||||
my $exit = $self->get_severity(section => 'fan', value => $result->{rlEnvMonFanState});
|
"fan '%s' status is '%s' [instance: %s]",
|
||||||
|
$result->{rlEnvMonFanStatusDescr},
|
||||||
|
$result->{rlEnvMonFanState},
|
||||||
|
$instance
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
my $exit = $self->get_severity(label => 'default', section => 'fan', value => $result->{rlEnvMonFanState});
|
||||||
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("Fan '%s' status is '%s'", $result->{rlEnvMonFanStatusDescr}, $result->{rlEnvMonFanState}));
|
severity => $exit,
|
||||||
|
short_msg => sprintf(
|
||||||
|
"Fan '%s' status is '%s'",
|
||||||
|
$result->{rlEnvMonFanStatusDescr},
|
||||||
|
$result->{rlEnvMonFanState}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking fans");
|
||||||
|
$self->{components}->{fan} = { name => 'fan', total => 0, skip => 0 };
|
||||||
|
return if ($self->check_filter(section => 'fan'));
|
||||||
|
|
||||||
|
check_fan($self);
|
||||||
|
check_fan_stack($self);
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
@ -22,34 +22,74 @@ package centreon::common::cisco::smallbusiness::snmp::mode::components::psu;
|
|||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
use centreon::common::cisco::smallbusiness::snmp::mode::components::resources qw(
|
||||||
my %map_psu_status = (
|
$rl_envmon_state
|
||||||
1 => 'normal',
|
$oid_rlPhdUnitEnvParamEntry
|
||||||
2 => 'warning',
|
|
||||||
3 => 'critical',
|
|
||||||
4 => 'shutdown',
|
|
||||||
5 => 'notPresent',
|
|
||||||
6 => 'notFunctioning'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
my $mapping_stack = {
|
||||||
|
rlPhdUnitEnvParamMainPSStatus => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.2', map => $rl_envmon_state },
|
||||||
|
rlPhdUnitEnvParamRedundantPSStatus => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.3', map => $rl_envmon_state }
|
||||||
|
};
|
||||||
|
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
rlEnvMonSupplyStatusDescr => { oid => '.1.3.6.1.4.1.9.6.1.101.83.1.2.1.2' },
|
rlEnvMonSupplyStatusDescr => { oid => '.1.3.6.1.4.1.9.6.1.101.83.1.2.1.2' },
|
||||||
rlEnvMonSupplyState => { oid => '.1.3.6.1.4.1.9.6.1.101.83.1.2.1.3', map => \%map_psu_status },
|
rlEnvMonSupplyState => { oid => '.1.3.6.1.4.1.9.6.1.101.83.1.2.1.3', map => $rl_envmon_state }
|
||||||
};
|
};
|
||||||
my $oid_rlEnvMonSupplyStatusEntry = '.1.3.6.1.4.1.9.6.1.101.83.1.2.1';
|
my $oid_rlEnvMonSupplyStatusEntry = '.1.3.6.1.4.1.9.6.1.101.83.1.2.1';
|
||||||
|
|
||||||
sub load {
|
sub load {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
push @{$self->{request}}, { oid => $oid_rlEnvMonSupplyStatusEntry };
|
push @{$self->{request}}, {
|
||||||
|
oid => $oid_rlEnvMonSupplyStatusEntry,
|
||||||
|
$mapping->{rlEnvMonSupplyStatusDescr}->{oid},
|
||||||
|
$mapping->{rlEnvMonSupplyState}->{oid}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check {
|
sub check_psu_stack {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking power supplies");
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rlPhdUnitEnvParamEntry}})) {
|
||||||
$self->{components}->{psu} = {name => 'psu', total => 0, skip => 0};
|
next if ($oid !~ /^$mapping_stack->{rlPhdUnitEnvParamMainPSStatus}->{oid}\.(.*)$/);
|
||||||
return if ($self->check_filter(section => 'psu'));
|
my $instance = $1;
|
||||||
|
my $result = $self->{snmp}->map_instance(mapping => $mapping_stack, results => $self->{results}->{$oid_rlPhdUnitEnvParamEntry}, instance => $instance);
|
||||||
|
|
||||||
|
foreach (['rlPhdUnitEnvParamMainPSStatus', 'main.psu'], ['rlPhdUnitEnvParamRedundantPSStatus', 'redundant.psu']) {
|
||||||
|
my $instance2 = 'stack.' . $instance . '.' . $_->[1];
|
||||||
|
|
||||||
|
next if ($self->check_filter(section => 'psu', instance => $instance2));
|
||||||
|
next if ($result->{$_->[0]} =~ /notPresent/i &&
|
||||||
|
$self->absent_problem(section => 'psu', instance => $instance2));
|
||||||
|
|
||||||
|
$self->{components}->{psu}->{total}++;
|
||||||
|
$self->{output}->output_add(
|
||||||
|
long_msg => sprintf(
|
||||||
|
"power supply '%s' status is '%s' [instance: %s]",
|
||||||
|
$instance2,
|
||||||
|
$result->{$_->[0]},
|
||||||
|
$instance2
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
my $exit = $self->get_severity(label => 'default', section => 'psu', value => $result->{$_->[0]});
|
||||||
|
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'",
|
||||||
|
$instance2,
|
||||||
|
$result->{$_->[0]}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_psu {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rlEnvMonSupplyStatusEntry}})) {
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rlEnvMonSupplyStatusEntry}})) {
|
||||||
next if ($oid !~ /^$mapping->{rlEnvMonSupplyState}->{oid}\.(.*)$/);
|
next if ($oid !~ /^$mapping->{rlEnvMonSupplyState}->{oid}\.(.*)$/);
|
||||||
@ -63,14 +103,38 @@ sub check {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$self->{components}->{psu}->{total}++;
|
$self->{components}->{psu}->{total}++;
|
||||||
$self->{output}->output_add(long_msg => sprintf("Power supply '%s' status is '%s' [instance = %s]",
|
$self->{output}->output_add(
|
||||||
$result->{rlEnvMonSupplyStatusDescr}, $result->{rlEnvMonSupplyState}, $instance));
|
long_msg => sprintf(
|
||||||
my $exit = $self->get_severity(section => 'psu', value => $result->{rlEnvMonSupplyState});
|
"power supply '%s' status is '%s' [instance: %s]",
|
||||||
|
$result->{rlEnvMonSupplyStatusDescr},
|
||||||
|
$result->{rlEnvMonSupplyState},
|
||||||
|
$instance
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
my $exit = $self->get_severity(label => 'default', section => 'psu', value => $result->{rlEnvMonSupplyState});
|
||||||
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 supply '%s' status is '%s'", $result->{rlEnvMonSupplyStatusDescr}, $result->{rlEnvMonSupplyState}));
|
severity => $exit,
|
||||||
|
short_msg => sprintf(
|
||||||
|
"Power supply '%s' status is '%s'",
|
||||||
|
$result->{rlEnvMonSupplyStatusDescr},
|
||||||
|
$result->{rlEnvMonSupplyState}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking power supplies");
|
||||||
|
$self->{components}->{psu} = { name => 'psu', total => 0, skip => 0 };
|
||||||
|
return if ($self->check_filter(section => 'psu'));
|
||||||
|
|
||||||
|
check_psu($self);
|
||||||
|
check_psu_stack($self);
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
@ -0,0 +1,53 @@
|
|||||||
|
#
|
||||||
|
# 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 centreon::common::cisco::smallbusiness::snmp::mode::components::resources;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Exporter;
|
||||||
|
|
||||||
|
our $rl_envmon_state;
|
||||||
|
our $oid_rlPhdUnitEnvParamMonitorAutoRecoveryEnable;
|
||||||
|
our $oid_rlPhdUnitEnvParamEntry;
|
||||||
|
|
||||||
|
our @ISA = qw(Exporter);
|
||||||
|
our @EXPORT_OK = qw(
|
||||||
|
$rl_envmon_state
|
||||||
|
$oid_rlPhdUnitEnvParamMonitorAutoRecoveryEnable
|
||||||
|
$oid_rlPhdUnitEnvParamEntry
|
||||||
|
);
|
||||||
|
|
||||||
|
$rl_envmon_state = {
|
||||||
|
1 => 'normal',
|
||||||
|
2 => 'warning',
|
||||||
|
3 => 'critical',
|
||||||
|
4 => 'shutdown',
|
||||||
|
5 => 'notPresent',
|
||||||
|
6 => 'notFunctioning',
|
||||||
|
7 => 'notAvailable',
|
||||||
|
8 => 'backingUp',
|
||||||
|
9 => 'readingFailed'
|
||||||
|
};
|
||||||
|
|
||||||
|
$oid_rlPhdUnitEnvParamMonitorAutoRecoveryEnable = '.1.3.6.1.4.1.9.6.1.101.53.15.1.15';
|
||||||
|
$oid_rlPhdUnitEnvParamEntry = '.1.3.6.1.4.1.9.6.1.101.53.15.1';
|
||||||
|
|
||||||
|
1;
|
@ -22,23 +22,24 @@ package centreon::common::cisco::smallbusiness::snmp::mode::components::temperat
|
|||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
use centreon::common::cisco::smallbusiness::snmp::mode::components::resources qw($oid_rlPhdUnitEnvParamEntry);
|
||||||
|
|
||||||
|
my $map_entity_sensor = { 1 => 'ok', 2 => 'unavailable', 3 => 'nonoperational' };
|
||||||
|
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
|
new => {
|
||||||
rlPhdUnitEnvParamTempSensorValue => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.10' },
|
rlPhdUnitEnvParamTempSensorValue => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.10' },
|
||||||
|
rlPhdUnitEnvParamTempSensorStatus => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.11', map => $map_entity_sensor },
|
||||||
rlPhdUnitEnvParamTempSensorWarningThresholdValue => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.12' },
|
rlPhdUnitEnvParamTempSensorWarningThresholdValue => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.12' },
|
||||||
rlPhdUnitEnvParamTempSensorCriticalThresholdValue => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.13' },
|
rlPhdUnitEnvParamTempSensorCriticalThresholdValue => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.13' }
|
||||||
};
|
},
|
||||||
my $oid_rlPhdUnitEnvParamEntry = '.1.3.6.1.4.1.9.6.1.101.53.15.1';
|
old => {
|
||||||
|
rlPhdUnitEnvParamTempSensorValue => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.9' },
|
||||||
sub load {
|
rlPhdUnitEnvParamTempSensorStatus => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.10', map => $map_entity_sensor },
|
||||||
my ($self) = @_;
|
|
||||||
|
|
||||||
push @{$self->{request}}, {
|
|
||||||
oid => $oid_rlPhdUnitEnvParamEntry,
|
|
||||||
start => $mapping->{rlPhdUnitEnvParamTempSensorValue}->{oid},
|
|
||||||
end => $mapping->{rlPhdUnitEnvParamTempSensorCriticalThresholdValue}->{oid},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
sub load {}
|
||||||
|
|
||||||
sub check {
|
sub check {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
@ -48,28 +49,47 @@ sub check {
|
|||||||
return if ($self->check_filter(section => 'temperature'));
|
return if ($self->check_filter(section => 'temperature'));
|
||||||
|
|
||||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rlPhdUnitEnvParamEntry}})) {
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rlPhdUnitEnvParamEntry}})) {
|
||||||
next if ($oid !~ /^$mapping->{rlPhdUnitEnvParamTempSensorValue}->{oid}\.(.*)$/);
|
next if ($oid !~ /^$mapping->{new}->{rlPhdUnitEnvParamTempSensorValue}->{oid}\.(.*)$/);
|
||||||
my $instance = $1;
|
my $instance = $1;
|
||||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_rlPhdUnitEnvParamEntry}, instance => $instance);
|
my $result = $self->{snmp}->map_instance(
|
||||||
|
mapping => $self->{sb_new} == 1 ? $mapping->{new} : $mapping->{old},
|
||||||
|
results => $self->{results}->{$oid_rlPhdUnitEnvParamEntry},
|
||||||
|
instance => $instance
|
||||||
|
);
|
||||||
|
|
||||||
next if ($self->check_filter(section => 'temperature', instance => $instance));
|
next if ($self->check_filter(section => 'temperature', instance => $instance));
|
||||||
$self->{components}->{temperature}->{total}++;
|
$self->{components}->{temperature}->{total}++;
|
||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"temperature '%s' is %s degree centigrade [instance = %s]",
|
"temperature '%s' status is '%s' [instance = %s, value: %s degree centigrade]",
|
||||||
$instance, $result->{rlPhdUnitEnvParamTempSensorValue}, $instance,
|
$instance,
|
||||||
|
$result->{rlPhdUnitEnvParamTempSensorStatus},
|
||||||
|
$instance,
|
||||||
|
$result->{rlPhdUnitEnvParamTempSensorValue}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{rlPhdUnitEnvParamTempSensorValue});
|
my $exit = $self->get_severity(section => 'temperature', value => $result->{rlPhdUnitEnvParamTempSensorStatus});
|
||||||
if ($checked == 0) {
|
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'",
|
||||||
|
$instance,
|
||||||
|
$result->{rlPhdUnitEnvParamTempSensorStatus}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{rlPhdUnitEnvParamTempSensorValue});
|
||||||
|
if ($checked == 0 && defined($result->{rlPhdUnitEnvParamTempSensorWarningThresholdValue})) {
|
||||||
my $warn_th = ':' . $result->{rlPhdUnitEnvParamTempSensorWarningThresholdValue};
|
my $warn_th = ':' . $result->{rlPhdUnitEnvParamTempSensorWarningThresholdValue};
|
||||||
my $crit_th = ':' . $result->{rlPhdUnitEnvParamTempSensorCriticalThresholdValue};
|
my $crit_th = ':' . $result->{rlPhdUnitEnvParamTempSensorCriticalThresholdValue};
|
||||||
$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(
|
$exit2 = $self->{perfdata}->threshold_check(
|
||||||
value => $result->{rlPhdUnitEnvParamTempSensorValue},
|
value => $result->{rlPhdUnitEnvParamTempSensorValue},
|
||||||
threshold => [
|
threshold => [
|
||||||
{ label => 'critical-temperature-instance-' . $instance, exit_litteral => 'critical' },
|
{ label => 'critical-temperature-instance-' . $instance, exit_litteral => 'critical' },
|
||||||
@ -81,8 +101,14 @@ sub check {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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", $instance, $result->{rlPhdUnitEnvParamTempSensorValue}));
|
severity => $exit2,
|
||||||
|
short_msg => sprintf(
|
||||||
|
"Temperature '%s' is %s degree centigrade",
|
||||||
|
$instance,
|
||||||
|
$result->{rlPhdUnitEnvParamTempSensorValue}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'temp', unit => 'C',
|
label => 'temp', unit => 'C',
|
||||||
@ -90,7 +116,7 @@ sub check {
|
|||||||
instances => $instance,
|
instances => $instance,
|
||||||
value => $result->{rlPhdUnitEnvParamTempSensorValue},
|
value => $result->{rlPhdUnitEnvParamTempSensorValue},
|
||||||
warning => $warn,
|
warning => $warn,
|
||||||
critical => $crit,
|
critical => $crit
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,10 @@ use base qw(centreon::plugins::templates::hardware);
|
|||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
use centreon::common::cisco::smallbusiness::snmp::mode::components::resources qw(
|
||||||
|
$oid_rlPhdUnitEnvParamEntry
|
||||||
|
$oid_rlPhdUnitEnvParamMonitorAutoRecoveryEnable
|
||||||
|
);
|
||||||
|
|
||||||
sub set_system {
|
sub set_system {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
@ -34,7 +38,7 @@ sub set_system {
|
|||||||
$self->{cb_hook2} = 'snmp_execute';
|
$self->{cb_hook2} = 'snmp_execute';
|
||||||
|
|
||||||
$self->{thresholds} = {
|
$self->{thresholds} = {
|
||||||
fan => [
|
default => [
|
||||||
['normal', 'OK'],
|
['normal', 'OK'],
|
||||||
['notPresent', 'OK'],
|
['notPresent', 'OK'],
|
||||||
['warning', 'WARNING'],
|
['warning', 'WARNING'],
|
||||||
@ -42,13 +46,10 @@ sub set_system {
|
|||||||
['shutdown', 'CRITICAL'],
|
['shutdown', 'CRITICAL'],
|
||||||
['notFunctioning', 'CRITICAL'],
|
['notFunctioning', 'CRITICAL'],
|
||||||
],
|
],
|
||||||
psu => [
|
temperature => [
|
||||||
['normal', 'OK'],
|
['ok', 'OK'],
|
||||||
['notPresent', 'OK'],
|
['unavailable', 'OK'],
|
||||||
['warning', 'WARNING'],
|
['nonoperational', 'CRITICAL'],
|
||||||
['critical', 'CRITICAL'],
|
|
||||||
['shutdown', 'CRITICAL'],
|
|
||||||
['notFunctioning', 'CRITICAL'],
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -60,7 +61,20 @@ sub snmp_execute {
|
|||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{snmp} = $options{snmp};
|
$self->{snmp} = $options{snmp};
|
||||||
|
push @{$self->{request}}, {
|
||||||
|
oid => $oid_rlPhdUnitEnvParamEntry,
|
||||||
|
start => '.1.3.6.1.4.1.9.6.1.101.53.15.1.2', # rlPhdUnitEnvParamMainPSStatus
|
||||||
|
end => $oid_rlPhdUnitEnvParamMonitorAutoRecoveryEnable
|
||||||
|
};
|
||||||
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
|
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
|
||||||
|
|
||||||
|
$self->{sb_new} = 0;
|
||||||
|
foreach (keys %{$self->{results}->{$oid_rlPhdUnitEnvParamEntry}}) {
|
||||||
|
if (/^$oid_rlPhdUnitEnvParamMonitorAutoRecoveryEnable\./) {
|
||||||
|
$self->{sb_new} = 1;
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user