A Linux-based real-time resource monitoring tool developed using C++ and Node.js. This project monitors CPU and memory usage, logs the data, and provides a web interface to visualize and track resource usage over time.
- Real-Time CPU and Memory Usage Monitoring: Continuously tracks system resources.
- Logging: Logs CPU and memory statistics into a file for historical analysis.
- Web Interface: Displays logs in real-time with a graphical representation of CPU and memory usage.
- Chart Visualization: Visualizes CPU and memory usage with charts using Chart.js.
- Cross-Platform: Can be run on Linux systems and accessed through a web interface.
Before you begin, make sure you have the following installed on your machine:
- Linux System (Ubuntu or similar distribution)
- C++ Compiler: For compiling the monitoring application.
- Node.js: For the backend server that serves the logs and the web interface.
- Git: For version control.
git clone https://github.com/ujjwalkran/CPUMonitoringTool.git
cd CPUMonitoringTool
Navigate to the src
directory and compile the C++ files:
cd src
make
Start the monitoring tool:
../build/resource_monitor
This will begin logging CPU and memory usage to backend/logs/resource_log.txt.
Navigate to the frontend directory and install required dependencies:
cd frontend
npm install
Navigate to the root directory and start the Node.js server:
cd ..
npm start
This will start a web server at http://localhost:3000
.
- The backend (Node.js) will provide the resource logs through an API at
http://localhost:3000/api/logs
. - The frontend will fetch the logs every 2 seconds and display them on the webpage.
- The logs include CPU and memory usage percentages, which are logged every second.
- C++: For CPU and memory monitoring logic.
- Node.js: For backend server to serve the logs.
- Chart.js: For visualizing CPU and memory usage as charts.
- HTML/CSS: For the web interface.
- JavaScript: For frontend functionality.
CPUMonitoringTool/
├── backend
│ ├── logs
│ ├── node_modules
│ ├── package-lock.json
│ ├── package.json
│ └── server.js
├── build
├── data
│ └── usage_data.txt
├── frontend
│ ├── index.html
│ ├── script.js
│ └── style.css
├── logs
│ └── resource_log.txt
├── scripts
│ ├── logs
│ ├── start.sh
│ └── stop.sh
├── src
│ ├── C++
│ │ ├── cpu_monitor.cpp
│ │ ├── cpu_monitor.h
│ │ ├── logger.cpp
│ │ ├── logger.h
│ │ ├── main.cpp
│ │ ├── memory_monitor.cpp
│ │ └── memory_monitor.h
├── LICENSE
└── README.md
This will format your file structure properly in Markdown.
We welcome contributions to improve the project! To contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes and commit (
git commit -am 'Add feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request to merge your changes.
This project is licensed under the MIT License
- see the LICENSE file for details.