OmarRamadan1 / systemMonitor-CPU_Prediction

System Resource Monitor and Predictor: A Python-based project that monitors system resources (CPU usage, memory usage, disk usage, and host IP address) and predicts future CPU usage using linear regression. Ideal for scenarios where resource management is critical.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

System Monitor and CPU Usage Prediction

This project consists of two scripts that monitor the system’s CPU usage, memory usage, disk usage, and host IP address and predict future CPU usage.

Dependencies

The scripts require the following Python libraries:

  • psutil
  • datetime
  • math
  • pandas
  • sklearn.linear_model

You can install these using pip:

pip install psutil datetime math pandas sklearn

Usage

  1. Run the system monitoring script in your terminal. You will be prompted to enter the following parameters:

    • Memory max usage: The maximum memory usage in percent. If the system’s memory usage reaches this threshold, a warning will be logged.
    • Refresh time: The time interval in seconds at which the system parameters will be checked.
    • Number of samples: The number of times the system parameters should be checked.
  2. The script will then start monitoring the system parameters and log them in a file named log_<current_date>.txt. If the memory usage exceeds the specified threshold, a warning will be logged in a separate file named <current_date>-notification.log.

  3. Run the CPU usage prediction script. This script reads the log file generated by the system monitoring script and uses linear regression to predict the CPU usage for the next day. The prediction is printed to the console every 5 minutes.

Output

The output log file contains lines in the following format:

<date>, <time>, <CPU usage>, <memory usage>, <disk usage>, <host IP>

Note

The scripts calculate average CPU usage over the specified refresh time interval and memory and disk usage are reported in gigabytes (GB). Please ensure that you have the necessary permissions to read system parameters and write files in your environment before running these scripts.

About

System Resource Monitor and Predictor: A Python-based project that monitors system resources (CPU usage, memory usage, disk usage, and host IP address) and predicts future CPU usage using linear regression. Ideal for scenarios where resource management is critical.


Languages

Language:Python 100.0%