Background
We use i7z
command to check the performance of the Linux Server.
However, the output is dynamic/interactive in nature. It keeps on updating in real-time.
(Similar to htop
)
Our goal is to capture the output using python (or any other) script, and then parse those output to check certain conditions.
-
The values
C0
,Halt(C1)
,C3
andC6
should be in certain range. -
TURBO
should beENABLED
on every Socket (There are two sockets in above sample output) -
Hyper Threading
should beOFF
on every Socket (There are two sockets in above sample output) -
Current Frequency
andMax Frequency
should be in certain range.
For doing all these, we certainly need to capture output. However, since it is dynamic, the parser misses few data points every time. Was interested if there is a way to capture and then parse this output without missing any data point.
Efforts
-
The
i7z
command provides flag (-w l
) to redirectC0
,Halt(C1)
,C3
andC6
to a text file, which then can be parsed. So, the point 1. is solved.
- For capturing output, the linux command
i7z > i7zoutput.txt
was executed usingsubprocess.run
onpython
. It then created ai7zoutput.txt
which can be read usingpython3
. However, it has lot of missing data points. Particularly,Socket [1]
data was getting truncated.
Any help would be appreciated.