Also the symbolic link check wakes up the disks.

This commit is contained in:
Andreas Bachlechner 2021-10-13 08:40:08 +02:00
parent 6962da4fe4
commit c840dee92e
2 changed files with 56 additions and 38 deletions

View File

@ -206,15 +206,17 @@ sub disk_update {
$d =~ s/^\"//;
$d =~ s/\"$//;
# check if device name is a symbolic link
# e.g. /dev/disk/by-path/pci-0000:07:07.0-scsi-0:0:0:0
if(-l $d) {
$d = abs_path(dirname($d) . "/" . readlink($d));
chomp($d);
}
my $smartctl_options = "-A";
if($respect_standby) {
$smartctl_options .= " -n standby";
} else {
# check if device name is a symbolic link
# e.g. /dev/disk/by-path/pci-0000:07:07.0-scsi-0:0:0:0
# But does wake up sleeping disks
if(-l $d) {
$d = abs_path(dirname($d) . "/" . readlink($d));
chomp($d);
}
}
open(IN, "smartctl $smartctl_options $d |");
@ -252,7 +254,7 @@ sub disk_update {
}
close(IN);
if(!$temp && !$respect_standby) {
if(open(IN, "hddtemp -wqn $d |")) {
if(open(IN, "hddtemp -wqn $d |")) {
$temp = <IN>;
close(IN);
} else {
@ -350,6 +352,7 @@ sub disk_cgi {
"#EE44EE",
"#EEEE44",
);
my $respect_standby = lc($disk->{respect_standby} || "") eq "y" ? 1 : 0;
$version = "old" if $RRDs::VERSION < 1.3;
my $rrd = $config->{base_lib} . $package . ".rrd";
@ -483,12 +486,15 @@ sub disk_cgi {
$dstr =~ s/^\"//;
$dstr =~ s/\"$//;
# check if device name is a symbolic link
# e.g. /dev/disk/by-path/pci-0000:07:07.0-scsi-0:0:0:0
if(-l $dstr) {
$base = basename($dstr);
$dstr = abs_path(dirname($dstr) . "/" . readlink($dstr));
chomp($dstr);
if(!$respect_standby) {
# check if device name is a symbolic link
# e.g. /dev/disk/by-path/pci-0000:07:07.0-scsi-0:0:0:0
# But does wake up sleeping disks
if(-l $dstr) {
$base = basename($dstr);
$dstr = abs_path(dirname($dstr) . "/" . readlink($dstr));
chomp($dstr);
}
}
# $dstr =~ s/^(.+?) .*$/$1/;
@ -639,12 +645,15 @@ sub disk_cgi {
$dstr =~ s/^\"//;
$dstr =~ s/\"$//;
# check if device name is a symbolic link
# e.g. /dev/disk/by-path/pci-0000:07:07.0-scsi-0:0:0:0
if(-l $dstr) {
$base = basename($dstr);
$dstr = abs_path(dirname($dstr) . "/" . readlink($dstr));
chomp($dstr);
if(!$respect_standby) {
# check if device name is a symbolic link
# e.g. /dev/disk/by-path/pci-0000:07:07.0-scsi-0:0:0:0
# But does wake up sleeping disks
if(-l $dstr) {
$base = basename($dstr);
$dstr = abs_path(dirname($dstr) . "/" . readlink($dstr));
chomp($dstr);
}
}
# $dstr =~ s/^(.+?) .*$/$1/;
@ -665,12 +674,15 @@ sub disk_cgi {
$dstr =~ s/^\"//;
$dstr =~ s/\"$//;
# check if device name is a symbolic link
# e.g. /dev/disk/by-path/pci-0000:07:07.0-scsi-0:0:0:0
if(-l $dstr) {
$base = basename($dstr);
$dstr = abs_path(dirname($dstr) . "/" . readlink($dstr));
chomp($dstr);
if(!$respect_standby) {
# check if device name is a symbolic link
# e.g. /dev/disk/by-path/pci-0000:07:07.0-scsi-0:0:0:0
# But does wake up sleeping disks
if(-l $dstr) {
$base = basename($dstr);
$dstr = abs_path(dirname($dstr) . "/" . readlink($dstr));
chomp($dstr);
}
}
# $dstr =~ s/^(.+?) .*$/$1/;
@ -787,12 +799,15 @@ sub disk_cgi {
$dstr =~ s/^\"//;
$dstr =~ s/\"$//;
# check if device name is a symbolic link
# e.g. /dev/disk/by-path/pci-0000:07:07.0-scsi-0:0:0:0
if(-l $dstr) {
$base = basename($dstr);
$dstr = abs_path(dirname($dstr) . "/" . readlink($dstr));
chomp($dstr);
if(!$respect_standby) {
# check if device name is a symbolic link
# e.g. /dev/disk/by-path/pci-0000:07:07.0-scsi-0:0:0:0
# But does wake up sleeping disks
if(-l $dstr) {
$base = basename($dstr);
$dstr = abs_path(dirname($dstr) . "/" . readlink($dstr));
chomp($dstr);
}
}
# $dstr =~ s/^(.+?) .*$/$1/;
@ -813,12 +828,15 @@ sub disk_cgi {
$dstr =~ s/^\"//;
$dstr =~ s/\"$//;
# check if device name is a symbolic link
# e.g. /dev/disk/by-path/pci-0000:07:07.0-scsi-0:0:0:0
if(-l $dstr) {
$base = basename($dstr);
$dstr = abs_path(dirname($dstr) . "/" . readlink($dstr));
chomp($dstr);
if(!$respect_standby) {
# check if device name is a symbolic link
# e.g. /dev/disk/by-path/pci-0000:07:07.0-scsi-0:0:0:0
# But does wake up sleeping disks
if(-l $dstr) {
$base = basename($dstr);
$dstr = abs_path(dirname($dstr) . "/" . readlink($dstr));
chomp($dstr);
}
}
# $dstr =~ s/^(.+?) .*$/$1/;

View File

@ -1354,7 +1354,7 @@ This is a list of groups of disk drives that you want to monitor. Each group wil
.P
WARNING: Every time the number of groups in this option changes, Monitorix will resize the \fIdisk.rrd\fP file accordingly, removing all historical data.
.P
To collect the disk drive temperatures and health the \fIsmartmontools\fP or the \fIhddtemp\fP command are required. \fIsmartmontools\fP will wake up sleeping disk. To avoid this set \fIrespect_standby = y\fP.
To collect the disk drive temperatures and health the \fIsmartmontools\fP or the \fIhddtemp\fP command are required. \fIsmartmontools\fP will wake up sleeping disk. To avoid this set \fIrespect_standby = y\fP (this will disable built-in symlink resolving).
.P
It is recommended that you first check if either \fIsmartctl\fP(8) or \fIhddtemp\fP are able to collect data from the disk drive(s) that you plan to monitor. You may test this with the following command:
.P