mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 15:44:21 +02:00
(plugin) storage::synology::snmp - add components disk health (#3844)
This commit is contained in:
parent
47190d403b
commit
0b4a04f10b
@ -30,10 +30,17 @@ my $map_disk_status = {
|
|||||||
4 => 'SystemPartitionFailed',
|
4 => 'SystemPartitionFailed',
|
||||||
5 => 'Crashed'
|
5 => 'Crashed'
|
||||||
};
|
};
|
||||||
|
my $map_disk_health = {
|
||||||
|
1 => 'normal',
|
||||||
|
2 => 'warning',
|
||||||
|
3 => 'critical',
|
||||||
|
4 => 'failing'
|
||||||
|
};
|
||||||
|
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
status => { oid => '.1.3.6.1.4.1.6574.2.1.1.5', map => $map_disk_status }, # synoDiskdiskStatus
|
status => { oid => '.1.3.6.1.4.1.6574.2.1.1.5', map => $map_disk_status }, # synoDiskdiskStatus
|
||||||
badSectors => { oid => '.1.3.6.1.4.1.6574.2.1.1.9' } # diskBadSector
|
badSectors => { oid => '.1.3.6.1.4.1.6574.2.1.1.9' }, # diskBadSector
|
||||||
|
healthStatus => { oid => '.1.3.6.1.4.1.6574.2.1.1.13', map => $map_disk_health } # diskHealthStatus
|
||||||
};
|
};
|
||||||
my $oid_diskName = '.1.3.6.1.4.1.6574.2.1.1.2'; # synoDiskdiskName
|
my $oid_diskName = '.1.3.6.1.4.1.6574.2.1.1.2'; # synoDiskdiskName
|
||||||
|
|
||||||
@ -74,9 +81,10 @@ sub check {
|
|||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"disk '%s' status is %s [instance: %s%s]",
|
"disk '%s' status is %s [instance: %s%s%s]",
|
||||||
$name, $result->{status}, $instance,
|
$name, $result->{status}, $instance,
|
||||||
defined($result->{badSectors}) ? ', bad sectors: ' . $result->{badSectors} : ''
|
defined($result->{badSectors}) ? ', bad sectors: ' . $result->{badSectors} : '',
|
||||||
|
defined($result->{healthStatus}) ? ', health: ' . $result->{healthStatus} : ''
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
my $exit = $self->get_severity(section => 'disk', value => $result->{status});
|
my $exit = $self->get_severity(section => 'disk', value => $result->{status});
|
||||||
@ -87,6 +95,16 @@ sub check {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (defined($result->{healthStatus})) {
|
||||||
|
$exit = $self->get_severity(section => 'disk', value => $result->{healthStatus});
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(
|
||||||
|
severity => $exit,
|
||||||
|
short_msg => sprintf("Disk '%s' health is %s", $name, $result->{healthStatus})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
next if (!defined($result->{badSectors}));
|
next if (!defined($result->{badSectors}));
|
||||||
|
|
||||||
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'disk.badsectors', instance => $instance, value => $result->{badSectors});
|
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'disk.badsectors', instance => $instance, value => $result->{badSectors});
|
||||||
@ -96,6 +114,7 @@ sub check {
|
|||||||
short_msg => sprintf("Disk '%s' has %s bad sector(s)", $name, $result->{badSectors})
|
short_msg => sprintf("Disk '%s' has %s bad sector(s)", $name, $result->{badSectors})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
nlabel => 'hardware.disk.bad_sectors.count',
|
nlabel => 'hardware.disk.bad_sectors.count',
|
||||||
instances => $name,
|
instances => $name,
|
||||||
|
@ -43,7 +43,11 @@ sub set_system {
|
|||||||
['Initialized', 'OK'],
|
['Initialized', 'OK'],
|
||||||
['NotInitialized', 'OK'],
|
['NotInitialized', 'OK'],
|
||||||
['SystemPartitionFailed', 'CRITICAL'],
|
['SystemPartitionFailed', 'CRITICAL'],
|
||||||
['Crashed', 'CRITICAL']
|
['Crashed', 'CRITICAL'],
|
||||||
|
|
||||||
|
['warning', 'WARNING'],
|
||||||
|
['critical', 'CRITICAL'],
|
||||||
|
['failing', 'failing']
|
||||||
],
|
],
|
||||||
raid => [
|
raid => [
|
||||||
['Normal', 'OK'],
|
['Normal', 'OK'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user