# VPS Monitor Telegram Bot

Bot Telegram untuk monitoring VPS Ubuntu secara aman.

## Fitur
| Command | Fungsi |
|---------|--------|
| `/start` | Pesan sambutan |
| `/help` | Daftar perintah |
| `/status` | Info sistem (CPU, RAM, Disk, Uptime, IP) |
| `/docker` | Daftar Docker container |
| `/logs_n8n` | 50 baris log n8n |
| `/restart_n8n` | Restart container n8n |

## Cara Membuat Bot
1. Buka @BotFather di Telegram, kirim `/newbot`
2. Ikuti instruksi, simpan token

## Cara Dapat User ID
1. Buka @userinfobot, kirim `/start`
2. Catat ID yang muncul

## Install
```bash
cd /path/ke/vps-monitor-bot
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```

## Setting .env
```bash
cp .env.example .env
nano .env
```
Isi BOT_TOKEN dan OWNER_CHAT_ID.

## Menjalankan
```bash
python3 bot.py
```

## Systemd Service (Auto-start)
Buat `/etc/systemd/system/vps-monitor-bot.service`:
```ini
[Unit]
Description=VPS Monitor Bot
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/path/ke/vps-monitor-bot
ExecStart=/path/ke/vps-monitor-bot/venv/bin/python /path/ke/vps-monitor-bot/bot.py
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
```

Aktifkan:
```bash
sudo systemctl daemon-reload
sudo systemctl enable --now vps-monitor-bot
sudo systemctl status vps-monitor-bot
```

## Struktur File
```
vps-monitor-bot/
├── bot.py            # Script utama
├── requirements.txt  # Dependencies  
├── .env.example      # Contoh konfigurasi
├── .env              # Konfigurasi (JANGAN commit)
└── README.md         # Dokumentasi
```

## Lisensi
MIT
