An open API service indexing awesome lists of open source software.

https://github.com/parvvaresh/monitor-sys-usage

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%.
https://github.com/parvvaresh/monitor-sys-usage

bash-script cpu-monitoring gpu-monitoring monitoring nvidia

Last synced: 7 months ago
JSON representation

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

Awesome Lists containing this project

README

          

## ✅ 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:
```bash
sudo apt update
sudo apt install sysstat bc libnotify-bin
```

---

## 🚀 How to Use:
1. Clone or download the script.
2. Make it executable:
```bash
chmod +x system_monitor_notify.sh
```
3. (Optional) Start a screen session so it runs in the background:
```bash
screen -S monitor
```
4. Run the script:
```bash
./system_monitor_notify.sh
```
5. Detach from screen (leaves it running in background):
```
Ctrl + A, then D
```
6. Reattach to screen when needed:
```bash
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%
```

---