This project provides a system monitoring and forecasting solution. It consists of two main components:
-
Sys.py: A real-time system monitoring script that collects system metrics such as CPU usage, memory usage, disk usage, GPU load, and more. The data is logged continuously into a CSV file (
system_monitoring.csv). -
ML.py: A machine learning script that loads the collected system monitoring data, performs time series forecasting on key system metrics (CPU, memory, disk usage, and RAM), visualizes the forecasts, and generates prioritized suggestions based on predicted system performance trends using natural language processing techniques.
-
Sys.py:- Collects system information every 5 seconds using libraries like
psutilandGPUtil. - Logs data including timestamp, platform details, CPU usage, memory usage, disk usage, GPU info, and GPU load into
system_monitoring.csv. - Designed to run continuously until manually stopped.
- Collects system information every 5 seconds using libraries like
-
ML.py:- Loads and preprocesses the
system_monitoring.csvdata. - Uses time series forecasting models such as ARIMA (with optional
pmdarimafor automatic order selection) or exponential smoothing for small datasets. - Visualizes historical data and forecasts with confidence intervals.
- Generates system health suggestions using sentiment analysis (
TextBlob) and optionally transformer-based text generation (transformerslibrary). - Provides insights and warnings based on forecasted system metrics exceeding data-driven thresholds.
- Loads and preprocesses the
-
system_monitoring.csv:- The CSV file where system metrics are logged by
Sys.py. - Used as input data for forecasting and analysis in
ML.py.
- The CSV file where system metrics are logged by
-
requirements.txt:- Lists all Python dependencies required to run the monitoring and forecasting scripts.
-
Clone or download this repository.
-
Install the required Python packages using pip:
pip install -r requirements.txt
Note: Some packages like
pmdarimaandtransformersare optional but recommended for improved forecasting and suggestion generation.
Run the Sys.py script to start collecting system metrics in real-time:
python Sys.pyThis will create or append to the system_monitoring.csv file in the current directory, logging system metrics every 5 seconds. Press Ctrl+C to stop monitoring.
After collecting sufficient data, run the ML.py script to analyze and forecast system metrics:
python ML.pyThis script will:
- Load and preprocess the monitoring data.
- Forecast CPU, memory, disk usage, and RAM using time series models.
- Plot historical data and forecasts with confidence intervals.
- Generate prioritized system health suggestions based on forecast trends.
- Ensure
system_monitoring.csvis present in the same directory as the scripts before runningML.py. - For small datasets, the forecasting model falls back to exponential smoothing.
- If
pmdarimaortransformerslibraries are not installed, the scripts will use fallback methods but with reduced functionality. - The system monitoring script requires permissions to access system metrics and may need to be run with appropriate privileges.
Key Python libraries used:
psutil- for system monitoringGPUtil- for GPU informationpandas,numpy- data handling and numerical operationsmatplotlib- plottingstatsmodels,pmdarima- time series forecastingscikit-learn- evaluation metricsTextBlob- sentiment analysistransformers- optional, for advanced NLP suggestions
Refer to requirements.txt for the full list.
This project is licensed under the MIT License. See the LICENSE file for details.
This project is provided as-is without warranty. Use at your own risk.