Skip to content

Kuma Monitoring Reporter is a Python-based tool that monitors Uptime Kuma metrics and sends status reports to a Telegram chat.

License

Notifications You must be signed in to change notification settings

power0matin/kuma-monitoring-reporter

Repository files navigation

πŸ“‘ Kuma Monitoring Reporter

A lightweight, modular tool to monitor Uptime Kuma metrics and send beautifully formatted status reports to Telegram. Stay informed about your services with real-time updates and customizable thresholds.

✨ Features

  • πŸ›  Modular Design β€” cleanly separated modules for fetching, formatting, and sending data
  • πŸ“ Formatted Reports β€” Markdown-based Telegram messages with πŸŸ’πŸŸ‘πŸ”΄ status visualization
  • βš™οΈ Easy Configuration β€” interactive setup via install.sh or manual JSON editing
  • πŸ“‘ Multi-Monitor Support β€” supports multiple monitor types (HTTP, Ping, Port, Group, etc.)
  • πŸ”” Customizable Notifications β€” sound or silent mode for Telegram alerts
  • πŸ”„ Systemd Integration β€” run as a persistent background service
  • πŸ›‘οΈ Error Handling β€” detailed logging and backups for debugging
  • βœ… Interactive Management β€” installation, updates, and control through a menu
  • πŸ” Secure API Access β€” compatible with Uptime Kuma read-only API tokens

πŸ“‹ Prerequisites

  • Operating System: Linux (tested on Ubuntu)

  • Dependencies:

    sudo apt-get install git python3 python3-pip systemd jq
  • Python Packages (in requirements.txt):

    • requests
    • schedule
    • prometheus_client
  • Uptime Kuma: a running instance with /metrics endpoint

  • Telegram: bot token from @BotFather and a chat ID

πŸš€ Installation

πŸ”§ Option 1 β€” Automatic (Recommended)

bash <(curl -s https://raw.githubusercontent.com/power0matin/kuma-monitoring-reporter/main/install.sh)

The script allows you to:

  • Clone the repository
  • Set up Python virtual environment
  • Install dependencies
  • Configure config.json interactively
  • Manage systemd service
  • Test Telegram connection and back up logs

πŸ›  Option 2 β€” Manual Installation (Advanced)

  1. Clone the repository:

    git clone https://github.com/power0matin/kuma-monitoring-reporter.git
    cd kuma-monitoring-reporter
  2. Create a virtual environment:

    python3 -m venv venv
    source venv/bin/activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Configure config.json:

    nano config/config.json

    Example:

    {
      "kuma_url": "http://your-server:3001/metrics",
      "telegram_bot_token": "1234567890:AAH...",
      "telegram_chat_id": "123456789",
      "auth_token": "",
      "thresholds": {
        "good": 200,
        "warning": 500,
        "critical": 1000
      },
      "report_interval": 1,
      "notification_mode": "sound"
    }
  5. Run the reporter:

    python3 report.py

πŸ“¬ Sample Report

Uptime Kuma Status Report
Time: 2025-07-29 13:55:00
════════════════════════════
🟒 Germany_hetzner (http) β€” 0.0 ms
🟑 Iran-0-1 (ping) β€” 78.0 ms
🟑 Iran-respina (http) β€” 86.0 ms
════════════════════════════
Summary: 3 UP, 0 DOWN

βš™οΈ Project Structure

File/Directory Description
report.py Main entry script
core/fetch.py Fetch metrics from Uptime Kuma API
core/formatter.py Process and format data
core/telegram.py Send formatted reports to Telegram
config/config.json Project configuration file
logs/error.log Error logs for debugging
install.sh Interactive setup and management script

🧰 Usage Instructions

Manage everything with:

cd ~/kuma-monitoring-reporter
./install.sh
πŸ“– Detailed options in install.sh
  1. Install project (clone, venv, deps)
  2. Configure config.json interactively
  3. Update project (git pull + pip upgrade)
  4. Manage systemd service (start / stop / restart)
  5. Test Telegram bot settings
  6. Backup logs
  7. Show project status and running services
  8. Check Python dependencies
  9. Completely uninstall the project
  10. Exit the menu

πŸ›‘οΈ Troubleshooting

  • No Telegram Reports

    • Use Option 5 to test bot token and chat ID

    • Check logs:

      cat ~/kuma-monitoring-reporter/logs/error.log
  • Systemd Issues

    sudo systemctl status kuma-reporter.service
  • Missing Python Packages

    • Use Option 8 to reinstall dependencies
  • Invalid Config

    • Reconfigure with Option 2

πŸ“… Project Roadmap

Phase Status Description
πŸ”Ή Phase 1: MVP βœ… Complete Fetch Kuma metrics, format reports, send to Telegram
πŸ”Ή Phase 2: Modularization βœ… Complete Core modules, error logging, interactive installer
πŸ”Ή Phase 3: Enhanced Features 🚧 In Progress Systemd integration, silent mode, log backups
πŸ”Ή Phase 4: Advanced + CI/CD πŸ“ Planned Selective reporting, buttons, structured logs, GitHub Actions

🌟 Future Development Ideas

  • Filtering monitors by tags or names
  • Selective reporting of problematic monitors only
  • Multiple Telegram channels or platform support (Discord, Slack)
  • Interactive Telegram buttons (Pause/Resume)
  • Structured logging (e.g., JSON)
  • Custom report templates

πŸ™Œ Contributing

  1. Fork the repo
  2. Create a branch: git checkout -b feature/your-feature
  3. Commit: git commit -m "Add your feature"
  4. Push: git push origin feature/your-feature
  5. Open a Pull Request

Please write clear commit messages and test your changes thoroughly.

πŸ“œ License

This project is licensed under the MIT License.

πŸ“¬ Contact

For suggestions or issues, open an Issue on GitHub or contact the maintainer directly.

docs(readme): improve Kuma Monitoring Reporter README formatting and structure

About

Kuma Monitoring Reporter is a Python-based tool that monitors Uptime Kuma metrics and sends status reports to a Telegram chat.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •