darold / pgcluu

PostgreSQL Cluster performances monitoring and auditing tool
http://pgcluu.darold.net/
PostgreSQL License
336 stars 45 forks source link

Generating a report crashes pgCluu #130

Closed Krysztophe closed 3 years ago

Krysztophe commented 3 years ago

pgCluu version is from Github (master)

On Debian 9 server, I get this error when generating the pgCluu report (line 10687 of pgcluu):

ERROR: Parsing of pidstat output reports different values than headers allow. (8 != 7)
INFO: pidstat output file was pgcluu_data_202106/./pidstat_stats.dat
INFO: Line was: 13:38:24    postgres     29411    0.93    0.00    0.00    0.93     1  pgbadger parser
Header: USER;PID;%usr;%system;%guest;%CPU;CPU;Command | Values: postgres;29411;0.93;0.00;0.00;0.93;1;pgbadger;parser

I can reproduce on Ubuntu 20.04 (there is one column more in pidstat):

ERROR: Parsing of pidstat output reports different values than headers allow. (9 != 8)
INFO: pidstat output file was /tmp/pgcluu_data/./pidstat_stats.dat
INFO: Line was: 20:55:11    postgres    593356   83.33    0.98    0.00    0.98   84.31     1  pgbadger parser
Header: USER;PID;%usr;%system;%guest;%wait;%CPU;CPU;Command | Values: postgres;593356;83.33;0.98;0.00;0.98;84.31;1;pgbadger;parser

The culprits are these lines in pidstat_stats.dat:

13:41:03    postgres     29411       990        10         0  pgbadger parser
13:41:03    postgres     29408      8.91      0.00   66704   28580   0.19  pgbadger logger
13:41:03    postgres     29408         9         0  pgbadger logger
13:41:03    postgres     29408      2.97      0.99  pgbadger logger
13:41:03    postgres     29411      0.99     21.78  pgbadger parser

I'm surprised this problem did not happen sooner, but spaces in process names are not so common.

I removed the pgbadger lines with spaces and the report generation was okay.

I'm not sure how to correct this without arbitrarily cutting excess columns.

darold commented 3 years ago

I see the pidstat format has changed, please post the version of sysstat you are using (sar -V).

darold commented 3 years ago

I have found the reason of the problem, commit e0e3800 might fix the issue.

Krysztophe commented 3 years ago

I confirm, this works :clap:

Et merci pour la rapidité :-)