mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-25 17:27:01 +00:00
The column output may differ based on the locale settings.
When run from init the mpstat output is in 24 time and does not have the AM/PM column. This change handles both possibilities.
This commit is contained in:
@@ -22,8 +22,9 @@ out = subprocess.check_output(['mpstat','1','1'])
|
||||
|
||||
for line in out.split('\n'):
|
||||
if "%idle" in line:
|
||||
# extract keys from header line, skipping over time and AM/PM
|
||||
keys = line.split()[2:]
|
||||
# extract keys from header line, skipping over time and AM/PM if present
|
||||
tokens = line.split()
|
||||
keys = tokens[tokens.index('CPU'):]
|
||||
|
||||
if "Average" in line:
|
||||
vals = line.split()[1:]
|
||||
|
||||
Reference in New Issue
Block a user