This project aims to predict server downtime using machine learning models such as XGBoost, Random Forest, and Support Vector Machines (SVM). It leverages historical data from server logs and performance metrics to forecast potential downtimes and prevent system failures. The project integrates Flask for building a web application, Prometheus for real-time server metric collection, and Grafana for monitoring and visualizing server performance.
- Machine Learning Models: Utilizes models like XGBoost, Random Forest, and SVM to predict server downtimes.
- Real-Time Monitoring: Implements Prometheus for collecting server metrics and Grafana for data visualization.
- Web Interface: Provides a Flask-based frontend to view predictions and visualizations.
- Prediction Accuracy: Evaluates models using accuracy, precision, recall, and F1 score.
The system architecture includes:
- Data Collection: Server logs and performance metrics are collected using Prometheus.
- Data Preprocessing: The collected data is preprocessed, cleaned, and used to train machine learning models.
- Model Training and Prediction: XGBoost, Random Forest, and SVM models are trained and used to predict server downtime.
- Visualization: Grafana dashboards visualize real-time server metrics and model predictions.
- Flask Frontend: A Flask-based web application allows users to interact with the predictions and monitor server health.
- Python 3.x
- Git
- Prometheus
- Grafana
- Flask
- Machine learning libraries (e.g., XGBoost, scikit-learn, pandas)
-
Clone the Repository
git clone https://github.com/yourusername/server-downtime-prediction.git cd server-downtime-prediction -
Install Dependencies
Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
Install required Python packages:
pip install -r requirements.txt
-
Setup Prometheus and Grafana
Follow the official documentation to set up Prometheus and Grafana to collect and visualize server metrics.
-
Train the Model
The machine learning models can be trained using the provided training script:
python train_model.py
This will generate the trained models and save them for later use in predictions.
-
Run the Flask App
Start the Flask app to see the frontend:
python app.py
Visit
http://127.0.0.1:5000in your browser to interact with the prediction system.
- Open the web interface hosted on
http://127.0.0.1:5000. - View real-time server metrics and downtime predictions.
- Adjust settings or refresh data to monitor server health in real time.
- Accuracy: Measures the overall correctness of the predictions.
- Precision: Measures the accuracy of positive predictions.
- Recall: Measures how many actual downtimes were correctly identified.
- F1 Score: The harmonic mean of precision and recall, providing a balance between the two.
Feel free to fork the repository, open issues, or submit pull requests. Contributions are welcome!
This project is licensed under the MIT License - see the LICENSE file for details.