diff --git a/lib/disk.pm b/lib/disk.pm index e26980c..56253b9 100644 --- a/lib/disk.pm +++ b/lib/disk.pm @@ -206,17 +206,15 @@ 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 |"); @@ -254,7 +252,7 @@ sub disk_update { } close(IN); if(!$temp && !$respect_standby) { - if(open(IN, "hddtemp -wqn $d |")) { + if(open(IN, "hddtemp -wqn $d |")) { $temp = ; close(IN); } else { @@ -352,7 +350,6 @@ 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"; @@ -486,15 +483,12 @@ sub disk_cgi { $dstr =~ s/^\"//; $dstr =~ s/\"$//; - 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); - } + # 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); } # $dstr =~ s/^(.+?) .*$/$1/; @@ -645,15 +639,12 @@ sub disk_cgi { $dstr =~ s/^\"//; $dstr =~ s/\"$//; - 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); - } + # 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); } # $dstr =~ s/^(.+?) .*$/$1/; @@ -674,15 +665,12 @@ sub disk_cgi { $dstr =~ s/^\"//; $dstr =~ s/\"$//; - 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); - } + # 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); } # $dstr =~ s/^(.+?) .*$/$1/; @@ -799,15 +787,12 @@ sub disk_cgi { $dstr =~ s/^\"//; $dstr =~ s/\"$//; - 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); - } + # 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); } # $dstr =~ s/^(.+?) .*$/$1/; @@ -828,15 +813,12 @@ sub disk_cgi { $dstr =~ s/^\"//; $dstr =~ s/\"$//; - 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); - } + # 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); } # $dstr =~ s/^(.+?) .*$/$1/; diff --git a/man/man5/monitorix.conf.5 b/man/man5/monitorix.conf.5 index a592dc8..27145c8 100644 --- a/man/man5/monitorix.conf.5 +++ b/man/man5/monitorix.conf.5 @@ -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 (this will disable built-in symlink resolving). +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. .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