Bot Telegram untuk monitoring perangkat jaringan (router dan switch) dengan dukungan multi-vendor dan optical power monitoring.
- β 18 Vendor Support - Cisco, Huawei, ZTE, Juniper, MikroTik, Nokia, dll
- β Optical Power Monitoring - Cek TX/RX power dengan level indicator
- β SSH & Telnet - Dukungan kedua protokol dengan custom port
- β Multi Chat ID - Support user dan group Telegram
- β Timezone IANA - Konfigurasi timezone dengan format standar
- β Interface Monitoring - Cek status UP/DOWN dan deskripsi
- β Port Forwarding - Satu IP bisa untuk multiple device
- β Auto Update - Version checking, auto backup, dan rollback support
π Note: OLT support akan tersedia di v5.x.x
| OS | Version | Status |
|---|---|---|
| Ubuntu | 22.04 LTS | β Supported |
| Ubuntu | 24.04 LTS | β Supported |
| Debian | 12 (Bookworm) | β Supported |
| Debian | 13 (Trixie) | β Supported |
| Komponen | Minimal | Recommended |
|---|---|---|
| CPU | 1 Core | 2 Core |
| RAM | 512 MB | 1 GB |
| Storage | 1 GB | 2 GB |
| Network | 1 Mbps | 10 Mbps |
| Software | Version | Keterangan |
|---|---|---|
| Python | 3.8+ | Required |
| pip3 | Latest | Required |
| git | Latest | Optional (untuk clone) |
| Akses | Port | Keterangan |
|---|---|---|
| Telegram API | 443 (HTTPS) | Outbound ke api.telegram.org |
| SSH ke Device | 22 (default) | Ke perangkat jaringan |
| Telnet ke Device | 23 (default) | Ke perangkat jaringan |
π‘ Note: Port SSH/Telnet bisa custom sesuai konfigurasi port forwarding
cd ~
git clone https://github.com/Iyankz/botlinkmaster.git
cd botlinkmaster
chmod +x install.sh
./install.shEdit konfigurasi:
nano .envStart service:
sudo systemctl start botlinkmaster
sudo systemctl status botlinkmaster# 1. Install system packages
sudo apt update
sudo apt install -y python3 python3-pip python3-venv
# 2. Clone repository
cd ~
git clone https://github.com/Iyankz/botlinkmaster.git
cd botlinkmaster
# 3. Create virtual environment
python3 -m venv venv
source venv/bin/activate
# 4. Install dependencies
pip install python-telegram-bot python-dotenv paramiko pytz
# 5. Configure
cp .env.example .env
nano .env
# 6. Test
python telegram_bot.py# Telegram Bot Token (dari @BotFather)
TELEGRAM_BOT_TOKEN=123456789:ABCdefGHIjklMNOpqrsTUVwxyz
# Allowed Chat IDs (pisahkan dengan koma)
# Kosongkan untuk allow semua
ALLOWED_CHAT_IDS=216481118,-1001234567890
# Timezone (default: Asia/Jakarta)
TIMEZONE=Asia/Jakartacd ~/botlinkmaster
chmod +x update.sh
./update.shScript akan otomatis:
- β
Cek versi lokal vs remote (via file
VERSION) - β Backup semua file sebelum update
- β Download file terbaru dari GitHub
- β Preserve database dan konfigurasi
- β Restart service
# Cek update saja (tanpa install)
./update.sh --check
# Force update tanpa cek versi
./update.sh --force
# Cek perubahan file (checksum comparison) - v4.8.8+
./update.sh --diff
# Rollback ke backup terakhir
./update.sh --rollback
# Rollback ke backup spesifik
./update.sh --rollback backup_20250122_123456
# Bantuan
./update.sh --helpπ‘ v4.8.8+: Update script sekarang mendukung checksum-based update. Hotfix tanpa version bump akan terdeteksi dan bisa di-apply dengan
--force.
Dari v4.5.x / v4.6.x / v4.7.x / v4.8.x ke v4.8.8:
cd ~/botlinkmaster
# 1. Stop service
sudo systemctl stop botlinkmaster
# 2. Backup
cp botlinkmaster.db botlinkmaster.db.bak
cp .env .env.bak
# 3. Update files
wget -O telegram_bot.py https://raw.githubusercontent.com/Iyankz/botlinkmaster/main/telegram_bot.py
wget -O botlinkmaster.py https://raw.githubusercontent.com/Iyankz/botlinkmaster/main/botlinkmaster.py
wget -O database.py https://raw.githubusercontent.com/Iyankz/botlinkmaster/main/database.py
wget -O vendor_commands.py https://raw.githubusercontent.com/Iyankz/botlinkmaster/main/vendor_commands.py
wget -O timezone_config.py https://raw.githubusercontent.com/Iyankz/botlinkmaster/main/timezone_config.py
# 4. Restart
sudo systemctl restart botlinkmaster
sudo systemctl status botlinkmaster| Update (Replace) | Preserve (Jangan Replace) |
|---|---|
| telegram_bot.py | botlinkmaster.db |
| botlinkmaster.py | .env |
| vendor_commands.py | timezone.conf |
| database.py | botlinkmaster.log |
| timezone_config.py | |
| update.sh | |
| install.sh | |
| README.md | |
| CHANGELOG.md | |
| VERSION |
Bot mendukung multiple user dan group. Tambahkan Chat ID di .env:
# Single user
ALLOWED_CHAT_IDS=216481118
# Multiple users
ALLOWED_CHAT_IDS=216481118,123456789
# Users dan groups (group ID negatif)
ALLOWED_CHAT_IDS=216481118,-1001234567890,-1009876543210Untuk User:
- Kirim
/myidke bot setelah bot berjalan, atau - Kirim pesan ke
@userinfobot
Untuk Group:
- Tambahkan bot ke group
- Kirim
/startdi group - Kirim
/myiddi group - Group ID akan ditampilkan (angka negatif)
| Command | Deskripsi |
|---|---|
/start |
Info bot + Chat ID Anda |
/help |
Bantuan lengkap |
/help2 |
Contoh penggunaan |
/myid |
Chat ID lengkap |
/time |
Waktu saat ini |
π‘ Tip: Chat ID langsung muncul saat
/start, tidak perlu/myidlagi
| Command | Deskripsi |
|---|---|
/add |
Tambah perangkat |
/list |
Daftar perangkat |
/device [nama] |
Detail perangkat |
/delete [nama] |
Hapus perangkat |
| Command | Deskripsi |
|---|---|
/int [device] |
List semua interface |
/int [device] [page] |
Interface dengan pagination |
/cek [device] [interface] |
Cek status interface |
/redaman [device] [interface] |
Cek optical power |
π‘ Alias:
/int=/interfaces(keduanya sama, /int lebih singkat)
| Command | Deskripsi |
|---|---|
/vendors |
Daftar vendor |
/timezone |
Info timezone |
/settz [timezone] |
Set timezone |
/add
nama: router-core
host: 192.168.1.1
username: admin
password: admin123
protocol: ssh
port: 22
vendor: cisco_ios
description: Router Core Kantor Pusat
/add
nama: switch-old
host: 192.168.1.10
username: admin
password: admin123
protocol: telnet
port: 23
vendor: huawei
/add
nama: router-cabang-1
host: 10.0.0.1
username: admin
password: admin123
protocol: ssh
port: 2201
vendor: cisco_nxos
/add
nama: router-cabang-2
host: 10.0.0.1
username: admin
password: admin123
protocol: ssh
port: 2202
vendor: mikrotik
/int router-1
/int router-1 2
π‘ Bisa juga pakai
/interfaces router-1(sama dengan /int)
/cek router-1 Gi0/0
/redaman router-1 Gi0/0
| Vendor | Kode | Notes |
|---|---|---|
| Cisco IOS/IOS-XE | cisco_ios |
Router & Switch |
| Cisco NX-OS | cisco_nxos |
Nexus |
| Huawei VRP | huawei |
Router & Switch |
| ZTE | zte |
Router & Switch |
| Juniper JunOS | juniper |
Router & Switch |
| MikroTik RouterOS | mikrotik |
RouterOS v6/v7 |
| Nokia SR-OS | nokia |
Service Router |
| HP/Aruba | hp_aruba |
ProCurve & Aruba |
| H3C Comware | h3c |
H3C Switch |
| Ruijie | ruijie |
Ruijie Switch |
| FiberHome | fiberhome |
FH Switch |
| DCN | dcn |
DCN Switch |
| BDCOM | bdcom |
BDCOM Switch |
| Raisecom | raisecom |
Raisecom |
| FS.COM | fs |
FS Switch |
| Allied Telesis | allied |
AT Switch |
| Datacom | datacom |
Datacom Switch |
| Generic | generic |
Fallback |
Default timezone: Asia/Jakarta
Asia/Jakarta- WIB (UTC+7)Asia/Makassar- WITA (UTC+8)Asia/Jayapura- WIT (UTC+9)
Asia/Singapore- Singapore (UTC+8)Asia/Tokyo- Japan (UTC+9)Europe/London- UK (UTC+0/+1)America/New_York- US Eastern (UTC-5/-4)
/settz Asia/Jakarta
Lihat daftar timezone:
/timezone
/timezone Asia
/timezone Europe
# Cek status
sudo systemctl status botlinkmaster
# Cek log
sudo journalctl -u botlinkmaster -f
# Restart
sudo systemctl restart botlinkmasterv4.8.8 sudah memperbaiki masalah ini:
- Extended timeout untuk switch besar
- Support algorithm legacy SSH
- Improved prompt detection
Jika masih bermasalah:
- Pastikan vendor diset ke
mikrotik - Pastikan user SSH memiliki akses penuh
- Cek RouterOS version (minimum v6.x)
v4.8.8 fix:
- Menggunakan
display interface descriptionuntuk list interface - Extended timeout untuk switch dengan banyak port
v4.8.8 fix:
- Menggunakan
show interface brief(bukanshow ip interface brief)
- Pastikan IP dan port benar
- Cek firewall:
sudo ufw status - Pastikan SSH/Telnet aktif di perangkat
- Test manual:
ssh -p PORT user@host
- Cek username dan password
- Pastikan user memiliki akses SSH/Telnet
- Beberapa perangkat perlu enable password
sudo systemctl start botlinkmaster # Start
sudo systemctl stop botlinkmaster # Stop
sudo systemctl restart botlinkmaster # Restart
sudo systemctl status botlinkmaster # Status
sudo systemctl enable botlinkmaster # Auto-start on boot
sudo journalctl -u botlinkmaster -f # Live logRelease Type: Bug Fix (Non-breaking)
- Cisco NX-OS: Description terpotong jika mengandung spasi
- Masalah: "FS(OTB-B T1C1)" tampil sebagai "FS(OTB-B"
- Solusi: Ambil description dari
show running-config interface
- Huawei VRP/Quidway: Status interface UNKNOWN
- Masalah: /cek dan /redaman menampilkan UNKNOWN padahal port UP
- Solusi: Tambah pattern untuk non-CloudEngine devices
- Minimal changes, v4.8.7 baseline preserved
- MikroTik, CloudEngine, dan vendor lain tidak terpengaruh
- Database compatible dengan versi sebelumnya
- MikroTik CRS326: SSH algorithm compatibility untuk RouterOS 7.16.x
- Telnet: Login detection yang salah kirim command sebagai username
- Huawei CE6855: Menggunakan
display interface description
- Support 18 vendor
- Optical power monitoring
- Interface pagination
- Multi-vendor support
- SSH dan Telnet support
- Legacy device compatibility
| File | Path | Keterangan |
|---|---|---|
| Bot files | ~/botlinkmaster/ |
Semua file bot |
| Database | ~/botlinkmaster/botlinkmaster.db |
SQLite database |
| Config | ~/botlinkmaster/.env |
Konfigurasi (token, chat id) |
| Log | ~/botlinkmaster/botlinkmaster.log |
Log file |
| Version | ~/botlinkmaster/VERSION |
File versi untuk update |
| Changelog | ~/botlinkmaster/CHANGELOG.md |
History perubahan |
| Service | /etc/systemd/system/botlinkmaster.service |
Systemd service |
| Backup | ~/botlinkmaster/backup_*/ |
Backup dari update.sh |
Pull request dan issue welcome di GitHub repository.
Catatan: Untuk bantuan lebih lanjut, gunakan /help dan /help2 di bot.
Dibuat dengan β€οΈ oleh Iyankz
Proyek ini dilisensikan di bawah MIT License - lihat file LICENSE untuk detailnya.
Jika repositori ini membantu memudahkan pekerjaan Anda, mohon berikan bintang (Star) β pada repositori ini.