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.
- ๐ 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
- Go 1.24 or higher
- Telegram Bot Token (from @BotFather)
- Your Telegram User ID (from @userinfobot)
- Clone the repository:
git clone https://github.com/TheDevisi/monigo.git
cd monigo
- Create a
.env
file in the project root:
BOT_TOKEN=your_bot_token_here
OWNER_ID=your_telegram_id_here(get it on @userinfobot)
- Install dependencies:
go mod download
- Build and run:
go build -v -o monigo
# Make sure to copy .env file to the same directory as the binary
cp .env ./monigo
./monigo
# 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
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
- Start the bot by sending
/start
- Choose your preferred language (๐ฌ๐ง English or ๐ท๐บ Russian)
- Use the keyboard interface to:
- Check CPU status
- Monitor RAM usage
- View disk space
- Check system uptime
- Switch language
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 |
- Bot access is restricted to the owner specified in
OWNER_ID
- Environment variables are used for sensitive data
- Unauthorized access attempts are logged
- github.com/go-telegram/bot - Telegram Bot API
- github.com/shirou/gopsutil - System statistics
- github.com/joho/godotenv - Environment configuration
- github.com/sirupsen/logrus - Logging
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
- 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
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.
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:
- Use systemd (recommended for Linux):
sudo systemctl start monigo # if you set up it on your own
- Use screen or tmux:
screen -S monigo
./monigo
# Press Ctrl+A+D to detach
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
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
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
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
Denis Sinyutin (TheDevisi)
โญ๏ธ Star this project if you find it useful!