Update
This commit is contained in:
@@ -29,7 +29,7 @@ GetOptions("help|h" => \&help,
|
||||
|
||||
# Get CPU usage
|
||||
$ENV{LC_ALL}="en_US"; # if mpstat is not run under en_US locale, things may break, so make sure it is
|
||||
open (MPSTAT, 'mpstat |') or die;
|
||||
open (MPSTAT, 'mpstat 1 1 -P ALL |') or die;
|
||||
while (<MPSTAT>) {
|
||||
if (/^.*\s+(\d+\.\d+)\s+$/) {
|
||||
$cpu_usage = 100 - $1; # 100% - %idle
|
||||
|
||||
Reference in New Issue
Block a user