Add xFusion iBMC snmp monitoring (#4043)

This commit is contained in:
christophe-activiumid 2022-11-09 11:42:28 +01:00 committed by GitHub
parent 2878d98578
commit 5eabb2d09d
12 changed files with 1081 additions and 0 deletions

View File

@ -0,0 +1,86 @@
#
# Copyright 2022 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 hardware::server::xfusion::ibmc::snmp::mode::components::component;
use strict;
use warnings;
my %map_status = (
1 => 'ok',
2 => 'minor',
3 => 'major',
4 => 'critical',
5 => 'absence',
6 => 'unknown',
);
my %map_type = (
1 => 'baseBoard',
2 => 'mezzCard',
3 => 'amcController',
4 => 'mmcController',
5 => 'hddBackPlane',
6 => 'raidCard',
);
my $mapping = {
componentName => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.10.50.1.1' },
componentType => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.10.50.1.2', map => \%map_type },
componentStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.10.50.1.5', map => \%map_status },
};
my $oid_componentDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.10.50.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, { oid => $oid_componentDescriptionEntry };
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking component");
$self->{components}->{component} = {name => 'components', total => 0, skip => 0};
return if ($self->check_filter(section => 'component'));
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_componentDescriptionEntry}})) {
next if ($oid !~ /^$mapping->{componentStatus}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_componentDescriptionEntry}, instance => $instance);
next if ($self->check_filter(section => 'component', instance => $instance));
next if ($result->{componentStatus} =~ /absence/);
$self->{components}->{component}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Component '%s' of type '%s' status is '%s' [instance = %s]",
$result->{componentName}, $result->{componentType}, $result->{componentStatus}, $instance,
));
my $exit = $self->get_severity(label => 'default', section => 'component', value => $result->{componentStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Component '%s' of type '%s' status is '%s'",
$result->{componentName}, $result->{componentType}, $result->{componentStatus}));
}
}
}
1;

View File

@ -0,0 +1,79 @@
#
# Copyright 2022 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 hardware::server::xfusion::ibmc::snmp::mode::components::cpu;
use strict;
use warnings;
my %map_status = (
1 => 'ok',
2 => 'minor',
3 => 'major',
4 => 'critical',
5 => 'absence',
6 => 'unknown',
);
my $mapping = {
cpuStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.15.50.1.6', map => \%map_status },
cpuDevicename => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.15.50.1.10' },
};
my $oid_cpuDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.15.50.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, {
oid => $oid_cpuDescriptionEntry,
start => $mapping->{cpuStatus}->{oid},
end => $mapping->{cpuDevicename}->{oid},
};
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking CPU");
$self->{components}->{cpu} = {name => 'cpu', total => 0, skip => 0};
return if ($self->check_filter(section => 'cpu'));
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpuDescriptionEntry}})) {
next if ($oid !~ /^$mapping->{cpuStatus}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpuDescriptionEntry}, instance => $instance);
next if ($self->check_filter(section => 'cpu', instance => $instance));
next if ($result->{cpuStatus} =~ /absence/);
$self->{components}->{cpu}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Cpu '%s' status is '%s' [instance = %s]",
$result->{cpuDevicename}, $result->{cpuStatus}, $instance,
));
my $exit = $self->get_severity(label => 'default', section => 'cpu', value => $result->{cpuStatus});
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'", $result->{cpuDevicename}, $result->{cpuStatus}));
}
}
}
1;

View File

@ -0,0 +1,102 @@
#
# Copyright 2022 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 hardware::server::xfusion::ibmc::snmp::mode::components::fan;
use strict;
use warnings;
my %map_status = (
1 => 'ok',
2 => 'minor',
3 => 'major',
4 => 'critical',
5 => 'absence',
6 => 'unknown',
);
my %map_installation_status = (
1 => 'absence',
2 => 'presence',
3 => 'unknown',
);
my $mapping = {
fanSpeed => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.8.50.1.2' },
fanPresence => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.8.50.1.3', map => \%map_installation_status },
fanStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.8.50.1.4', map => \%map_status },
fanDevicename => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.8.50.1.7' },
};
my $oid_fanDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.8.50.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, { oid => $oid_fanDescriptionEntry };
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking fans");
$self->{components}->{fan} = {name => 'fans', total => 0, skip => 0};
return if ($self->check_filter(section => 'fan'));
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_fanDescriptionEntry}})) {
next if ($oid !~ /^$mapping->{fanStatus}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_fanDescriptionEntry}, instance => $instance);
next if ($self->check_filter(section => 'fan', instance => $instance));
next if ($result->{fanPresence} !~ /presence/);
$self->{components}->{fan}->{total}++;
if (defined($result->{fanSpeed}) && $result->{fanSpeed} =~ /[0-9]/) {
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => $instance, value => $result->{fanSpeed});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Fan '%s' speed is %s RPM", $result->{fanDevicename}, $result->{fanSpeed}));
}
$self->{output}->perfdata_add(
label => 'speed', unit => 'rpm',
nlabel => 'hardware.fan.speed.rpm',
instances => $result->{fanDevicename},
value => $result->{fanSpeed},
warning => $warn,
critical => $crit,
min => 0
);
}
$self->{output}->output_add(long_msg => sprintf("Fan '%s' status is '%s' [instance = %s]",
$result->{fanDevicename}, $result->{fanStatus}, $instance,
));
my $exit = $self->get_severity(label => 'default', section => 'fan', value => $result->{fanStatus});
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->{fanDevicename}, $result->{fanStatus}));
}
}
}
1;

View File

@ -0,0 +1,106 @@
#
# Copyright 2022 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 hardware::server::xfusion::ibmc::snmp::mode::components::harddisk;
use strict;
use warnings;
my %map_status = (
1 => 'ok',
2 => 'minor',
3 => 'major',
4 => 'critical',
5 => 'absence',
6 => 'unknown',
);
my %map_installation_status = (
1 => 'absence',
2 => 'presence',
3 => 'unknown',
);
my $mapping = {
hardDiskPresence => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.18.50.1.2', map => \%map_installation_status },
hardDiskStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.18.50.1.3', map => \%map_status },
hardDiskDevicename => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.18.50.1.6' },
hardDiskTemperature => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.18.50.1.20' },
};
my $oid_hardDiskDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.18.50.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, {
oid => $oid_hardDiskDescriptionEntry,
start => $mapping->{hardDiskPresence}->{oid},
end => $mapping->{hardDiskTemperature}->{oid},
};
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking hard disks");
$self->{components}->{harddisk} = {name => 'hard disks', total => 0, skip => 0};
return if ($self->check_filter(section => 'harddisk'));
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_hardDiskDescriptionEntry}})) {
next if ($oid !~ /^$mapping->{hardDiskStatus}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_hardDiskDescriptionEntry}, instance => $instance);
next if ($self->check_filter(section => 'harddisk', instance => $instance));
next if ($result->{hardDiskPresence} !~ /presence/);
$self->{components}->{harddisk}->{total}++;
if (defined($result->{hardDiskTemperature}) && $result->{hardDiskTemperature} =~ /[0-9]/) {
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'harddisk', instance => $instance, value => $result->{hardDiskTemperature});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Hard Disk '%s' temperature is %s celsius degrees", $result->{hardDiskDevicename}, $result->{hardDiskTemperature}));
}
$self->{output}->perfdata_add(
label => 'temperature', unit => 'C',
nlabel => 'hardware.harddisk.temperature.celsius',
instances => $result->{hardDiskDevicename},
value => $result->{hardDiskTemperature},
warning => $warn,
critical => $crit,
min => 0
);
}
$self->{output}->output_add(long_msg => sprintf("Hard disk '%s' status is '%s' [instance = %s]",
$result->{hardDiskDevicename}, $result->{hardDiskStatus}, $instance,
));
my $exit = $self->get_severity(label => 'default', section => 'harddisk', value => $result->{hardDiskStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Hard disk '%s' status is '%s'", $result->{hardDiskDevicename}, $result->{hardDiskStatus}));
}
}
}
1;

View File

@ -0,0 +1,80 @@
#
# Copyright 2022 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 hardware::server::xfusion::ibmc::snmp::mode::components::logicaldrive;
use strict;
use warnings;
my %map_state = (
1 => 'offline',
2 => 'partial degraded',
3 => 'degraded',
4 => 'optimal',
255 => 'unknown',
);
my $mapping = {
logicalDriveRAIDControllerIndex => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.37.50.1.1' },
logicalDriveIndex => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.37.50.1.2' },
logicalDriveState => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.37.50.1.4', map => \%map_state },
};
my $oid_logicalDriveDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.37.50.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, {
oid => $oid_logicalDriveDescriptionEntry,
end => $mapping->{logicalDriveState}->{oid},
};
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking logical drives");
$self->{components}->{logicaldrive} = {name => 'logical drives', total => 0, skip => 0};
return if ($self->check_filter(section => 'logicaldrive'));
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_logicalDriveDescriptionEntry}})) {
next if ($oid !~ /^$mapping->{logicalDriveState}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_logicalDriveDescriptionEntry}, instance => $instance);
next if ($self->check_filter(section => 'logicaldrive', instance => $instance));
$self->{components}->{logicaldrive}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Logical drive '%s.%s' status is '%s' [instance = %s]",
$result->{logicalDriveRAIDControllerIndex}, $result->{logicalDriveIndex}, $result->{logicalDriveState}, $instance,
));
my $exit = $self->get_severity(section => 'logicaldrive', value => $result->{logicalDriveState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Logical drive '%s.%s' status is '%s'",
$result->{logicalDriveRAIDControllerIndex},
$result->{logicalDriveIndex},
$result->{logicalDriveState}));
}
}
}
1;

View File

@ -0,0 +1,79 @@
#
# Copyright 2022 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 hardware::server::xfusion::ibmc::snmp::mode::components::memory;
use strict;
use warnings;
my %map_status = (
1 => 'ok',
2 => 'minor',
3 => 'major',
4 => 'critical',
5 => 'absence',
6 => 'unknown',
);
my $mapping = {
memoryStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.16.50.1.6', map => \%map_status },
memoryDevicename => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.16.50.1.10' },
};
my $oid_memoryDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.16.50.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, {
oid => $oid_memoryDescriptionEntry,
start => $mapping->{memoryStatus}->{oid},
end => $mapping->{memoryDevicename}->{oid},
};
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking memory");
$self->{components}->{memory} = {name => 'memorys', total => 0, skip => 0};
return if ($self->check_filter(section => 'memory'));
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_memoryDescriptionEntry}})) {
next if ($oid !~ /^$mapping->{memoryStatus}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_memoryDescriptionEntry}, instance => $instance);
next if ($self->check_filter(section => 'memory', instance => $instance));
next if ($result->{memoryStatus} =~ /absence/);
$self->{components}->{memory}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Memory '%s' status is '%s' [instance = %s]",
$result->{memoryDevicename}, $result->{memoryStatus}, $instance,
));
my $exit = $self->get_severity(label => 'default', section => 'memory', value => $result->{memoryStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Memory '%s' status is '%s'", $result->{memoryDevicename}, $result->{memoryStatus}));
}
}
}
1;

View File

@ -0,0 +1,86 @@
#
# Copyright 2022 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 hardware::server::xfusion::ibmc::snmp::mode::components::pcie;
use strict;
use warnings;
my %map_status = (
1 => 'ok',
2 => 'minor',
3 => 'major',
4 => 'critical',
5 => 'absence',
6 => 'unknown',
);
my %map_installation_status = (
1 => 'absence',
2 => 'presence',
3 => 'unknown',
);
my $mapping = {
pCIePresence => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.24.50.1.2', map => \%map_installation_status },
pCIeStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.24.50.1.3', map => \%map_status },
pCIeDevicename => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.24.50.1.7' },
};
my $oid_pCIeDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.24.50.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, {
oid => $oid_pCIeDescriptionEntry,
start => $mapping->{pCIePresence}->{oid},
end => $mapping->{pCIeDevicename}->{oid},
};
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking PCIe");
$self->{components}->{pcie} = {name => 'pcie', total => 0, skip => 0};
return if ($self->check_filter(section => 'pcie'));
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_pCIeDescriptionEntry}})) {
next if ($oid !~ /^$mapping->{pCIeStatus}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_pCIeDescriptionEntry}, instance => $instance);
next if ($self->check_filter(section => 'pcie', instance => $instance));
next if ($result->{pCIePresence} !~ /presence/);
$self->{components}->{pcie}->{total}++;
$self->{output}->output_add(long_msg => sprintf("PCIe '%s' status is '%s' [instance = %s]",
$result->{pCIeDevicename}, $result->{pCIeStatus}, $instance,
));
my $exit = $self->get_severity(label => 'default', section => 'pcie', value => $result->{pCIeStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("PCIe '%s' status is '%s'", $result->{pCIeDevicename}, $result->{pCIeStatus}));
}
}
}
1;

View File

@ -0,0 +1,108 @@
#
# Copyright 2022 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 hardware::server::xfusion::ibmc::snmp::mode::components::psu;
use strict;
use warnings;
my %map_status = (
1 => 'ok',
2 => 'minor',
3 => 'major',
4 => 'critical',
5 => 'absence',
6 => 'unknown',
);
my %map_installation_status = (
1 => 'absence',
2 => 'presence',
3 => 'unknown',
);
my $mapping = {
powerSupplyPowerRating => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.6.50.1.6' },
powerSupplyStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.6.50.1.7', map => \%map_status },
powerSupplyInputPower => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.6.50.1.8' },
powerSupplyPresence => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.6.50.1.9', map => \%map_installation_status },
powerSupplyDevicename => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.6.50.1.13' },
};
my $oid_powerSupplyDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.6.50.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, {
oid => $oid_powerSupplyDescriptionEntry,
start => $mapping->{powerSupplyPowerRating}->{oid},
};
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking power supplies");
$self->{components}->{psu} = {name => 'power supplies', total => 0, skip => 0};
return if ($self->check_filter(section => 'psu'));
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_powerSupplyDescriptionEntry}})) {
next if ($oid !~ /^$mapping->{powerSupplyStatus}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_powerSupplyDescriptionEntry}, instance => $instance);
next if ($self->check_filter(section => 'psu', instance => $instance));
next if ($result->{powerSupplyPresence} !~ /presence/);
$self->{components}->{psu}->{total}++;
if (defined($result->{powerSupplyInputPower}) && $result->{powerSupplyInputPower} =~ /[0-9]/ &&
defined($result->{powerSupplyPowerRating}) && $result->{powerSupplyPowerRating} =~ /[0-9]/) {
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'psu', instance => $instance, value => $result->{powerSupplyInputPower});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Power supply '%s' power is %s watts", $result->{powerSupplyDevicename}, $result->{powerSupplyInputPower}));
}
$self->{output}->perfdata_add(
label => 'power', unit => 'W',
nlabel => 'hardware.powersupply.power.watt',
instances => $result->{powerSupplyDevicename},
value => $result->{powerSupplyInputPower},
warning => $warn,
critical => $crit,
min => 0,
max => $result->{powerSupplyPowerRating}
);
}
$self->{output}->output_add(long_msg => sprintf("Power supply '%s' status is '%s' [instance = %s]",
$result->{powerSupplyDevicename}, $result->{powerSupplyStatus}, $instance,
));
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'", $result->{powerSupplyDevicename}, $result->{powerSupplyStatus}));
}
}
}
1;

View File

@ -0,0 +1,99 @@
#
# Copyright 2022 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 hardware::server::xfusion::ibmc::snmp::mode::components::raidcontroller;
use strict;
use warnings;
my $mapping = {
raidControllerComponentName => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.36.50.1.4' },
raidControllerHealthStatus => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.36.50.1.7' },
};
my $oid_raidControllerDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.36.50.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, {
oid => $oid_raidControllerDescriptionEntry,
start => $mapping->{raidControllerComponentName}->{oid},
end => $mapping->{raidControllerHealthStatus}->{oid},
};
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking raid controllers");
$self->{components}->{raidcontroller} = {name => 'raidcontrollers', total => 0, skip => 0};
return if ($self->check_filter(section => 'raidcontroller'));
my %bitmap_status = (
0 => 'memory correctable error',
1 => 'memory uncorrectable error',
2 => 'memory ECC error reached limit',
3 => 'NVRAM uncorrectable error',
);
my %map_status = (
0 => 'ok',
65535 => 'unknown',
);
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_raidControllerDescriptionEntry}})) {
next if ($oid !~ /^$mapping->{raidControllerHealthStatus}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_raidControllerDescriptionEntry}, instance => $instance);
next if ($self->check_filter(section => 'raidcontroller', instance => $instance));
$self->{components}->{raidcontroller}->{total}++;
if (defined($map_status{$result->{raidControllerHealthStatus}})) {
$self->{output}->output_add(long_msg => sprintf("Raid controller '%s' status is '%s' [instance = %s]",
$result->{raidControllerComponentName}, $map_status{$result->{raidControllerHealthStatus}}, $instance,
));
my $exit = $self->get_severity(section => 'raidcontroller', value => $map_status{$result->{raidControllerHealthStatus}});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Raid controller '%s' status is '%s'", $result->{raidControllerComponentName}, $map_status{$result->{raidControllerHealthStatus}}));
}
next;
}
for (my $i = 0; $i < 4; $i++) {
next if (!($result->{raidControllerHealthStatus} & (1 << $i)));
my $status = $bitmap_status{$i};
$self->{output}->output_add(long_msg => sprintf("Raid controller '%s' status is '%s' [instance = %s]",
$result->{raidControllerComponentName}, $status, $instance,
));
my $exit = $self->get_severity(section => 'raidcontroller', value => $status);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Raid controller '%s' status is '%s'", $result->{raidControllerComponentName}, $status));
}
}
}
}
1;

View File

@ -0,0 +1,78 @@
#
# Copyright 2022 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 hardware::server::xfusion::ibmc::snmp::mode::components::temperature;
use strict;
use warnings;
my $mapping = {
temperatureObject => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.26.50.1.2' },
temperatureReading => { oid => '.1.3.6.1.4.1.58132.2.235.1.1.26.50.1.3' },
};
my $oid_temperatureDescriptionEntry = '.1.3.6.1.4.1.58132.2.235.1.1.26.50.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, {
oid => $oid_temperatureDescriptionEntry,
start => $mapping->{temperatureObject}->{oid},
end => $mapping->{temperatureReading}->{oid},
};
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking temperatures");
$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_temperatureDescriptionEntry}})) {
next if ($oid !~ /^$mapping->{temperatureReading}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_temperatureDescriptionEntry}, instance => $instance);
next if ($self->check_filter(section => 'temperature', instance => $instance));
next if ($result->{temperatureReading} == 65535);
$self->{components}->{temperature}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Temperature of '%s' is '%s' celsius degrees [instance = %s]",
$result->{temperatureObject}, $result->{temperatureReading} / 10, $instance,
));
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{temperatureReading} / 10);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Temperature of '%s' is '%s' celsius degrees", $result->{temperatureObject}, $result->{temperatureReading} / 10));
}
$self->{output}->perfdata_add(
label => 'temperature', unit => 'C',
nlabel => 'hardware.temperature.celsius',
instances => $result->{temperatureObject},
value => $result->{temperatureReading} / 10,
warning => $warn,
critical => $crit
);
}
}
1;

View File

@ -0,0 +1,130 @@
#
# Copyright 2022 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 hardware::server::xfusion::ibmc::snmp::mode::hardware;
use base qw(centreon::plugins::templates::hardware);
use strict;
use warnings;
sub set_system {
my ($self, %options) = @_;
$self->{regexp_threshold_numeric_check_section_option} = '^(harddisk|fan|psu|temperature)$';
$self->{cb_hook2} = 'snmp_execute';
$self->{thresholds} = {
'default' => [
['ok', 'OK'],
['minor', 'WARNING'],
['major', 'CRITICAL'],
['critical', 'CRITICAL'],
['absence', 'UNKNOWN'],
['unknown', 'UNKNOWN']
],
'logicaldrive' => [
['offline', 'OK'],
['partial degraded', 'WARNING'],
['degraded', 'CRITICAL'],
['optimal', 'OK'],
['unknown', 'UNKNOWN']
],
'raidcontroller' => [
['memory correctable error', 'WARNING'],
['memory uncorrectable error', 'CRITICAL'],
['memory ECC error reached limit', 'CRITICAL'],
['NVRAM uncorrectable error', 'CRITICAL'],
['ok', 'OK'],
['unknown', 'UNKNOWN']
]
};
$self->{components_path} = 'hardware::server::xfusion::ibmc::snmp::mode::components';
$self->{components_module} = [
'component', 'cpu', 'harddisk', 'fan', 'logicaldrive',
'memory', 'pcie', 'psu', 'raidcontroller', 'temperature'
];
}
sub snmp_execute {
my ($self, %options) = @_;
$self->{snmp} = $options{snmp};
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments => {});
return $self;
}
1;
__END__
=head1 MODE
Check hardware components.
=over 8
=item B<--component>
Which component to check (Default: '.*').
Can be: 'component', 'cpu', 'harddisk', 'fan', 'logicaldrive',
'memory', 'pcie', 'psu', 'raidcontroller', 'temperature'.
=item B<--filter>
Exclude some parts (comma seperated list) (Example: --filter=psu)
Can also exclude specific instance: --filter=psu,1
=item B<--no-component>
Return an error if no components are checked.
If total (with skipped) is 0. (Default: 'critical' returns).
=item B<--threshold-overload>
Set to overload default threshold values (syntax: section,[instance,]status,regexp)
It used before default thresholds (order stays).
Example: --threshold-overload='psu,CRITICAL,^(?!(ok)$)'
=item B<--warning>
Set warning threshold (syntax: type,regexp,threshold)
Example: --warning='psu,.*,300'
=item B<--critical>
Set critical threshold (syntax: type,regexp,threshold)
Example: --critical='psu,.*,400'
=back
=cut

View File

@ -0,0 +1,48 @@
#
# Copyright 2022 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 hardware::server::xfusion::ibmc::snmp::plugin;
use strict;
use warnings;
use base qw(centreon::plugins::script_snmp);
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
%{$self->{modes}} = (
'hardware' => 'hardware::server::xfusion::ibmc::snmp::mode::hardware',
);
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check xFusion iBMC in SNMP.
=cut