Skip to content

thetelgote/System-Monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Typing SVG

Python Flask psutil Gunicorn JavaScript

License: MIT PRs Welcome Made with ❀

Overview β€’ Features β€’ Tech Stack β€’ Architecture β€’ Getting Started β€’ API Reference β€’ Deployment β€’ Contributing


Visitors GitHub last commit GitHub repo size GitHub stars Status


πŸ“– Overview

System Monitor is a lightweight, self-hosted web dashboard that watches your machine's vital signs in real time β€” CPU load, memory usage, disk space, network I/O, process count, uptime, and (where supported) CPU temperature β€” and raises clear alerts the moment something crosses a healthy threshold.

No agents, no external monitoring SaaS, no config files β€” clone it, run it, and you have a live health dashboard for any machine it's deployed on.

πŸ”— Live Demo Β Β·Β  Report a Bug

Deploy Status

πŸŽ₯ Tip: Record a short GIF of the live dashboard updating (CPU spiking, an alert firing) with ScreenToGif or Kap, save it to docs/demo.gif, and embed it here:

![System Monitor demo](./docs/demo.gif)

A moving dashboard preview is the single most persuasive thing a recruiter will see on this repo β€” nothing sells "I can build real, live-updating tools" faster.


✨ Features

πŸ“Š Live System Metrics CPU %, memory %, disk usage %, process count, network sent/received (MB), and uptime, refreshed continuously
🌑️ CPU Temperature Reads hardware sensors where available, gracefully falls back to N/A when not supported
🚨 Smart Alerting Automatic threshold checks β€” CPU > 80%, memory > 80%, disk > 90%, temp > 80Β° β€” each escalating the system status
πŸŸ’πŸŸ‘πŸ”΄ Status Levels Rolls all checks into a single Healthy / Warning / Critical status for an at-a-glance read
πŸ•’ Alert History Keeps the last 10 unique alerts with timestamps, so you can see what happened and when
🌐 Simple JSON API A single /health endpoint returns everything the frontend needs β€” easy to consume from anywhere
⚑ Zero-config Frontend Server-rendered dashboard (Flask + Jinja) with a small vanilla JS layer (sam.js) polling for updates
πŸš€ Production-ready Ships with a Procfile and gunicorn, ready to deploy on Render, Heroku, Railway, or any WSGI host

πŸ›  Tech Stack

Tech stack icons



Layer Technology
Backend Python, Flask
System Metrics psutil (CPU, memory, disk, network, sensors, process count)
Frontend Jinja2-rendered HTML, CSS, vanilla JavaScript (sam.js)
WSGI Server Gunicorn
Deployment Procfile-based (Render / Heroku-style platforms)

πŸ— Architecture & How It Works

System-Monitor/
β”œβ”€β”€ app.py            # Flask app β€” routes, request handling, alert history
β”œβ”€β”€ monitor.py         # Collects raw system metrics via psutil
β”œβ”€β”€ alerts.py           # Applies thresholds to metrics β†’ alerts + status
β”œβ”€β”€ templates/
β”‚   └── index.html       # Dashboard shell rendered by Flask
β”œβ”€β”€ static/
β”‚   └── sam.js             # Client-side polling β€” fetches /health and updates the UI
β”œβ”€β”€ requirements.txt
└── Procfile             # gunicorn app:app β€” production entry point

Data flow, end to end:

Browser (sam.js, polling)
      β”‚  GET /health
      β–Ό
app.py  ──▢  monitor.get_system_health()  ──▢  psutil (CPU / RAM / disk / net / temp)
      β”‚
      β–Ό
alerts.check_alerts(data)  ──▢  thresholds β†’ [alerts...], status
      β”‚
      β–Ό
JSON response: { data, alerts, status, history }
      β”‚
      β–Ό
Browser updates dashboard + alert feed in place

Key design details:

  • monitor.py isolates all system-metric collection β€” CPU/memory/disk percentages, network counters converted to MB, uptime derived from psutil.boot_time(), and a best-effort CPU temperature read that safely degrades to "N/A" on platforms without sensor support (e.g. most cloud hosts).
  • alerts.py is a pure function: metrics in, (alerts, status) out β€” easy to unit test or extend with new thresholds.
  • app.py keeps a rolling in-memory alert_history, deduplicating consecutive identical alerts so the feed doesn't spam the same warning every poll cycle.
  • The frontend is intentionally dependency-light: sam.js polls /health and updates the DOM directly, no frontend framework or build step required.

πŸš€ Getting Started

Prerequisites

  • Python β‰₯ 3.8
  • pip for installing dependencies

1. Clone the repository

git clone https://github.com/thetelgote/System-Monitor.git
cd System-Monitor

2. Create a virtual environment (recommended)

python -m venv venv
source venv/bin/activate        # Windows: venv\Scripts\activate

3. Install dependencies

pip install -r requirements.txt

4. Run the app

python app.py

The dashboard will be available at http://127.0.0.1:5000. πŸŽ‰

Metrics refresh automatically as sam.js polls the /health endpoint β€” no page reload needed.

5. Run in production mode (optional, local test)

gunicorn app:app

πŸ“‘ API Reference

Base URL: http://127.0.0.1:5000

Method Endpoint Description
GET / Renders the dashboard (index.html)
GET /health Returns live system metrics, active alerts, overall status, and recent alert history as JSON

Example /health response:

{
  "data": {
    "cpu": 23.4,
    "memory": 61.2,
    "disk": 47.8,
    "processes": 214,
    "net_sent": 152.34,
    "net_recv": 980.12,
    "uptime": 93042,
    "system": "Linux",
    "cpu_temp": 52.0
  },
  "alerts": [],
  "status": "Healthy",
  "history": [
    { "message": "πŸ”₯ High CPU Usage", "time": "14:32:10" }
  ]
}

Alert thresholds:

Metric Warning Critical
CPU usage > 80% β€”
Memory usage > 80% β€”
Disk usage β€” > 90%
CPU temperature β€” > 80Β°

πŸ“¦ Deployment

The repo ships with everything needed for a one-click deploy to any Heroku-style platform (Render, Railway, Heroku):

Procfile β†’ web: gunicorn app:app

To deploy on Render:

  1. Push this repo to GitHub (already done βœ…)
  2. Create a new Web Service on Render, pointing at this repo
  3. Build command: pip install -r requirements.txt
  4. Start command: gunicorn app:app
  5. Deploy β€” Render will detect the Procfile automatically

⚠️ Note: CPU temperature sensors are typically unavailable on cloud VMs/containers β€” cpu_temp will report "N/A" in most hosted environments. This is expected and handled gracefully by the app.


πŸ—Ί Roadmap

  • WebSocket-based live updates instead of polling
  • Historical charts (CPU/memory trend over time)
  • Configurable alert thresholds via environment variables
  • Email/Slack notifications on Critical status
  • Multi-host monitoring (dashboard for several machines at once)
  • Unit tests for monitor.py and alerts.py

🀝 Contributing

Contributions, issues, and feature requests are welcome!

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

Distributed under the MIT License. See LICENSE for more information.


About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors