1

I am on a gentoo Linux system and I want to monitor the time and name of every created and deleted process on an entire Linux system. How can I do that?

If possible, I do not want to install new software to do this, but just the tools Linux comes with.

4
  • "monitoring" implies that you keep a log. where do you want to store that log? in what time-intervals do you want to take snapshots of the current running processes?
    – akira
    Commented Aug 12, 2014 at 6:19
  • @akira: I want to store that log in a file, and I want a snapshot whenever a new process is created or a running process is removed.
    – Alex
    Commented Aug 12, 2014 at 6:34
  • Depending on your definition of the word "monitoring", I guess "process accounting" is the term you'd like to put in the search engine of your choice.
    – user260419
    Commented Aug 12, 2014 at 7:11
  • @akira: Thanks for giving me the right 'term' to search for.
    – Alex
    Commented Aug 12, 2014 at 7:19

1 Answer 1

0

As suggested by the comments, process accounting psacct is one potential solution. The functionality itself is in the kernel, the tooling just enables it and captures the output.

# apt-get install -y acct
... (installed & auto-started on most systems)
# lastcomm |head
nrpe              F    nagios   __         0.02 secs Mon Mar 29 04:39
check_nrpe             nagios   __         0.03 secs Mon Mar 29 04:39
nrpe              F    nagios   __         0.00 secs Mon Mar 29 04:39
sh                     nagios   __         0.00 secs Mon Mar 29 04:39
check_procs            nagios   __         0.00 secs Mon Mar 29 04:39
ps                     nagios   __         0.01 secs Mon Mar 29 04:39
nrpe              F    nagios   __         0.00 secs Mon Mar 29 04:39
nrpe              F    nagios   __         0.02 secs Mon Mar 29 04:39
check_nrpe             nagios   __         0.03 secs Mon Mar 29 04:39
nrpe              F    nagios   __         0.00 secs Mon Mar 29 04:39

On this system you can see that nagios checks are extremely common.

audit can also do what you want, and it likely more flexible for your purposes, but it's certainly not as drop-in as using psacct.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .