This Bash script monitors system performance in real-time. It tracks:
- CPU usage.
- RAM utilization.
- Disk space usage.
The script sends notifications if any metrics exceed predefined thresholds and logs the data for further analysis.
-
System metrics tracking:
- Percentage of CPU load.
- Percentage of RAM usage.
- Percentage of disk space usage.
-
Customizable thresholds:
You can set thresholds for each metric in the script's configuration. -
Notifications:
Sends alerts vianotify-send
(if available). -
Logging:
Logs all events to/var/log/system_monitor.log
.
-
Download the script and save it as
system_monitor.sh
. -
Make the script executable:
chmod +x system_monitor.sh Ensure your user has administrative privileges (to write logs).
Run the script with administrator privileges:
sudo ./system_monitor.sh
The script will monitor the system in real-time with a check interval of 5 seconds.
You can adjust thresholds and the log file path by editing the following variables in the script:
CPU_THRESHOLD=80 # CPU load threshold in percentage RAM_THRESHOLD=80 # RAM usage threshold in percentage DISK_THRESHOLD=80 # Disk usage threshold in percentage LOG_FILE="/var/log/system_monitor.log" # Log file path
CPU Load: 45% | RAM Usage: 70% | Disk Usage: 60%
CPU Load: 85% | RAM Usage: 90% | Disk Usage: 95%
[Notification]: CPU Load exceeded: 85%
[Notification]: Disk Usage exceeded: 95%
Operating System: Linux (including Kali Linux).
Utilities:
notify-send (for notifications).
Administrator privileges to write logs in the system directory.
- Add support for sending notifications via Telegram or email.
- Implement a graphical interface to display metrics.
- Integrate with data analysis tools (e.g., load graphs).
Created for practical use and to improve system parameter monitoring.
Feel free to suggest improvements!
Let me know if you need further refinements or additions!))