Capturing Output of i7z command

Background

We use i7z command to check the performance of the Linux Server.

Here is the sample output
Sample Output

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.

  1. The values C0, Halt(C1), C3 and C6 should be in certain range.

  2. TURBO should be ENABLED on every Socket (There are two sockets in above sample output)

  3. Hyper Threading should be OFF on every Socket (There are two sockets in above sample output)

  4. Current Frequency and Max 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 redirect C0, Halt(C1), C3 and C6 to a text file, which then can be parsed. So, the point 1. is solved.

    help

  • For capturing output, the linux command i7z > i7zoutput.txt was executed using subprocess.run on python. It then created a i7zoutput.txt which can be read using python3. However, it has lot of missing data points. Particularly, Socket [1] data was getting truncated.

Any help would be appreciated.