Python script that aims to monitor running processes on a Linux operating system and alert for those that exceed certain CPU and memory usage limits.
The script uses the psutil
library, which provides an interface to retrieve operating system information, including information about running processes, CPU usage, and memory usage.
When the script is executed, it iterates over all running processes and checks the CPU and memory usage of each one. If the CPU or memory usage of a process exceeds the defined limits, the script displays information about that process, including its name, CPU usage, and memory usage.
- Python
psutil
library
- Install Python 3 and pip:
sudo apt install python3 python3-pip
- Install the
psutil
library:
pip install psutil
- Download the script and save it with a
.py
extension (e.g.,monitorar_processos.py
). - Open a terminal and navigate to the directory where the script is located.
- Run the script:
python3 monitorar_processos.py
The script will start monitoring running processes on the system.
This script was developed by me.
Open for contributions
License under MIT