Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

System Monitor

A lightweight Python tool that monitors CPU, RAM, and disk usage on Linux and logs the results.
It can alert you via desktop notifications when thresholds are exceeded.

Features

  • Reads CPU usage from /proc/stat
  • Reads memory usage from /proc/meminfo
  • Checks disk usage with shutil.disk_usage
  • Checks the status of systemd services
  • Configurable thresholds via config.json
  • Optional CSV and JSON export of metrics
  • Desktop notifications using notify-send
  • Scheduled execution with the schedule library

Requirements

  • Python 3.6 or higher
  • Linux (uses /proc filesystem and systemctl)
  • Python packages: schedule (install with pip install schedule)

Configuration

Create a config.json file in the same directory:

{
    "thresholds": {
        "cpu": 80.0,
        "memory": 85.0,
        "disk": 80.0
    },
    "services": ["sshd", "cron", "NetworkManager"]
}

Usage

Run the script:

python system_monitoring_script.py

The monitor will check metrics every 5 seconds (adjustable in the code) and print logs.
If any threshold is exceeded, a desktop notification will pop up.

To stop, press Ctrl+C.

Example log output

schedule - DEBUG - Running job Job(interval=5, unit=seconds, do=job, args=(), kwargs={}) main - INFO - The service sshd is inactive main - INFO - The service cron is active main - INFO - The service NetworkManager is active main - INFO - CPU usage: 8.17% main - INFO - RAM usage: 71.02% main - INFO - Percentage of Disk used: 42.79% main - INFO - Total available Disk: 61.66GB main - INFO - Disk used: 26.38GB main - INFO - Available Disk: 32.11GB

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages