SysMon is a command-line (CLI) system monitoring and alerting tool for Linux, developed using modern C++ (C++17). This project demonstrates advanced C++ concepts, including multithreading, object-oriented design, and direct interaction with the Linux /proc filesystem.
- Real-time Metric Monitoring: Concurrently tracks key system metrics such as CPU usage, memory consumption, and disk I/O rates.
- Multithreaded Architecture: Each core function (metric collection, rule evaluation, UI rendering) runs in a separate thread for a responsive, non-blocking experience.
- Rule-Based Alerting: Generates alerts based on user-defined thresholds in an external configuration file.
- Interactive CLI: Features a continuously updating dashboard and accepts user commands (
exit,clear) for interaction. - External Configuration: System parameters like alert thresholds can be configured via a
monitor.conffile without recompiling.
- Language: C++17
- Build System: CMake
- Platform: Linux
- Key Concepts Demonstrated:
- Concurrency:
std::thread,std::mutex,std::condition_variable,std::atomic - Object-Oriented Design: Polymorphism, Abstraction, RAII
- Modern C++: Smart Pointers (
std::unique_ptr), STL containers,std::variant,std::optional,std::chrono - System Interaction: Parsing data from the
/procvirtual filesystem.
- Concurrency:
- A C++17 compatible compiler (e.g.,
g++) CMakegit
On Debian/Ubuntu, install with:
sudo apt update
sudo apt install build-essential cmake git- Clone the repository:
git clone https://github.com/your-username/SysMon.git
cd SysMon- Build the project:
mkdir build && cd build
cmake ..
makeAn executable named linux_monitor will be created in the build directory.
- (Optional) Create a configuration file: In the build directory, create a monitor.conf file to set custom alert thresholds.
Example monitor.conf:
# Alert thresholds
CPU_THRESHOLD = 80.0
MEMORY_THRESHOLD = 75.0
DISK_IO_THRESHOLD = 5120.0 # in KB/s- Run the application: From the build directory, execute:
./linux_monitor- Available Commands:
-
clear: Clears active alerts from the screen. -
exitorquit: Shuts down the application gracefully. -
Ctrl+C: Sends aSIGINTto safely terminate the application.
This project is licensed under the MIT License. See the LICENSE file for details.