34 lines
1.1 KiB
Markdown
34 lines
1.1 KiB
Markdown
# Monitor Memory and Disk usage
|
|
|
|
The scripts in this repo monitors for high memory usage and low disk space available.
|
|
|
|
It sends a notification using `notify-send` to the user.
|
|
|
|
For memory, when the condition is met, a signal is sent (e.g. `SIGSTOP`, `SIGKILL`).
|
|
|
|
## Configure
|
|
|
|
In `config.py` you could configure how often to monitor for memory usage and disk usage and what are the limits for each.
|
|
|
|
You could also configure whether to send the `STOP` signal or `KILL` signal (or something else). If you send the `STOP` signal, the process can be continued using `SIGCONT` signal.
|
|
|
|
You can also configure the icon used by `notify-send`.
|
|
|
|
## Install
|
|
|
|
Change the `WorkingDirectory` param in the two service files.
|
|
|
|
Copy the `mem_monitor.service` and `disk_monitor.service` files into `/etc/systemd/system`.
|
|
|
|
Then run:
|
|
|
|
```bash
|
|
systemctl daemon-reload
|
|
systemctl enable mem_monitor.service
|
|
systemctl enable disk_monitor.service
|
|
systemctl start mem_monitor.service
|
|
systemctl start disk_monitor.service
|
|
```
|
|
|
|
Check if there might be any errors using `journalctl -fu mem_monitor.service` or `journalctl -fu disk_monitor.service`.
|