Atoptool / atop

System and process monitor for Linux
GNU General Public License v2.0
799 stars 111 forks source link

Streamline accounting file heuristics #178

Closed Zugschlus closed 2 years ago

Zugschlus commented 2 years ago

Hi,

atop turns on process accounting and has to coexist with the distribution's native acct/pacct package. Since there are so many different ways the distributions do it, atop contains a number of (different, mutually incompatible, differently flawed) heuristics to correctly locate the process accounting file. I have identified

acctproc.c
atopacct.init
psaccs_atop
psaccu_atop

to contain code catering for that. To make things coexist better in Debian, Debian's patches are currently resorting to parsing the acct package's configuration and cron jobs to identify the file. This is a horrible mess, but since the maintainer of Debian's acct package is a bit less than cooperative, I don't see a different way to do this.

Do you have an idea how to make this a bit less ugly in atop?

I am currently thinking about

I would like to ask you about your opinion before preparing a PR for option (b).

The current state of affairs is a nightmare to maintain, I get breakage in Debian with every half a release.

Thanks in advance!

Greetings Marc

Atoptool commented 2 years ago

The main complexity was related to the situation that atop runs in combination with the psacct or acct package (name depends on the Linux distro used). When the (ps)acct service is enabled, that service switches on the process accounting permanently with a daily rotation. In that case, atop will use the process accounting file of the (ps)acct package instead of its own mechanism supported by atopacctd. For the daily rotation the atop package installed two "wrappers" (psaccs_atop/psaccu_atop) in the directory /etc/logrotate.d that took care of a simultaneous log rotation for atop itself. These wrappers are not needed any more since atop has been modified to detect a file rotation by itself now.