Skip to content

AverageCEnjoyer/ServerMonitoring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Server Monitoring Dashboard

A lightweight server/PC monitoring dashboard with a Flask-based Python backend and a simple HTML/JavaScript frontend. The backend continuously collects system performance metrics and sends automatic email alerts when resource usage exceeds configured thresholds. The frontend periodically fetches and displays the live data.


Features

  • 📊 Real-time monitoring of server or PC performance
  • 🐍 Python backend using Flask
  • 🌐 HTML + JavaScript frontend
  • 🔄 Periodic polling from frontend
  • 🚨 Automated email alerts for high usage
  • 🔐 Environment-based configuration using .env
  • 🌐 Generate PDF Rapport by an AI Expert

Monitored Metrics

  • CPU usage (%)
  • RAM usage (%)
  • Disk usage (%)
  • System information (OS, uptime, hostname)

Project Structure

project-root/
│
├── DummyServer.py      # Flask backend (monitoring + alerts)
├── index.html          # Frontend dashboard
├── requirements.txt    # Python dependencies
├── package.json        # Frontend dependencies
├── package-lock.json
├── .env                # Environment variables
├── .gitignore
├── node_modules/
└── README.md

How It Works

  1. DummyServer.py continuously collects system metrics using psutil.
  2. Thresholds are checked for CPU, RAM, and Disk usage.
  3. If a threshold is exceeded, an email alert is automatically sent.
  4. The Flask API exposes monitoring data as JSON.
  5. index.html fetches the data at a fixed interval and updates the UI.
  6. The user could also generate a pdf rapport about the current situation of the server.

Requirements

  • Python 3.14
  • A modern web browser

Python Dependencies

Installed via:

pip install -r requirements.txt

Environment Variables

Sensitive configuration is stored in a .env file (not committed to version control).

Example .env file:

ALERT_EMAIL="your_alert_email@example.com"

SMTP_SERVER="smtp.example.com"
SMTP_PORT=587
SMTP_USER="smtp_user@example.com"
SMTP_PASSWORD="your_smtp_password"

OPENAI_API_KEY="your_openai_api_key"
OPENAI_URL="https://api.openai.com/v1/chat/completions"

Description

  • ALERT_EMAIL – Email address that receives alert notifications
  • SMTP_SERVER – SMTP server hostname
  • SMTP_PORT – SMTP server port
  • SMTP_USER – SMTP authentication username
  • SMTP_PASSWORD – SMTP authentication password
  • OPENAI_API_KEY – API key for OpenAI (if used for analysis or summaries)
  • OPENAI_URL – OpenAI API endpoint

Running the Backend

python DummyServer.py

The backend will start a Flask server (default: http://localhost:5000) and:

  • Collect performance metrics
  • Monitor threshold limits
  • Send email alerts when limits are exceeded

Running the Frontend

Option 1: Open Directly

Simply open index.html in your browser.

Option 2: Local HTTP Server (recommended)

python -m http.server 8000

Then visit:

http://localhost:8000/index.html

Alerting Logic

  • CPU, RAM, and Disk usage are checked at regular intervals

  • If usage exceeds the configured threshold:

    • An alert email is sent automatically

⚠️ Do not expose SMTP credentials publicly


Security Notes

  • Never commit .env files
  • Restrict API access in production
  • Use HTTPS when monitoring remote servers
  • Consider authentication for public deployments

Possible Improvements

  • WebSocket-based real-time updates
  • Alert cooldown configuration
  • Alert history logging
  • Grafana / Prometheus integration
  • Docker support

License

This project is intended for learning, internal monitoring, and small-scale deployments.

You are free to modify and extend it for your own use.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors