After some time that I left my previous job, now I'm retaking one of the projects that I began doing there. But now, a full rewrite is gong to be made (as I do not have that code).
The idea is a parser that takes the nmon files, and makes a html report file using highchart graphs and some jquery.
By now, I'm analizying again the nmon files, and for most of the cases, the main regex that I'm thinking is:
r'([^,]+)\s*,\s*([^,]+)\s*,\s*((?:\s*[^,]*\s*,?)+)\s*$'
Basicaly is just taking the index code, the title, and the rest of the parameters. The title is given before the first ZZZZ as:
CPU001,CPU 1 aserulo,User%,Sys%,Wait%,Idle%,Steal%
or
MEM,Memory MB aserulo,memtotal,hightotal,lowtotal,
swaptotal,memfree,highfree,lowfree,swapfree,memshared,
cached,active,bigfree,buffers,swapcached,inactive
And the first ZZZZ code is:
ZZZZ,T0001,10:59:55,16-MAR-2021
and using the time code as part of the hash, then I got a full table with datetime index, and the rest of the values of each row (getting the title as hash keys) and the values as:
CPU001,T0064,2.4,5.0,44.0,48.7,0.0
or
MEM,T0063,9959.7,-0.0,-0.0,976.0,131.6,-0.0,
-0.0,111.5,346.8,2476.6,2581.7,-1.0,225.0,30.4,6148.0