giampaolo / psutil

Cross-platform lib for process and system monitoring in Python
BSD 3-Clause "New" or "Revised" License
10.32k stars 1.39k forks source link

An API for monitoring new PIDs / processes #2348

Open User087 opened 11 months ago

User087 commented 11 months ago

Summary

Description

A system monitoring API for tracking events like processes being created and exiting.

There are a number of LInux kernel features that could be of use in implementing this and that are implemented by some of the existing third-party tools for this purpose. See e.g. https://natanyellin.com/posts/tracking-running-processes-on-linux/ for an overview. The process accounting option (as used by acct) is another one. https://github.com/ColinIanKing/forkstat is an example of a basic implementation using the netlink process connector.

At the moment, the closest thing with psutils would seem to be just polling psutil.pids().