l-chege / monitor-logs

Python Script that monitors local system resources and logs every hour

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

System Resource Monitoring Script

  • This project objective is to develop a Python Script that monitors local system resources (CPU usage, memory usage and disk usage) and logs the info to a file every hour. It aims to provide real-time insights into system performance and resource utilization. Workflow
  • It automates the exection of the script using 'cron' on Unix-based system.
  • Decided to impelement dockerization for simplified deployment.

Prerequisites

  • Have Python 3.9 or higher installed
  • Have Docker installed

Installation

  1. Clone this repo to your local machine
git clone https://github.com/your-username/your-repo.git

Usage

  1. Run python script:
python system_monitor.py
  1. Verify logs, check the 'system_monitor.log' file. It should contain logged data about CPU, memory and disk usage every hour.

  2. Automate Script Execution

  • Using 'cron expression' on Unix-based systems.
  1. Build Docker image:
docker build -t system-monitor .
  1. Run the Docker container:
docker run -d --name system-monitor system-monitor

To be Continued/Future Implementations:

  • Grafana Integration to leverage on features such as visualizing system resource metrics.
  • Configure Prometheus to scrape metrics from the Python application.

Enjoy!

About

Python Script that monitors local system resources and logs every hour


Languages

Language:Python 99.4%Language:PowerShell 0.3%Language:JavaScript 0.1%Language:C 0.1%Language:CSS 0.1%Language:Batchfile 0.0%Language:Dockerfile 0.0%