How to create a bash script that runs periodically through a cronjob to gather readings of a running processes on the current machine (1 sample per process on each run ) from the system the readings are: 1 CPU load percentage. 2 Memory Usage. 3 Open files count. 4 Open ports count.
I gues you could iterate through /proc
filesystem analysing files uid
and stat*
. Then the uid needs to be mapped to /etc/passwd
to get real user names. In my opinion a perl script would be more convenient for this need.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.