enh(server/fujitsu): add disk and raid component (#2811)
This commit is contained in:
parent
4657372851
commit
da13d106e6
|
@ -25,21 +25,21 @@ use warnings;
|
||||||
|
|
||||||
my $map_sc_cpu_status = {
|
my $map_sc_cpu_status = {
|
||||||
1 => 'unknown', 2 => 'disabled', 3 => 'ok', 4 => 'not-present', 5 => 'error',
|
1 => 'unknown', 2 => 'disabled', 3 => 'ok', 4 => 'not-present', 5 => 'error',
|
||||||
6 => 'fail', 7 => 'missing-termination', 8 => 'prefailure-warning',
|
6 => 'fail', 7 => 'missing-termination', 8 => 'prefailure-warning'
|
||||||
};
|
};
|
||||||
my $map_sc2_cpu_status = {
|
my $map_sc2_cpu_status = {
|
||||||
1 => 'unknown', 2 => 'not-present', 3 => 'ok', 4 => 'disabled', 5 => 'error',
|
1 => 'unknown', 2 => 'not-present', 3 => 'ok', 4 => 'disabled', 5 => 'error',
|
||||||
6 => 'failed', 7 => 'missing-termination', 8 => 'prefailure-warning',
|
6 => 'failed', 7 => 'missing-termination', 8 => 'prefailure-warning'
|
||||||
};
|
};
|
||||||
|
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
sc => {
|
sc => {
|
||||||
cpuStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.4.1.1.6', map => $map_sc_cpu_status },
|
cpuStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.4.1.1.6', map => $map_sc_cpu_status }
|
||||||
},
|
},
|
||||||
sc2 => {
|
sc2 => {
|
||||||
sc2cpuDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.4.1.3' },
|
sc2cpuDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.4.1.3' },
|
||||||
sc2cpuStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.4.1.4', map => $map_sc2_cpu_status },
|
sc2cpuStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.4.1.4', map => $map_sc2_cpu_status }
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
my $oid_sc2CPUs = '.1.3.6.1.4.1.231.2.10.2.2.10.6.4.1';
|
my $oid_sc2CPUs = '.1.3.6.1.4.1.231.2.10.2.2.10.6.4.1';
|
||||||
|
|
||||||
|
@ -64,14 +64,19 @@ sub check_cpu {
|
||||||
$self->absent_problem(section => 'cpu', instance => $instance));
|
$self->absent_problem(section => 'cpu', instance => $instance));
|
||||||
$self->{components}->{cpu}->{total}++;
|
$self->{components}->{cpu}->{total}++;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("cpu '%s' status is '%s' [instance = %s]",
|
$self->{output}->output_add(
|
||||||
$result->{$options{name}}, $result->{$options{status}}, $instance,
|
long_msg => sprintf(
|
||||||
));
|
"cpu '%s' status is '%s' [instance: %s]",
|
||||||
|
$result->{$options{name}}, $result->{$options{status}}, $instance
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$exit = $self->get_severity(section => 'cpu', value => $result->{$options{status}});
|
$exit = $self->get_severity(section => 'cpu', value => $result->{$options{status}});
|
||||||
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("Cpu '%s' status is '%s'", $result->{$options{name}}, $result->{$options{status}}));
|
severity => $exit,
|
||||||
|
short_msg => sprintf("Cpu '%s' status is '%s'", $result->{$options{name}}, $result->{$options{status}})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,16 +84,20 @@ sub check_cpu {
|
||||||
sub check {
|
sub check {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking cpu");
|
$self->{output}->output_add(long_msg => 'Checking cpu');
|
||||||
$self->{components}->{cpu} = {name => 'cpu', total => 0, skip => 0};
|
$self->{components}->{cpu} = { name => 'cpu', total => 0, skip => 0 };
|
||||||
return if ($self->check_filter(section => 'cpu'));
|
return if ($self->check_filter(section => 'cpu'));
|
||||||
|
|
||||||
if (defined($self->{results}->{$oid_sc2CPUs}) && scalar(keys %{$self->{results}->{$oid_sc2CPUs}}) > 0) {
|
if (defined($self->{results}->{$oid_sc2CPUs}) && scalar(keys %{$self->{results}->{$oid_sc2CPUs}}) > 0) {
|
||||||
check_cpu($self, entry => $oid_sc2CPUs, mapping => $mapping->{sc2}, name => 'sc2cpuDesignation',
|
check_cpu(
|
||||||
status => 'sc2cpuStatus');
|
$self, entry => $oid_sc2CPUs, mapping => $mapping->{sc2}, name => 'sc2cpuDesignation',
|
||||||
|
status => 'sc2cpuStatus'
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
check_cpu($self, entry => $mapping->{sc}->{cpuStatus}, mapping => $mapping->{sc}, name => 'instance',
|
check_cpu(
|
||||||
status => 'cpuStatus');
|
$self, entry => $mapping->{sc}->{cpuStatus}, mapping => $mapping->{sc}, name => 'instance',
|
||||||
|
status => 'cpuStatus'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
#
|
||||||
|
# Copyright 2021 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::fujitsu::snmp::mode::components::disk;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $map_drive_status = {
|
||||||
|
1 => 'unknown', 2 => 'noDisk',
|
||||||
|
3 => 'online', 4 => 'ready',
|
||||||
|
5 => 'failed', 6 => 'rebuilding',
|
||||||
|
7 => 'hotspareGlobal', 8 => 'hotspareDedicated',
|
||||||
|
9 => 'offline', 10 => 'unconfiguredFailed',
|
||||||
|
11 => 'formatting', 12 => 'dead'
|
||||||
|
};
|
||||||
|
|
||||||
|
my $mapping = {
|
||||||
|
status => { oid => '.1.3.6.1.4.1.231.2.49.1.5.2.1.15', map => $map_drive_status } # svrPhysicalDeviceStatus
|
||||||
|
};
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
push @{$self->{request}}, { oid => $mapping->{status}->{oid} };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => 'Checking disks');
|
||||||
|
$self->{components}->{disk} = { name => 'disks', total => 0, skip => 0 };
|
||||||
|
return if ($self->check_filter(section => 'disk'));
|
||||||
|
|
||||||
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{ $mapping->{status}->{oid} }})) {
|
||||||
|
next if ($oid !~ /^$mapping->{status}->{oid}\.(\d+)\.(\d+)\.(\d+)\.(\d+)$/);
|
||||||
|
my $instance = $1 . '.' . $2 . '.' . $3 . '.' . $4;
|
||||||
|
my $name = $1 . ':' . $2 . ':' . $3 . ':' . $4;
|
||||||
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{ $mapping->{status}->{oid} }, instance => $instance);
|
||||||
|
|
||||||
|
next if ($self->check_filter(section => 'disk', instance => $instance));
|
||||||
|
$self->{components}->{disk}->{total}++;
|
||||||
|
|
||||||
|
$self->{output}->output_add(
|
||||||
|
long_msg => sprintf(
|
||||||
|
"disk '%s' status is '%s' [instance: %s]",
|
||||||
|
$name, $result->{status}, $instance
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
my $exit = $self->get_severity(section => 'disk', value => $result->{status});
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(
|
||||||
|
severity => $exit,
|
||||||
|
short_msg => sprintf("Disk '%s' status is '%s'", $name, $result->{status})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
|
@ -26,25 +26,25 @@ use warnings;
|
||||||
my $map_sc_fan_status = {
|
my $map_sc_fan_status = {
|
||||||
1 => 'unknown', 2 => 'disabled', 3 => 'ok', 4 => 'fail',
|
1 => 'unknown', 2 => 'disabled', 3 => 'ok', 4 => 'fail',
|
||||||
5 => 'prefailure-predicted', 6 => 'redundant-fan-failed',
|
5 => 'prefailure-predicted', 6 => 'redundant-fan-failed',
|
||||||
7 => 'not-manageable', 8 => 'not-present',
|
7 => 'not-manageable', 8 => 'not-present'
|
||||||
};
|
};
|
||||||
my $map_sc2_fan_status = {
|
my $map_sc2_fan_status = {
|
||||||
1 => 'unknown', 2 => 'disabled', 3 => 'ok', 4 => 'failed',
|
1 => 'unknown', 2 => 'disabled', 3 => 'ok', 4 => 'failed',
|
||||||
5 => 'prefailure-predicted', 6 => 'redundant-fan-failed',
|
5 => 'prefailure-predicted', 6 => 'redundant-fan-failed',
|
||||||
7 => 'not-manageable', 8 => 'not-present',
|
7 => 'not-manageable', 8 => 'not-present'
|
||||||
};
|
};
|
||||||
|
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
sc => {
|
sc => {
|
||||||
fanStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.2.2.1.3', map => $map_sc_fan_status },
|
fanStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.2.2.1.3', map => $map_sc_fan_status },
|
||||||
fanCurrentSpeed => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.2.2.1.8' },
|
fanCurrentSpeed => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.2.2.1.8' },
|
||||||
fanDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.2.2.1.16' },
|
fanDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.2.2.1.16' }
|
||||||
},
|
},
|
||||||
sc2 => {
|
sc2 => {
|
||||||
sc2fanDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.3' },
|
sc2fanDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.3' },
|
||||||
sc2fanStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.5', map => $map_sc2_fan_status },
|
sc2fanStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.5', map => $map_sc2_fan_status },
|
||||||
sc2fanCurrentSpeed => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.6' },
|
sc2fanCurrentSpeed => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.6' }
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
my $oid_sc2Fans = '.1.3.6.1.4.1.231.2.10.2.2.10.5.2.1';
|
my $oid_sc2Fans = '.1.3.6.1.4.1.231.2.10.2.2.10.5.2.1';
|
||||||
my $oid_fans = '.1.3.6.1.4.1.231.2.10.2.2.5.2.2.1';
|
my $oid_fans = '.1.3.6.1.4.1.231.2.10.2.2.5.2.2.1';
|
||||||
|
@ -70,14 +70,19 @@ sub check_fan {
|
||||||
|
|
||||||
$self->{components}->{fan}->{total}++;
|
$self->{components}->{fan}->{total}++;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("fan '%s' status is '%s' [instance = %s] [speed = %s]",
|
$self->{output}->output_add(
|
||||||
$result->{$options{name}}, $result->{$options{status}}, $instance, $result->{$options{speed}}
|
long_msg => sprintf(
|
||||||
));
|
"fan '%s' status is '%s' [instance: %s] [speed: %s]",
|
||||||
|
$result->{$options{name}}, $result->{$options{status}}, $instance, $result->{$options{speed}}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$exit = $self->get_severity(section => 'fan', value => $result->{$options{status}});
|
$exit = $self->get_severity(section => 'fan', value => $result->{$options{status}});
|
||||||
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->{$options{name}}, $result->{$options{status}}));
|
severity => $exit,
|
||||||
|
short_msg => sprintf("Fan '%s' status is '%s'", $result->{$options{name}}, $result->{$options{status}})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
next if (!defined($result->{$options{speed}}) || $result->{$options{speed}} == -1);
|
next if (!defined($result->{$options{speed}}) || $result->{$options{speed}} == -1);
|
||||||
|
@ -85,12 +90,14 @@ sub check_fan {
|
||||||
($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => $instance, value => $result->{$options{speed}});
|
($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => $instance, value => $result->{$options{speed}});
|
||||||
|
|
||||||
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' speed is %s rpm", $result->{$options{name}}, $result->{$options{speed}}));
|
severity => $exit,
|
||||||
|
short_msg => sprintf("Fan '%s' speed is %s rpm", $result->{$options{name}}, $result->{$options{speed}})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'fan', unit => 'rpm',
|
|
||||||
nlabel => 'hardware.fan.speed.rpm',
|
nlabel => 'hardware.fan.speed.rpm',
|
||||||
|
unit => 'rpm',
|
||||||
instances => $result->{$options{name}},
|
instances => $result->{$options{name}},
|
||||||
value => $result->{$options{speed}},
|
value => $result->{$options{speed}},
|
||||||
warning => $warn,
|
warning => $warn,
|
||||||
|
@ -103,16 +110,20 @@ sub check_fan {
|
||||||
sub check {
|
sub check {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking fans");
|
$self->{output}->output_add(long_msg => 'Checking fans');
|
||||||
$self->{components}->{fan} = {name => 'fans', total => 0, skip => 0};
|
$self->{components}->{fan} = { name => 'fans', total => 0, skip => 0 };
|
||||||
return if ($self->check_filter(section => 'fan'));
|
return if ($self->check_filter(section => 'fan'));
|
||||||
|
|
||||||
if (defined($self->{results}->{$oid_sc2Fans}) && scalar(keys %{$self->{results}->{$oid_sc2Fans}}) > 0) {
|
if (defined($self->{results}->{$oid_sc2Fans}) && scalar(keys %{$self->{results}->{$oid_sc2Fans}}) > 0) {
|
||||||
check_fan($self, entry => $oid_sc2Fans, mapping => $mapping->{sc2}, name => 'sc2fanDesignation',
|
check_fan(
|
||||||
speed => 'sc2fanCurrentSpeed', status => 'sc2fanStatus');
|
$self, entry => $oid_sc2Fans, mapping => $mapping->{sc2}, name => 'sc2fanDesignation',
|
||||||
|
speed => 'sc2fanCurrentSpeed', status => 'sc2fanStatus'
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
check_fan($self, entry => $oid_fans, mapping => $mapping->{sc}, name => 'fanDesignation',
|
check_fan(
|
||||||
speed => 'fanCurrentSpeed', status => 'fanStatus');
|
$self, entry => $oid_fans, mapping => $mapping->{sc}, name => 'fanDesignation',
|
||||||
|
speed => 'fanCurrentSpeed', status => 'fanStatus'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,21 +26,21 @@ use warnings;
|
||||||
my $map_sc_memory_status = {
|
my $map_sc_memory_status = {
|
||||||
1 => 'unknown', 2 => 'error', 3 => 'ok', 4 => 'not-available', 5 => 'fail',
|
1 => 'unknown', 2 => 'error', 3 => 'ok', 4 => 'not-available', 5 => 'fail',
|
||||||
6 => 'prefailure-warning', 7 => 'hot-spare', 8 => 'mirror',
|
6 => 'prefailure-warning', 7 => 'hot-spare', 8 => 'mirror',
|
||||||
9 => 'disabled', 10 => 'raid',
|
9 => 'disabled', 10 => 'raid'
|
||||||
};
|
};
|
||||||
my $map_sc2_memory_status = {
|
my $map_sc2_memory_status = {
|
||||||
1 => 'unknown', 2 => 'not-present', 3 => 'ok', 4 => 'disabled', 5 => 'error', 6 => 'failed',
|
1 => 'unknown', 2 => 'not-present', 3 => 'ok', 4 => 'disabled', 5 => 'error', 6 => 'failed',
|
||||||
7 => 'prefailure-predicted', 8 => 'hot-spare', 9 => 'mirror', 10 => 'raid', 11 => 'hidden',
|
7 => 'prefailure-predicted', 8 => 'hot-spare', 9 => 'mirror', 10 => 'raid', 11 => 'hidden'
|
||||||
};
|
};
|
||||||
|
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
sc => {
|
sc => {
|
||||||
memModuleStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.4.10.1.3', map => $map_sc_memory_status },
|
memModuleStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.4.10.1.3', map => $map_sc_memory_status }
|
||||||
},
|
},
|
||||||
sc2 => {
|
sc2 => {
|
||||||
sc2memModuleDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.3' },
|
sc2memModuleDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.3' },
|
||||||
sc2memModuleStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.4', map => $map_sc2_memory_status },
|
sc2memModuleStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.4', map => $map_sc2_memory_status }
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
my $oid_sc2MemoryModules = '.1.3.6.1.4.1.231.2.10.2.2.10.6.5.1';
|
my $oid_sc2MemoryModules = '.1.3.6.1.4.1.231.2.10.2.2.10.6.5.1';
|
||||||
|
|
||||||
|
@ -65,14 +65,19 @@ sub check_memory {
|
||||||
$self->absent_problem(section => 'memory', instance => $instance));
|
$self->absent_problem(section => 'memory', instance => $instance));
|
||||||
$self->{components}->{memory}->{total}++;
|
$self->{components}->{memory}->{total}++;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("memory '%s' status is '%s' [instance = %s]",
|
$self->{output}->output_add(
|
||||||
$result->{$options{name}}, $result->{$options{status}}, $instance,
|
long_msg => sprintf(
|
||||||
));
|
"memory '%s' status is '%s' [instance: %s]",
|
||||||
|
$result->{$options{name}}, $result->{$options{status}}, $instance
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$exit = $self->get_severity(section => 'memory', value => $result->{$options{status}});
|
$exit = $self->get_severity(section => 'memory', value => $result->{$options{status}});
|
||||||
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("Memory '%s' status is '%s'", $result->{$options{name}}, $result->{$options{status}}));
|
severity => $exit,
|
||||||
|
short_msg => sprintf("Memory '%s' status is '%s'", $result->{$options{name}}, $result->{$options{status}})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,16 +85,20 @@ sub check_memory {
|
||||||
sub check {
|
sub check {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking memories");
|
$self->{output}->output_add(long_msg => 'Checking memories');
|
||||||
$self->{components}->{memory} = {name => 'memories', total => 0, skip => 0};
|
$self->{components}->{memory} = { name => 'memories', total => 0, skip => 0 };
|
||||||
return if ($self->check_filter(section => 'memory'));
|
return if ($self->check_filter(section => 'memory'));
|
||||||
|
|
||||||
if (defined($self->{results}->{$oid_sc2MemoryModules}) && scalar(keys %{$self->{results}->{$oid_sc2MemoryModules}}) > 0) {
|
if (defined($self->{results}->{$oid_sc2MemoryModules}) && scalar(keys %{$self->{results}->{$oid_sc2MemoryModules}}) > 0) {
|
||||||
check_memory($self, entry => $oid_sc2MemoryModules, mapping => $mapping->{sc2}, name => 'sc2memModuleDesignation',
|
check_memory(
|
||||||
status => 'sc2memModuleStatus');
|
$self, entry => $oid_sc2MemoryModules, mapping => $mapping->{sc2}, name => 'sc2memModuleDesignation',
|
||||||
|
status => 'sc2memModuleStatus'
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
check_memory($self, entry => $mapping->{sc}->{memModuleStatus}, mapping => $mapping->{sc}, name => 'instance',
|
check_memory(
|
||||||
status => 'memModuleStatus');
|
$self, entry => $mapping->{sc}->{memModuleStatus}, mapping => $mapping->{sc}, name => 'instance',
|
||||||
|
status => 'memModuleStatus'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,19 +26,19 @@ use warnings;
|
||||||
my $map_psu_status = {
|
my $map_psu_status = {
|
||||||
1 => 'unknown', 2 => 'not-present', 3 => 'ok', 4 => 'failed', 5 => 'ac-fail', 6 => 'dc-fail',
|
1 => 'unknown', 2 => 'not-present', 3 => 'ok', 4 => 'failed', 5 => 'ac-fail', 6 => 'dc-fail',
|
||||||
7 => 'critical-temperature', 8 => 'not-manageable', 9 => 'fan-failure-predicted', 10 => 'fan-failure',
|
7 => 'critical-temperature', 8 => 'not-manageable', 9 => 'fan-failure-predicted', 10 => 'fan-failure',
|
||||||
11 => 'power-safe-mode', 12 => 'non-redundant-dc-fail', 13 => 'non-redundant-ac-fail',
|
11 => 'power-safe-mode', 12 => 'non-redundant-dc-fail', 13 => 'non-redundant-ac-fail'
|
||||||
};
|
};
|
||||||
|
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
sc => {
|
sc => {
|
||||||
powerSupplyUnitStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.11.2.1.3', map => $map_psu_status },
|
powerSupplyUnitStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.11.2.1.3', map => $map_psu_status },
|
||||||
powerSupplyUnitDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.11.2.1.4' },
|
powerSupplyUnitDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.11.2.1.4' }
|
||||||
},
|
},
|
||||||
sc2 => {
|
sc2 => {
|
||||||
sc2PowerSupplyDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1.3' },
|
sc2PowerSupplyDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1.3' },
|
||||||
sc2PowerSupplyStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1.5', map => $map_psu_status },
|
sc2PowerSupplyStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1.5', map => $map_psu_status },
|
||||||
sc2psPowerSupplyLoad => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1.6' },
|
sc2psPowerSupplyLoad => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1.6' }
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
my $oid_sc2PowerSupply = '.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1';
|
my $oid_sc2PowerSupply = '.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1';
|
||||||
my $oid_powerSupplyUnits = '.1.3.6.1.4.1.231.2.10.2.2.5.11.2.1';
|
my $oid_powerSupplyUnits = '.1.3.6.1.4.1.231.2.10.2.2.5.11.2.1';
|
||||||
|
@ -63,27 +63,33 @@ sub check_psu {
|
||||||
$self->absent_problem(section => 'psu', instance => $instance));
|
$self->absent_problem(section => 'psu', instance => $instance));
|
||||||
$self->{components}->{psu}->{total}++;
|
$self->{components}->{psu}->{total}++;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("power supply '%s' status is '%s' [instance = %s] [value = %s]",
|
$self->{output}->output_add(
|
||||||
$result->{$options{name}}, $result->{$options{status}}, $instance, $result->{$options{current}}
|
long_msg => sprintf(
|
||||||
));
|
"power supply '%s' status is '%s' [instance: %s] [value: %s]",
|
||||||
|
$result->{$options{name}}, $result->{$options{status}}, $instance, $result->{$options{current}}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$exit = $self->get_severity(section => 'psu', value => $result->{$options{status}});
|
$exit = $self->get_severity(section => 'psu', value => $result->{$options{status}});
|
||||||
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->{$options{name}}, $result->{$options{status}}));
|
severity => $exit,
|
||||||
|
short_msg => sprintf("Power supply '%s' status is '%s'", $result->{$options{name}}, $result->{$options{status}})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
next if (!defined($result->{$options{current}}) || $result->{$options{current}} == 0);
|
next if (!defined($result->{$options{current}}) || $result->{$options{current}} == 0);
|
||||||
|
|
||||||
($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'power', instance => $instance, value => $result->{$options{current}});
|
($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'power', instance => $instance, value => $result->{$options{current}});
|
||||||
|
|
||||||
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' is %s W", $result->{$options{name}}, $result->{$options{current}}));
|
severity => $exit,
|
||||||
|
short_msg => sprintf("Power supply '%s' is %s W", $result->{$options{name}}, $result->{$options{current}})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'power', unit => 'W',
|
|
||||||
nlabel => 'hardware.powersupply.power.watt',
|
nlabel => 'hardware.powersupply.power.watt',
|
||||||
|
unit => 'W',
|
||||||
instances => $result->{$options{name}},
|
instances => $result->{$options{name}},
|
||||||
value => $result->{$options{current}},
|
value => $result->{$options{current}},
|
||||||
warning => $warn,
|
warning => $warn,
|
||||||
|
@ -96,16 +102,20 @@ sub check_psu {
|
||||||
sub check {
|
sub check {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking poer supplies");
|
$self->{output}->output_add(long_msg => 'Checking poer supplies');
|
||||||
$self->{components}->{psu} = {name => 'psus', total => 0, skip => 0};
|
$self->{components}->{psu} = { name => 'psus', total => 0, skip => 0 };
|
||||||
return if ($self->check_filter(section => 'psu'));
|
return if ($self->check_filter(section => 'psu'));
|
||||||
|
|
||||||
if (defined($self->{results}->{$oid_sc2PowerSupply}) && scalar(keys %{$self->{results}->{$oid_sc2PowerSupply}}) > 0) {
|
if (defined($self->{results}->{$oid_sc2PowerSupply}) && scalar(keys %{$self->{results}->{$oid_sc2PowerSupply}}) > 0) {
|
||||||
check_psu($self, entry => $oid_sc2PowerSupply, mapping => $mapping->{sc2}, name => 'sc2PowerSupplyDesignation',
|
check_psu(
|
||||||
current => 'sc2psPowerSupplyLoad', status => 'sc2PowerSupplyStatus');
|
$self, entry => $oid_sc2PowerSupply, mapping => $mapping->{sc2}, name => 'sc2PowerSupplyDesignation',
|
||||||
|
current => 'sc2psPowerSupplyLoad', status => 'sc2PowerSupplyStatus'
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
check_psu($self, entry => $oid_powerSupplyUnits, mapping => $mapping->{sc}, name => 'powerSupplyUnitDesignation',
|
check_psu(
|
||||||
status => 'powerSupplyUnitStatus');
|
$self, entry => $oid_powerSupplyUnits, mapping => $mapping->{sc}, name => 'powerSupplyUnitDesignation',
|
||||||
|
status => 'powerSupplyUnitStatus'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
#
|
||||||
|
# Copyright 2021 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::fujitsu::snmp::mode::components::raid;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $map_raid_status = {
|
||||||
|
1 => 'unknown', 2 => 'online',
|
||||||
|
3 => 'degraded', 4 => 'offline',
|
||||||
|
5 => 'rebuilding', 6 => 'verifying',
|
||||||
|
7 => 'initializing', 8 => 'morphing',
|
||||||
|
9 => 'partialDegraded'
|
||||||
|
};
|
||||||
|
|
||||||
|
my $mapping = {
|
||||||
|
status => { oid => '.1.3.6.1.4.1.231.2.49.1.6.2.1.10', map => $map_raid_status }, # svrLogicalDriveStatus
|
||||||
|
name => { oid => '.1.3.6.1.4.1.231.2.49.1.6.2.1.11' } # svrLogicalDriveName
|
||||||
|
};
|
||||||
|
my $oid_ldrive_table = '.1.3.6.1.4.1.231.2.49.1.6.2'; # svrLogicalDriveTable
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
push @{$self->{request}}, {
|
||||||
|
oid => $oid_ldrive_table,
|
||||||
|
start => $mapping->{status}->{oid},
|
||||||
|
end => $mapping->{name}->{oid}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => 'Checking raids');
|
||||||
|
$self->{components}->{raid} = { name => 'raids', total => 0, skip => 0 };
|
||||||
|
return if ($self->check_filter(section => 'raid'));
|
||||||
|
|
||||||
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{ $oid_ldrive_table }})) {
|
||||||
|
next if ($oid !~ /^$mapping->{status}->{oid}\.(\d+)\.(\d+)$/);
|
||||||
|
my $instance = $1 . '.' . $2;
|
||||||
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{ $oid_ldrive_table }, instance => $instance);
|
||||||
|
|
||||||
|
next if ($self->check_filter(section => 'disk', instance => $instance));
|
||||||
|
$self->{components}->{disk}->{total}++;
|
||||||
|
|
||||||
|
$self->{output}->output_add(
|
||||||
|
long_msg => sprintf(
|
||||||
|
"raid '%s' status is '%s' [instance: %s]",
|
||||||
|
$result->{name}, $result->{status}, $instance
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
my $exit = $self->get_severity(section => 'raid', value => $result->{status});
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(
|
||||||
|
severity => $exit,
|
||||||
|
short_msg => sprintf("Raid '%s' status is '%s'", $result->{name}, $result->{status})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
|
@ -26,25 +26,25 @@ use warnings;
|
||||||
my $map_sc_temp_status = {
|
my $map_sc_temp_status = {
|
||||||
1 => 'unknown', 2 => 'sensor-disabled', 3 => 'ok', 4 => 'sensor-fail',
|
1 => 'unknown', 2 => 'sensor-disabled', 3 => 'ok', 4 => 'sensor-fail',
|
||||||
5 => 'warning-temp-warm', 6 => 'warning-temp-cold', 7 => 'critical-temp-warm',
|
5 => 'warning-temp-warm', 6 => 'warning-temp-cold', 7 => 'critical-temp-warm',
|
||||||
8 => 'critical-temp-cold', 9 => 'damage-temp-warm', 10 => 'damage-temp-cold', 99 => 'not-available',
|
8 => 'critical-temp-cold', 9 => 'damage-temp-warm', 10 => 'damage-temp-cold', 99 => 'not-available'
|
||||||
};
|
};
|
||||||
my $map_sc2_temp_status = {
|
my $map_sc2_temp_status = {
|
||||||
1 => 'unknown', 2 => 'not-available', 3 => 'ok', 4 => 'sensor-failed', 5 => 'failed',
|
1 => 'unknown', 2 => 'not-available', 3 => 'ok', 4 => 'sensor-failed', 5 => 'failed',
|
||||||
6 => 'temperature-warning-toohot', 7 => 'temperature-critical-toohot', 8 => 'temperature-normal',
|
6 => 'temperature-warning-toohot', 7 => 'temperature-critical-toohot', 8 => 'temperature-normal',
|
||||||
9 => 'temperature-warning',
|
9 => 'temperature-warning'
|
||||||
};
|
};
|
||||||
|
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
sc => {
|
sc => {
|
||||||
tempSensorStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.2.1.1.3', map => $map_sc_temp_status },
|
tempSensorStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.2.1.1.3', map => $map_sc_temp_status },
|
||||||
tempCurrentValue => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.2.1.1.11' },
|
tempCurrentValue => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.2.1.1.11' },
|
||||||
tempSensorDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.2.1.1.13' },
|
tempSensorDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.2.1.1.13' }
|
||||||
},
|
},
|
||||||
sc2 => {
|
sc2 => {
|
||||||
sc2tempSensorDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.3' },
|
sc2tempSensorDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.3' },
|
||||||
sc2tempSensorStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.5', map => $map_sc2_temp_status },
|
sc2tempSensorStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.5', map => $map_sc2_temp_status },
|
||||||
sc2tempCurrentTemperature => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.6' },
|
sc2tempCurrentTemperature => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.6' }
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
my $oid_sc2TemperatureSensors = '.1.3.6.1.4.1.231.2.10.2.2.10.5.1.1';
|
my $oid_sc2TemperatureSensors = '.1.3.6.1.4.1.231.2.10.2.2.10.5.1.1';
|
||||||
my $oid_temperatureSensors = '.1.3.6.1.4.1.231.2.10.2.2.5.2.1.1';
|
my $oid_temperatureSensors = '.1.3.6.1.4.1.231.2.10.2.2.5.2.1.1';
|
||||||
|
@ -69,31 +69,37 @@ sub check_temperature {
|
||||||
$self->absent_problem(section => 'temperature', instance => $instance));
|
$self->absent_problem(section => 'temperature', instance => $instance));
|
||||||
$self->{components}->{temperature}->{total}++;
|
$self->{components}->{temperature}->{total}++;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("temperature '%s' status is '%s' [instance = %s] [value = %s]",
|
$self->{output}->output_add(
|
||||||
$result->{$options{name}}, $result->{$options{status}}, $instance, $result->{$options{current}}
|
long_msg => sprintf(
|
||||||
));
|
"temperature '%s' status is '%s' [instance: %s] [value: %s]",
|
||||||
|
$result->{$options{name}}, $result->{$options{status}}, $instance, $result->{$options{current}}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$exit = $self->get_severity(section => 'temperature', value => $result->{$options{status}});
|
$exit = $self->get_severity(section => 'temperature', value => $result->{$options{status}});
|
||||||
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' status is '%s'", $result->{$options{name}}, $result->{$options{status}}));
|
severity => $exit,
|
||||||
|
short_msg => sprintf("Temperature '%s' status is '%s'", $result->{$options{name}}, $result->{$options{status}})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
next if (!defined($result->{$options{current}}) || $result->{$options{current}} <= 0 || $result->{$options{current}} == 255);
|
next if (!defined($result->{$options{current}}) || $result->{$options{current}} <= 0 || $result->{$options{current}} == 255);
|
||||||
|
|
||||||
($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{$options{current}});
|
($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{$options{current}});
|
||||||
|
|
||||||
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 V", $result->{$options{name}}, $result->{$options{current}}));
|
severity => $exit,
|
||||||
|
short_msg => sprintf("Temperature '%s' is %s V", $result->{$options{name}}, $result->{$options{current}})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'temperature', unit => 'C',
|
|
||||||
nlabel => 'hardware.temperature.celsius',
|
nlabel => 'hardware.temperature.celsius',
|
||||||
|
unit => 'C',
|
||||||
instances => $result->{$options{name}},
|
instances => $result->{$options{name}},
|
||||||
value => $result->{$options{current}},
|
value => $result->{$options{current}},
|
||||||
warning => $warn,
|
warning => $warn,
|
||||||
critical => $crit,
|
critical => $crit
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,16 +107,20 @@ sub check_temperature {
|
||||||
sub check {
|
sub check {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking temperatures");
|
$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'));
|
return if ($self->check_filter(section => 'temperature'));
|
||||||
|
|
||||||
if (defined($self->{results}->{$oid_sc2TemperatureSensors}) && scalar(keys %{$self->{results}->{$oid_sc2TemperatureSensors}}) > 0) {
|
if (defined($self->{results}->{$oid_sc2TemperatureSensors}) && scalar(keys %{$self->{results}->{$oid_sc2TemperatureSensors}}) > 0) {
|
||||||
check_temperature($self, entry => $oid_sc2TemperatureSensors, mapping => $mapping->{sc2}, name => 'sc2tempSensorDesignation',
|
check_temperature(
|
||||||
current => 'sc2tempCurrentTemperature', status => 'sc2tempSensorStatus');
|
$self, entry => $oid_sc2TemperatureSensors, mapping => $mapping->{sc2}, name => 'sc2tempSensorDesignation',
|
||||||
|
current => 'sc2tempCurrentTemperature', status => 'sc2tempSensorStatus'
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
check_temperature($self, entry => $oid_temperatureSensors, mapping => $mapping->{sc}, name => 'tempSensorDesignation',
|
check_temperature(
|
||||||
current => 'tempCurrentValue', status => 'tempSensorStatus');
|
$self, entry => $oid_temperatureSensors, mapping => $mapping->{sc}, name => 'tempSensorDesignation',
|
||||||
|
current => 'tempCurrentValue', status => 'tempSensorStatus'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,25 +26,25 @@ use warnings;
|
||||||
my $map_sc_voltage_status = {
|
my $map_sc_voltage_status = {
|
||||||
1 => 'unknown', 2 => 'not-available', 3 => 'ok',
|
1 => 'unknown', 2 => 'not-available', 3 => 'ok',
|
||||||
4 => 'too-low', 5 => 'too-high', 6 => 'out-of-range',
|
4 => 'too-low', 5 => 'too-high', 6 => 'out-of-range',
|
||||||
7 => 'battery-prefailure',
|
7 => 'battery-prefailure'
|
||||||
};
|
};
|
||||||
my $map_sc2_voltage_status = {
|
my $map_sc2_voltage_status = {
|
||||||
1 => 'unknown', 2 => 'not-available', 3 => 'ok',
|
1 => 'unknown', 2 => 'not-available', 3 => 'ok',
|
||||||
4 => 'too-low', 5 => 'too-high', 6 => 'out-of-range',
|
4 => 'too-low', 5 => 'too-high', 6 => 'out-of-range',
|
||||||
7 => 'warning',
|
7 => 'warning'
|
||||||
};
|
};
|
||||||
|
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
sc => {
|
sc => {
|
||||||
sniScVoltageStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.11.4.1.3', map => $map_sc_voltage_status },
|
sniScVoltageStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.11.4.1.3', map => $map_sc_voltage_status },
|
||||||
sniScVoltageDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.11.4.1.4' },
|
sniScVoltageDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.11.4.1.4' },
|
||||||
sniScVoltageCurrentValue => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.11.4.1.7' },
|
sniScVoltageCurrentValue => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.11.4.1.7' }
|
||||||
},
|
},
|
||||||
sc2 => {
|
sc2 => {
|
||||||
sc2VoltageDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.3' },
|
sc2VoltageDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.3' },
|
||||||
sc2VoltageStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.4', map => $map_sc2_voltage_status },
|
sc2VoltageStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.4', map => $map_sc2_voltage_status },
|
||||||
sc2VoltageCurrentValue => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.5' },
|
sc2VoltageCurrentValue => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.5' }
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
my $oid_sc2Voltages = '.1.3.6.1.4.1.231.2.10.2.2.10.6.3.1';
|
my $oid_sc2Voltages = '.1.3.6.1.4.1.231.2.10.2.2.10.6.3.1';
|
||||||
my $oid_sniScVoltages = '.1.3.6.1.4.1.231.2.10.2.2.5.11.4.1';
|
my $oid_sniScVoltages = '.1.3.6.1.4.1.231.2.10.2.2.5.11.4.1';
|
||||||
|
@ -71,31 +71,37 @@ sub check_voltage {
|
||||||
|
|
||||||
$result->{$options{current}} = $result->{$options{current}} / 1000 if (defined($result->{$options{current}}));
|
$result->{$options{current}} = $result->{$options{current}} / 1000 if (defined($result->{$options{current}}));
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("voltage '%s' status is '%s' [instance = %s] [value = %s]",
|
$self->{output}->output_add(
|
||||||
$result->{$options{name}}, $result->{$options{status}}, $instance, $result->{$options{current}}
|
long_msg => sprintf(
|
||||||
));
|
"voltage '%s' status is '%s' [instance: %s] [value: %s]",
|
||||||
|
$result->{$options{name}}, $result->{$options{status}}, $instance, $result->{$options{current}}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$exit = $self->get_severity(section => 'voltage', value => $result->{$options{status}});
|
$exit = $self->get_severity(section => 'voltage', value => $result->{$options{status}});
|
||||||
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("Voltage '%s' status is '%s'", $result->{$options{name}}, $result->{$options{status}}));
|
severity => $exit,
|
||||||
|
short_msg => sprintf("Voltage '%s' status is '%s'", $result->{$options{name}}, $result->{$options{status}})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
next if (!defined($result->{$options{current}}));
|
next if (!defined($result->{$options{current}}));
|
||||||
|
|
||||||
($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'voltage', instance => $instance, value => $result->{$options{current}});
|
($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'voltage', instance => $instance, value => $result->{$options{current}});
|
||||||
|
|
||||||
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("Voltage '%s' is %s V", $result->{$options{name}}, $result->{$options{current}}));
|
severity => $exit,
|
||||||
|
short_msg => sprintf("Voltage '%s' is %s V", $result->{$options{name}}, $result->{$options{current}})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'voltage', unit => 'V',
|
|
||||||
nlabel => 'hardware.voltage.volt',
|
nlabel => 'hardware.voltage.volt',
|
||||||
|
unit => 'V',
|
||||||
instances => $result->{$options{name}},
|
instances => $result->{$options{name}},
|
||||||
value => $result->{$options{current}},
|
value => $result->{$options{current}},
|
||||||
warning => $warn,
|
warning => $warn,
|
||||||
critical => $crit,
|
critical => $crit
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,16 +109,20 @@ sub check_voltage {
|
||||||
sub check {
|
sub check {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking voltages");
|
$self->{output}->output_add(long_msg => 'Checking voltages');
|
||||||
$self->{components}->{voltage} = {name => 'voltages', total => 0, skip => 0};
|
$self->{components}->{voltage} = { name => 'voltages', total => 0, skip => 0 };
|
||||||
return if ($self->check_filter(section => 'voltage'));
|
return if ($self->check_filter(section => 'voltage'));
|
||||||
|
|
||||||
if (defined($self->{results}->{$oid_sc2Voltages}) && scalar(keys %{$self->{results}->{$oid_sc2Voltages}}) > 0) {
|
if (defined($self->{results}->{$oid_sc2Voltages}) && scalar(keys %{$self->{results}->{$oid_sc2Voltages}}) > 0) {
|
||||||
check_voltage($self, entry => $oid_sc2Voltages, mapping => $mapping->{sc2}, name => 'sc2VoltageDesignation',
|
check_voltage(
|
||||||
current => 'sc2VoltageCurrentValue', status => 'sc2VoltageStatus');
|
$self, entry => $oid_sc2Voltages, mapping => $mapping->{sc2}, name => 'sc2VoltageDesignation',
|
||||||
|
current => 'sc2VoltageCurrentValue', status => 'sc2VoltageStatus'
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
check_voltage($self, entry => $oid_sniScVoltages, mapping => $mapping->{sc}, name => 'sniScVoltageDesignation',
|
check_voltage(
|
||||||
current => 'sniScVoltageCurrentValue', status => 'sniScVoltageStatus');
|
$self, entry => $oid_sniScVoltages, mapping => $mapping->{sc}, name => 'sniScVoltageDesignation',
|
||||||
|
current => 'sniScVoltageCurrentValue', status => 'sniScVoltageStatus'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,40 @@ sub set_system {
|
||||||
$self->{cb_hook2} = 'snmp_execute';
|
$self->{cb_hook2} = 'snmp_execute';
|
||||||
|
|
||||||
$self->{thresholds} = {
|
$self->{thresholds} = {
|
||||||
|
cpu => [
|
||||||
|
['unknown', 'UNKNOWN'],
|
||||||
|
['disabled', 'OK'],
|
||||||
|
['ok', 'OK'],
|
||||||
|
['not-present', 'OK'],
|
||||||
|
['error', 'CRITICAL'],
|
||||||
|
['prefailure-warning', 'WARNING'],
|
||||||
|
['fail', 'CRITICAL'], # can be failed also
|
||||||
|
['missing-termination', 'WARNING']
|
||||||
|
],
|
||||||
|
disk => [
|
||||||
|
['unknown', 'UNKNOWN'],
|
||||||
|
['noDisk', 'OK'],
|
||||||
|
['online', 'OK'],
|
||||||
|
['ready', 'OK'],
|
||||||
|
['failed', 'CRITICAL'],
|
||||||
|
['rebuilding', 'WARNING'],
|
||||||
|
['hotspareGlobal', 'OK'],
|
||||||
|
['hotspareDedicated', 'OK'],
|
||||||
|
['offline', 'OK'],
|
||||||
|
['unconfiguredFailed', 'WARNING'],
|
||||||
|
['formatting', 'WARNING'],
|
||||||
|
['dead', 'CRITICAL']
|
||||||
|
],
|
||||||
|
fan => [
|
||||||
|
['unknown', 'UNKNOWN'],
|
||||||
|
['disabled', 'OK'],
|
||||||
|
['ok', 'OK'],
|
||||||
|
['prefailure-predicted', 'WARNING'],
|
||||||
|
['fail', 'CRITICAL'],
|
||||||
|
['redundant-fan-failed', 'WARNING'],
|
||||||
|
['not-manageable', 'OK'],
|
||||||
|
['not-present', 'OK'],
|
||||||
|
],
|
||||||
memory => [
|
memory => [
|
||||||
['unknown', 'UNKNOWN'],
|
['unknown', 'UNKNOWN'],
|
||||||
['not-present|not-available', 'OK'],
|
['not-present|not-available', 'OK'],
|
||||||
|
@ -47,52 +81,6 @@ sub set_system {
|
||||||
['raid', 'OK'],
|
['raid', 'OK'],
|
||||||
['hidden', 'OK']
|
['hidden', 'OK']
|
||||||
],
|
],
|
||||||
cpu => [
|
|
||||||
['unknown', 'UNKNOWN'],
|
|
||||||
['disabled', 'OK'],
|
|
||||||
['ok', 'OK'],
|
|
||||||
['not-present', 'OK'],
|
|
||||||
['error', 'CRITICAL'],
|
|
||||||
['prefailure-warning', 'WARNING'],
|
|
||||||
['fail', 'CRITICAL'], # can be failed also
|
|
||||||
['missing-termination', 'WARNING']
|
|
||||||
],
|
|
||||||
voltage => [
|
|
||||||
['unknown', 'UNKNOWN'],
|
|
||||||
['not-available', 'OK'],
|
|
||||||
['ok', 'OK'],
|
|
||||||
['too-low', 'WARNING'],
|
|
||||||
['too-high', 'WARNING'],
|
|
||||||
['out-of-range', 'CRITICAL'],
|
|
||||||
['battery-prefailure', 'CRITICAL'],
|
|
||||||
['warning', 'WARNING']
|
|
||||||
],
|
|
||||||
fan => [
|
|
||||||
['unknown', 'UNKNOWN'],
|
|
||||||
['disabled', 'OK'],
|
|
||||||
['ok', 'OK'],
|
|
||||||
['prefailure-predicted', 'WARNING'],
|
|
||||||
['fail', 'CRITICAL'],
|
|
||||||
['redundant-fan-failed', 'WARNING'],
|
|
||||||
['not-manageable', 'OK'],
|
|
||||||
['not-present', 'OK'],
|
|
||||||
],
|
|
||||||
temperature => [
|
|
||||||
['unknown', 'UNKNOWN'],
|
|
||||||
['sensor-disabled', 'OK'],
|
|
||||||
['ok', 'OK'],
|
|
||||||
['sensor-fail', 'CRITICAL'], # can be also sensor-failed
|
|
||||||
['warning-temp-warm', 'WARNING'],
|
|
||||||
['warning-temp-cold', 'WARNING'],
|
|
||||||
['critical-temp-warm', 'CRITICAL'],
|
|
||||||
['critical-temp-cold', 'CRITICAL'],
|
|
||||||
['damage-temp-warm', 'WARNING'],
|
|
||||||
['damage-temp-cold', 'CRITICAL'],
|
|
||||||
['not-available', 'OK'],
|
|
||||||
['temperature-warning', 'WARNING'], # can be also temperature-warning-toohot
|
|
||||||
['temperature-critical-toohot', 'CRITICAL'],
|
|
||||||
['temperature-normal', 'OK']
|
|
||||||
],
|
|
||||||
psu => [
|
psu => [
|
||||||
['unknown', 'UNKNOWN'],
|
['unknown', 'UNKNOWN'],
|
||||||
['not-present', 'OK'],
|
['not-present', 'OK'],
|
||||||
|
@ -110,11 +98,48 @@ sub set_system {
|
||||||
|
|
||||||
['degraded', 'WARNING'],
|
['degraded', 'WARNING'],
|
||||||
['critical', 'CRITICAL']
|
['critical', 'CRITICAL']
|
||||||
|
],
|
||||||
|
raid => [
|
||||||
|
['unknown', 'UNKNOWN'],
|
||||||
|
['online', 'OK'],
|
||||||
|
['degraded', 'WARNING'],
|
||||||
|
['offline', 'ok'],
|
||||||
|
['rebuilding', 'WARNING'],
|
||||||
|
['verifying', 'OK'],
|
||||||
|
['initializing', 'OK'],
|
||||||
|
['morphing', 'OK'],
|
||||||
|
['partialDegraded', 'WARNING']
|
||||||
|
],
|
||||||
|
temperature => [
|
||||||
|
['unknown', 'UNKNOWN'],
|
||||||
|
['sensor-disabled', 'OK'],
|
||||||
|
['ok', 'OK'],
|
||||||
|
['sensor-fail', 'CRITICAL'], # can be also sensor-failed
|
||||||
|
['warning-temp-warm', 'WARNING'],
|
||||||
|
['warning-temp-cold', 'WARNING'],
|
||||||
|
['critical-temp-warm', 'CRITICAL'],
|
||||||
|
['critical-temp-cold', 'CRITICAL'],
|
||||||
|
['damage-temp-warm', 'WARNING'],
|
||||||
|
['damage-temp-cold', 'CRITICAL'],
|
||||||
|
['not-available', 'OK'],
|
||||||
|
['temperature-warning', 'WARNING'], # can be also temperature-warning-toohot
|
||||||
|
['temperature-critical-toohot', 'CRITICAL'],
|
||||||
|
['temperature-normal', 'OK']
|
||||||
|
],
|
||||||
|
voltage => [
|
||||||
|
['unknown', 'UNKNOWN'],
|
||||||
|
['not-available', 'OK'],
|
||||||
|
['ok', 'OK'],
|
||||||
|
['too-low', 'WARNING'],
|
||||||
|
['too-high', 'WARNING'],
|
||||||
|
['out-of-range', 'CRITICAL'],
|
||||||
|
['battery-prefailure', 'CRITICAL'],
|
||||||
|
['warning', 'WARNING']
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
$self->{components_path} = 'hardware::server::fujitsu::snmp::mode::components';
|
$self->{components_path} = 'hardware::server::fujitsu::snmp::mode::components';
|
||||||
$self->{components_module} = ['fan', 'voltage', 'psu', 'memory', 'cpu', 'temperature'];
|
$self->{components_module} = ['cpu', 'disk', 'fan', 'memory', 'psu', 'raid', 'temperature', 'voltage'];
|
||||||
}
|
}
|
||||||
|
|
||||||
sub snmp_execute {
|
sub snmp_execute {
|
||||||
|
@ -126,7 +151,7 @@ sub snmp_execute {
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {});
|
$options{options}->add_options(arguments => {});
|
||||||
|
|
|
@ -30,9 +30,9 @@ sub new {
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
%{$self->{modes}} = (
|
$self->{modes} = {
|
||||||
'hardware' => 'hardware::server::fujitsu::snmp::mode::hardware',
|
'hardware' => 'hardware::server::fujitsu::snmp::mode::hardware'
|
||||||
);
|
};
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue