enhance cisco sb
This commit is contained in:
parent
a904a8275a
commit
9a4554c8e8
|
@ -22,55 +22,141 @@ package centreon::common::cisco::smallbusiness::snmp::mode::components::fan;
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_fan_status = (
|
||||
1 => 'normal',
|
||||
2 => 'warning',
|
||||
3 => 'critical',
|
||||
4 => 'shutdown',
|
||||
5 => 'notPresent',
|
||||
6 => 'notFunctioning'
|
||||
use centreon::common::cisco::smallbusiness::snmp::mode::components::resources qw(
|
||||
$rl_envmon_state
|
||||
$oid_rlPhdUnitEnvParamMonitorAutoRecoveryEnable
|
||||
$oid_rlPhdUnitEnvParamEntry
|
||||
);
|
||||
|
||||
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 = {
|
||||
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';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_rlEnvMonFanStatusEntry };
|
||||
|
||||
push @{$self->{request}}, {
|
||||
oid => $oid_rlEnvMonFanStatusEntry,
|
||||
start => $mapping->{rlEnvMonFanStatusDescr}->{oid},
|
||||
end => $mapping->{rlEnvMonFanState}->{oid}
|
||||
};
|
||||
}
|
||||
|
||||
sub check_fan_stack {
|
||||
my ($self) = @_;
|
||||
|
||||
my $num_fans = 5;
|
||||
$num_fans = 6 if ($self->{sb_new} == 1);
|
||||
|
||||
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}})) {
|
||||
next if ($oid !~ /^$mapping->{rlEnvMonFanState}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_rlEnvMonFanStatusEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'fan', instance => $instance));
|
||||
if ($result->{rlEnvMonFanState} =~ /notPresent/i) {
|
||||
$self->absent_problem(section => 'fan', instance => $instance);
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{components}->{fan}->{total}++;
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"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)) {
|
||||
$self->{output}->output_add(
|
||||
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};
|
||||
$self->{components}->{fan} = { name => 'fan', total => 0, skip => 0 };
|
||||
return if ($self->check_filter(section => 'fan'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rlEnvMonFanStatusEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{rlEnvMonFanState}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_rlEnvMonFanStatusEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'fan', instance => $instance));
|
||||
if ($result->{rlEnvMonFanState} =~ /notPresent/i) {
|
||||
$self->absent_problem(section => 'fan', instance => $instance);
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{components}->{fan}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Fan '%s' status is '%s' [instance = %s]",
|
||||
$result->{rlEnvMonFanStatusDescr}, $result->{rlEnvMonFanState}, $instance));
|
||||
my $exit = $self->get_severity(section => 'fan', value => $result->{rlEnvMonFanState});
|
||||
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'", $result->{rlEnvMonFanStatusDescr}, $result->{rlEnvMonFanState}));
|
||||
}
|
||||
}
|
||||
check_fan($self);
|
||||
check_fan_stack($self);
|
||||
}
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
@ -22,55 +22,119 @@ package centreon::common::cisco::smallbusiness::snmp::mode::components::psu;
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_psu_status = (
|
||||
1 => 'normal',
|
||||
2 => 'warning',
|
||||
3 => 'critical',
|
||||
4 => 'shutdown',
|
||||
5 => 'notPresent',
|
||||
6 => 'notFunctioning'
|
||||
use centreon::common::cisco::smallbusiness::snmp::mode::components::resources qw(
|
||||
$rl_envmon_state
|
||||
$oid_rlPhdUnitEnvParamEntry
|
||||
);
|
||||
|
||||
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 = {
|
||||
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';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_rlEnvMonSupplyStatusEntry };
|
||||
|
||||
push @{$self->{request}}, {
|
||||
oid => $oid_rlEnvMonSupplyStatusEntry,
|
||||
$mapping->{rlEnvMonSupplyStatusDescr}->{oid},
|
||||
$mapping->{rlEnvMonSupplyState}->{oid}
|
||||
};
|
||||
}
|
||||
|
||||
sub check_psu_stack {
|
||||
my ($self) = @_;
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rlPhdUnitEnvParamEntry}})) {
|
||||
next if ($oid !~ /^$mapping_stack->{rlPhdUnitEnvParamMainPSStatus}->{oid}\.(.*)$/);
|
||||
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}})) {
|
||||
next if ($oid !~ /^$mapping->{rlEnvMonSupplyState}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_rlEnvMonSupplyStatusEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'psu', instance => $instance));
|
||||
if ($result->{rlEnvMonSupplyState} =~ /notPresent/i) {
|
||||
$self->absent_problem(section => 'psu', instance => $instance);
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{components}->{psu}->{total}++;
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"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)) {
|
||||
$self->{output}->output_add(
|
||||
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};
|
||||
$self->{components}->{psu} = { name => 'psu', total => 0, skip => 0 };
|
||||
return if ($self->check_filter(section => 'psu'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rlEnvMonSupplyStatusEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{rlEnvMonSupplyState}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_rlEnvMonSupplyStatusEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'psu', instance => $instance));
|
||||
if ($result->{rlEnvMonSupplyState} =~ /notPresent/i) {
|
||||
$self->absent_problem(section => 'psu', instance => $instance);
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{components}->{psu}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Power supply '%s' status is '%s' [instance = %s]",
|
||||
$result->{rlEnvMonSupplyStatusDescr}, $result->{rlEnvMonSupplyState}, $instance));
|
||||
my $exit = $self->get_severity(section => 'psu', value => $result->{rlEnvMonSupplyState});
|
||||
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'", $result->{rlEnvMonSupplyStatusDescr}, $result->{rlEnvMonSupplyState}));
|
||||
}
|
||||
}
|
||||
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,54 +22,74 @@ package centreon::common::cisco::smallbusiness::snmp::mode::components::temperat
|
|||
|
||||
use strict;
|
||||
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 = {
|
||||
rlPhdUnitEnvParamTempSensorValue => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.10' },
|
||||
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' },
|
||||
new => {
|
||||
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' },
|
||||
rlPhdUnitEnvParamTempSensorCriticalThresholdValue => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.13' }
|
||||
},
|
||||
old => {
|
||||
rlPhdUnitEnvParamTempSensorValue => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.9' },
|
||||
rlPhdUnitEnvParamTempSensorStatus => { oid => '.1.3.6.1.4.1.9.6.1.101.53.15.1.10', map => $map_entity_sensor },
|
||||
}
|
||||
};
|
||||
my $oid_rlPhdUnitEnvParamEntry = '.1.3.6.1.4.1.9.6.1.101.53.15.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, {
|
||||
oid => $oid_rlPhdUnitEnvParamEntry,
|
||||
start => $mapping->{rlPhdUnitEnvParamTempSensorValue}->{oid},
|
||||
end => $mapping->{rlPhdUnitEnvParamTempSensorCriticalThresholdValue}->{oid},
|
||||
};
|
||||
}
|
||||
sub load {}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking temperatures");
|
||||
$self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0};
|
||||
$self->{components}->{temperature} = { name => 'temperatures', total => 0, skip => 0 };
|
||||
return if ($self->check_filter(section => 'temperature'));
|
||||
|
||||
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 $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));
|
||||
$self->{components}->{temperature}->{total}++;
|
||||
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"temperature '%s' is %s degree centigrade [instance = %s]",
|
||||
$instance, $result->{rlPhdUnitEnvParamTempSensorValue}, $instance,
|
||||
"temperature '%s' status is '%s' [instance = %s, value: %s degree centigrade]",
|
||||
$instance,
|
||||
$result->{rlPhdUnitEnvParamTempSensorStatus},
|
||||
$instance,
|
||||
$result->{rlPhdUnitEnvParamTempSensorValue}
|
||||
)
|
||||
);
|
||||
|
||||
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{rlPhdUnitEnvParamTempSensorValue});
|
||||
if ($checked == 0) {
|
||||
my $exit = $self->get_severity(section => 'temperature', value => $result->{rlPhdUnitEnvParamTempSensorStatus});
|
||||
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 $crit_th = ':' . $result->{rlPhdUnitEnvParamTempSensorCriticalThresholdValue};
|
||||
$self->{perfdata}->threshold_validate(label => 'warning-temperature-instance-' . $instance, value => $warn_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},
|
||||
threshold => [
|
||||
{ label => 'critical-temperature-instance-' . $instance, exit_litteral => 'critical' },
|
||||
|
@ -79,10 +99,16 @@ sub check {
|
|||
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-temperature-instance-' . $instance);
|
||||
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-temperature-instance-' . $instance);
|
||||
}
|
||||
|
||||
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Temperature '%s' is %s degree centigrade", $instance, $result->{rlPhdUnitEnvParamTempSensorValue}));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit2,
|
||||
short_msg => sprintf(
|
||||
"Temperature '%s' is %s degree centigrade",
|
||||
$instance,
|
||||
$result->{rlPhdUnitEnvParamTempSensorValue}
|
||||
)
|
||||
);
|
||||
}
|
||||
$self->{output}->perfdata_add(
|
||||
label => 'temp', unit => 'C',
|
||||
|
@ -90,7 +116,7 @@ sub check {
|
|||
instances => $instance,
|
||||
value => $result->{rlPhdUnitEnvParamTempSensorValue},
|
||||
warning => $warn,
|
||||
critical => $crit,
|
||||
critical => $crit
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,17 +24,21 @@ use base qw(centreon::plugins::templates::hardware);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::common::cisco::smallbusiness::snmp::mode::components::resources qw(
|
||||
$oid_rlPhdUnitEnvParamEntry
|
||||
$oid_rlPhdUnitEnvParamMonitorAutoRecoveryEnable
|
||||
);
|
||||
|
||||
sub set_system {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
$self->{regexp_threshold_overload_check_section_option} = '^(?:fan|psu|temperature)$';
|
||||
$self->{regexp_threshold_numeric_check_section_option} = '^temperature$';
|
||||
|
||||
$self->{regexp_threshold_numeric_check_section_option} = '^temperature$';
|
||||
|
||||
$self->{cb_hook2} = 'snmp_execute';
|
||||
|
||||
|
||||
$self->{thresholds} = {
|
||||
fan => [
|
||||
default => [
|
||||
['normal', 'OK'],
|
||||
['notPresent', 'OK'],
|
||||
['warning', 'WARNING'],
|
||||
|
@ -42,25 +46,35 @@ sub set_system {
|
|||
['shutdown', 'CRITICAL'],
|
||||
['notFunctioning', 'CRITICAL'],
|
||||
],
|
||||
psu => [
|
||||
['normal', 'OK'],
|
||||
['notPresent', 'OK'],
|
||||
['warning', 'WARNING'],
|
||||
['critical', 'CRITICAL'],
|
||||
['shutdown', 'CRITICAL'],
|
||||
['notFunctioning', 'CRITICAL'],
|
||||
temperature => [
|
||||
['ok', 'OK'],
|
||||
['unavailable', 'OK'],
|
||||
['nonoperational', 'CRITICAL'],
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
$self->{components_path} = 'centreon::common::cisco::smallbusiness::snmp::mode::components';
|
||||
$self->{components_module} = ['psu', 'fan', 'temperature'];
|
||||
}
|
||||
|
||||
sub snmp_execute {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
$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->{sb_new} = 0;
|
||||
foreach (keys %{$self->{results}->{$oid_rlPhdUnitEnvParamEntry}}) {
|
||||
if (/^$oid_rlPhdUnitEnvParamMonitorAutoRecoveryEnable\./) {
|
||||
$self->{sb_new} = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub new {
|
||||
|
|
Loading…
Reference in New Issue