Skip to content

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%.

Notifications You must be signed in to change notification settings

parvvareshInfrastructure/Monitor-sys-usage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

βœ… System Monitor & Alert Script

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%.


πŸ“‹ Features:

  • 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 screen session for continuous monitoring

πŸ“ Output:

A CSV log file named:

system_usage_log.csv

With columns:

Timestamp, CPU_Usage(%), GPU_Usage(%), RAM_Usage(%), Disk_Usage(%), Alert

βš™οΈ Requirements:

  • mpstat (part of sysstat package)
  • nvidia-smi (for GPU monitoring; available with NVIDIA drivers)
  • bc (basic calculator utility)
  • notify-send (part of libnotify-bin)

Install requirements:

sudo apt update
sudo apt install sysstat bc libnotify-bin

πŸš€ How to Use:

  1. Clone or download the script.
  2. Make it executable:
chmod +x system_monitor_notify.sh
  1. (Optional) Start a screen session so it runs in the background:
screen -S monitor
  1. Run the script:
./system_monitor_notify.sh
  1. Detach from screen (leaves it running in background):
Ctrl + A, then D
  1. Reattach to screen when needed:
screen -r monitor

βœ… How Notifications Work:

  • 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.

πŸ’Ύ Log Example (CSV):

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%

About

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%.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages