The Memory Harvesting System is designed to monitor and predict memory usage in Linux environments. This system includes a Go-based agent for collecting and analyzing memory data from virtual machines managed by the KVM virtualizer, using the Libvirt library. Key functionalities include:
- Monitoring running virtual machines, allocated memory, and current memory consumption.
- Predicting memory usage based on recent consumption trends.
- Reporting memory harvesting data to system managers.
- Recording and managing memory usage violations.
- Visualizing data with Prometheus and Grafana.
The server side is implemented in Python with the Flask framework and uses an SQLite database for data storage. It manages agent registrations, boundary settings, and violation data.
- Memory Monitoring: Tracks number of running VMs, allocated memory, and momentary memory consumption (RSS).
- Prediction: Uses recent memory consumption to predict near-future usage.
- Harvesting: Calculates and reports differences between allocated and predicted memory.
- Violation Management: Logs instances where actual memory consumption exceeds predictions.
- Visualization: Integrates with Prometheus and Grafana for data visualization.
- Server Management: Flask-based server to manage agents, boundaries, and violations.
To install and run the Go-based agent:
-
Clone the Repository:
git clone https://github.com/yourusername/memory-harvesting.git cd memory-harvesting
-
Install Dependencies: Ensure you have Go installed. Then, run:
go mod tidy
-
Run the Agent:
go run prometheus-libvirt-exporter.go
To set up and run the Flask-based server:
-
Clone the Repository:
git clone https://github.com/yourusername/memory-harvesting-server.git cd memory-harvesting-server
-
Set Up Virtual Environment:
python3 -m venv venv source venv/bin/activate
-
Install Dependencies:
pip install -r requirements.txt
-
Run the Server:
flask run
prometheus-libvirt-exporter.go
: Main agent code file.
./static
: Static files../static/back.jpg
: Background image../instance
: Instance-specific files../instance/vms.db
: SQLite database../app.py
: Main server application file../templates
: HTML templates../templates/index.html
: Main HTML template.
Once the agent and server are running, memory data will be collected and sent to Prometheus. You can then visualize the data in Grafana and manage configurations via the Flask web interface.
(https://drive.google.com/drive/folders/1fVKD3qgvdG7FxvTgnFoAcVnp6Z6kjkZJ?usp=sharing)
This project is licensed under the MIT License. See the LICENSE file for details.
A | B | C |
---|---|---|
Installation Issues | Usage Examples | Contribution Guidelines |