A simple Bash script to monitor CPU, GPU, RAM, and Disk usage every 5 minutes, log the data into a CSV file, and send desktop notifications if usage exceeds 70%.
- Monitors system metrics:
- β CPU usage
- β GPU usage (NVIDIA)
- β RAM usage
- β Root Disk usage
- Logs all data to a CSV file with timestamps
- Sends local desktop notifications (via
notify-send) when usage exceeds 70% - Can be run in a
screensession for continuous monitoring
A CSV log file named:
system_usage_log.csv
With columns:
Timestamp, CPU_Usage(%), GPU_Usage(%), RAM_Usage(%), Disk_Usage(%), Alert
mpstat(part ofsysstatpackage)nvidia-smi(for GPU monitoring; available with NVIDIA drivers)bc(basic calculator utility)notify-send(part oflibnotify-bin)
sudo apt update
sudo apt install sysstat bc libnotify-bin- Clone or download the script.
- Make it executable:
chmod +x system_monitor_notify.sh- (Optional) Start a screen session so it runs in the background:
screen -S monitor- Run the script:
./system_monitor_notify.sh- Detach from screen (leaves it running in background):
Ctrl + A, then D
- Reattach to screen when needed:
screen -r monitor- If CPU, GPU, RAM, or Disk usage goes above 70%,
youβll get a pop-up notification on your system with the metric and current usage.
2025-03-24 12:00:00,45.20,12,60.10,55,None
2025-03-24 12:05:00,75.80,80,72.30,68,GPU usage above 70%