This commit is contained in:
Jamie Cameron
2017-05-12 21:45:56 -07:00
parent 5a21764743
commit 4ffd3753a2

View File

@@ -73,18 +73,26 @@ my @drive = &get_current_drive_temps();
$info->{'drivetemps'} = \@drive if (@drive);
# IO input and output
if ($gconfig{'os_type'} =~ /-linux$/) {
if ($gconfig{'os_type'} =~ /-linux$/ || $gconfig{'os_type'} eq 'freebsd') {
my $out = &backquote_command("vmstat 1 2 2>/dev/null");
if (!$?) {
my @lines = split(/\r?\n/, $out);
my @w = split(/\s+/, $lines[$#lines]);
shift(@w) if ($w[0] eq '');
if ($w[8] =~ /^\d+$/ && $w[9] =~ /^\d+$/) {
# Blocks in and out
$info->{'io'} = [ $w[8], $w[9] ];
if ($gconfig{'os_type'} =~ /-linux$/) {
# Linux format
if ($w[8] =~ /^\d+$/ && $w[9] =~ /^\d+$/) {
# Blocks in and out
$info->{'io'} = [ $w[8], $w[9] ];
# CPU user, kernel, idle, io, vm
$info->{'cpu'} = [ @w[12..16] ];
# CPU user, kernel, idle, io, vm
$info->{'cpu'} = [ @w[12..16] ];
}
}
else {
# BSD format
# CPU user, kernel, idle
$info->{'cpu'} = [ $w[16], $w[17], $w[18], 0, 0 ];
}
}
}