Skip to content

Control and monitor your server using your Telegram!

License

Notifications You must be signed in to change notification settings

TheDevisi/monigo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค– Monigo - Telegram Server Monitoring Bot

A powerful Telegram bot for monitoring your server's vital statistics in real-time. Built with Go, this bot provides an elegant way to check CPU usage, RAM consumption, disk space, and system uptime.

License Go Version

โœจ Features

  • ๐ŸŒ Bilingual support in progress (English/Russian)
  • ๐Ÿ’ป Real-time CPU monitoring
  • ๐Ÿ’พ RAM usage tracking
  • ๐Ÿ’ฟ Disk space analysis
  • โฑ๏ธ System uptime monitoring
  • ๐Ÿ”’ Secure owner-only access
  • โŒจ๏ธ Intuitive keyboard interface

๐Ÿš€ Getting Started

Prerequisites

Installation

  1. Clone the repository:
git clone https://github.com/TheDevisi/monigo.git
cd monigo
  1. Create a .env file in the project root:
BOT_TOKEN=your_bot_token_here
OWNER_ID=your_telegram_id_here(get it on @userinfobot)
  1. Install dependencies:
go mod download
  1. Build and run:

Development Build

go build -v -o monigo
# Make sure to copy .env file to the same directory as the binary
cp .env ./monigo
./monigo

Production Build

# Optimized build with reduced binary size
go build -v -ldflags="-s -w" -o monigo
# Make sure to copy .env file to the same directory as the binary
cp .env ./monigo
./monigo

Cross Compilation

For different architectures:

# For ARM (e.g., Raspberry Pi)
GOOS=linux GOARCH=arm go build -o monigo-arm

# For 64-bit Windows
GOOS=windows GOARCH=amd64 go build -o monigo.exe

# For macOS
GOOS=darwin GOARCH=amd64 go build -o monigo-mac

๐ŸŽฎ Usage

  1. Start the bot by sending /start
  2. Choose your preferred language (๐Ÿ‡ฌ๐Ÿ‡ง English or ๐Ÿ‡ท๐Ÿ‡บ Russian)
  3. Use the keyboard interface to:
    • Check CPU status
    • Monitor RAM usage
    • View disk space
    • Check system uptime
    • Switch language

๐Ÿค Commands

Command Description
/start Initialize the bot and select language
๐Ÿ’ป CPU Show CPU information
๐Ÿ’พ RAM Display memory usage
๐Ÿ’ฟ Disk Show disk space stats
โฑ Uptime Display system uptime
๐Ÿ”„ Change language Switch interface language

๐Ÿ”’ Security

  • Bot access is restricted to the owner specified in OWNER_ID
  • Environment variables are used for sensitive data
  • Unauthorized access attempts are logged

๐Ÿ› ๏ธ Technical Details

Dependencies

Project Structure

monigo/
โ”œโ”€โ”€ config/
โ”‚   โ””โ”€โ”€ config.go  # Configuration management
โ”‚       
โ”œโ”€โ”€ translations/
โ”‚   โ”œโ”€โ”€ translations.go # Work still in progress.
โ”‚
โ”œโ”€โ”€ telegram/
โ”‚   โ”œโ”€โ”€ keyboard.go  # Keyboard layouts
โ”‚   โ”œโ”€โ”€ send_cpu.go      # CPU monitoring
โ”‚   โ”œโ”€โ”€ send_ram.go      # RAM monitoring
โ”‚   โ”œโ”€โ”€ send_disk_usage.go # Disk monitoring
โ”‚   โ”œโ”€โ”€ send_uptime.go   # Uptime monitoring
โ”‚   โ””โ”€โ”€ start.go         # Bot initialization
โ”œโ”€โ”€ utils/
โ”‚   โ”œโ”€โ”€ disk_usage.go    # Disk utilities
โ”‚   โ”œโ”€โ”€ get_cpu_info.go  # CPU utilities
โ”‚   โ”œโ”€โ”€ get_memory.go    # Memory utilities
โ”‚   โ””โ”€โ”€ uptime.go        # Uptime utilities
โ”œโ”€โ”€ main.go              # Entry point

๐Ÿ“ TODO

  • SSH login monitoring
  • Additional system metrics
  • Custom alert thresholds
  • Make it more user-friendly
  • Full server control via bot
  • Make it systemd service
  • Add Windows Server support

โ“ FAQ

General Questions

Q: How secure is this bot? A: The bot implements owner-only access through Telegram User ID verification. Only the user specified in OWNER_ID can access the monitoring features.

Q: Can I monitor multiple servers? A: Currently, one bot instance monitors one server. For multiple servers, you'll need to run separate instances with different bot tokens.

Q: Does it work on Windows? A: While the bot can be compiled for Windows, it's primarily tested on Linux systems. Windows support is on my roadmap.

Installation & Setup

Q: Why can't I connect to my bot? A: Common issues include:

  • Incorrect BOT_TOKEN in .env
  • Bot not running/terminated
  • Firewall blocking connections

Q: How do I get my User ID? A: Send a message to @userinfobot on Telegram. It will reply with your User ID.

Q: How do I run the bot in the background? A: You can:

  1. Use systemd (recommended for Linux):
sudo systemctl start monigo # if you set up it on your own
  1. Use screen or tmux:
screen -S monigo
./monigo
# Press Ctrl+A+D to detach

Technical Questions

Q: What's the resource usage of the bot? A: The bot is lightweight, typically using:

  • CPU: < 1%
  • RAM: ~20-30MB
  • Disk: ~10MB

Q: How often does it update statistics? A: Stats are fetched on-demand when you request them through commands.

Q: Can I customize the monitoring intervals? A: Currently, monitoring is on-demand. Automated interval monitoring is planned for future releases.

Q: How do I update the bot? A: Pull the latest changes and rebuild:

git pull origin main
go build

Troubleshooting

Q: Why are some metrics showing as "Error"? A: This usually happens when:

  • The bot lacks necessary permissions
  • System calls are restricted
  • The monitored resource is unavailable

Contributing

Q: How can I contribute? A: You can:

  • Submit issues for bugs or feature requests
  • Fork the repository and create pull requests
  • Improve documentation
  • Add translations

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿค Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

๐Ÿ‘ค Author

Denis Sinyutin (TheDevisi)


โญ๏ธ Star this project if you find it useful!