mirror of https://github.com/mikaku/Monitorix.git
added support to map devices names in 'disk.pm'. #272
This commit is contained in:
parent
2fff79df2a
commit
ecd7da1a52
|
@ -471,17 +471,22 @@ sub disk_cgi {
|
||||||
for($n = 0; $n < 8; $n++) {
|
for($n = 0; $n < 8; $n++) {
|
||||||
if($d[$n]) {
|
if($d[$n]) {
|
||||||
my $dstr = trim($d[$n]);
|
my $dstr = trim($d[$n]);
|
||||||
|
my $base;
|
||||||
$dstr =~ s/^\"//;
|
$dstr =~ s/^\"//;
|
||||||
$dstr =~ s/\"$//;
|
$dstr =~ s/\"$//;
|
||||||
|
|
||||||
# check if device name is a symbolic link
|
# check if device name is a symbolic link
|
||||||
# e.g. /dev/disk/by-path/pci-0000:07:07.0-scsi-0:0:0:0
|
# e.g. /dev/disk/by-path/pci-0000:07:07.0-scsi-0:0:0:0
|
||||||
if(-l $dstr) {
|
if(-l $dstr) {
|
||||||
|
$base = basename($dstr);
|
||||||
$dstr = abs_path(dirname($dstr) . "/" . readlink($dstr));
|
$dstr = abs_path(dirname($dstr) . "/" . readlink($dstr));
|
||||||
chomp($dstr);
|
chomp($dstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
$dstr =~ s/^(.+?) .*$/$1/;
|
$dstr =~ s/^(.+?) .*$/$1/;
|
||||||
|
if($disk->{map}->{$base} || "" eq $dstr) {
|
||||||
|
$dstr = $disk->{map}->{$base};
|
||||||
|
}
|
||||||
$str = sprintf("%-20s", $dstr);
|
$str = sprintf("%-20s", $dstr);
|
||||||
push(@tmp, "LINE2:temp_" . $n . $LC[$n] . ":$str");
|
push(@tmp, "LINE2:temp_" . $n . $LC[$n] . ":$str");
|
||||||
push(@tmpz, "LINE2:temp_" . $n . $LC[$n] . ":$dstr");
|
push(@tmpz, "LINE2:temp_" . $n . $LC[$n] . ":$dstr");
|
||||||
|
|
Loading…
Reference in New Issue