mirror of
https://github.com/webmin/webmin.git
synced 2026-05-26 16:10:29 +01:00
Handle FreeBSD vmstat output https://github.com/webmin/webmin/issues/498
This commit is contained in:
@@ -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 ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user