1. Home
  2. Docs
  3. MikroTik
  4. Monitoring
  5. The Dude: Membuat Notifikasi Whatsapp Telegram Gotify MikroTik

The Dude: Membuat Notifikasi Whatsapp Telegram Gotify MikroTik

Untuk mengirim notifikasi dari The Dude di MikroTik v7 ke WhatsApp (CallMeBot), Telegram, dan Gotify, caranya sama: gunakan tipe notifikasi “Execute on server” lalu panggil API masing‑masing melalui /tool fetch. The Dude adalah Network Management System (NMS) dalam ekosistem MikroTik RouterOS yang memudahkan kita monitoring kondisi perangkat, uptime, dan service yang berjalan.

Dikesempatan kali ini kita manfaatkan fitur notifikasi di The Dude (pada MikroTik RouterOS v7) agar bisa mengirimkan notifikasi langsung ke hp kita melalui Chat WhatsApp (menggunakan CallMeBot API), Chat Telegram, dan Aplikasi Push Notification Gotify setiap kali service down/up atau saat terjadi masalah di jaringan.

Persiapan dan Konsep Dasar

  • MikroTik RouterOS v7 dengan package dude sudah teinstall dan di-enable.
  • Router terkoneksi internet karena kita akan memanggil API Call (CallMeBot, Telegram, Gotify).
  • Data API dari masing-masing platform:
    • Telegram: Bot Token (dari BotFather) Chat ID dan Message Thread ID (karena notif saya buat masuk ke Topik/Thread, buat dulu jika belum).
    • WhatsApp (CallMeBot): Nomor telepon dan API Key.
    • Gotify: URL Server Gotify Anda dan App Token.

Walaupun nanti URL/API berbeda, pola konfigurasi di The Dude hampir sama.

Notifikasi via Gotify (Self-Hosted Push Notification)

  1. Melalui Winbox -> menu Dude -> Notifications.
    • Klik [+] (Add New)
    • Name: misalnya Notify-Gotify
    • Type: pilih Execute on server.
    • Copy-paste script dibawah ini ke dalam kotak Text:
# ==========================================
# 1. SESUAIKAN PARAMETER 
# ==========================================
# Ganti dengan IP/Domain server Gotify Anda (pastiin diakhiri dengan /message)
:local appUrl "https://<DOMAIN-IP>/message"

# Masukin App Token yang udah dibuat di App Gotify
:local appToken "APP-TOKEN"

# Konfigurasi Pesan
:local msgTitle "The Dude"
:local msgPriority 8

# Pake double backslash (\\n) untuk baris baru di JSON
:local msgBody "Device: [Device.Name]\\nIP: [Device.FirstAddress]\\nService: [Probe.Name]\\nStatus: [Service.Status]"

# ==========================================
# 2. TIDAK PERLU DIEDIT
# ==========================================
:local httpHeaders "X-Gotify-Key:$appToken,content-type:application/json"
:local payload "{\"title\": \"$msgTitle\", \"message\": \"$msgBody\", \"priority\": $msgPriority}"
/tool fetch http-method=post http-header-field=$httpHeaders url=$appUrl http-data=$payload keep-result=no

Klik Apply dan OK.

Notifikasi via Telegram Bot

  1. Melalui Winbox -> menu Dude -> Notifications.
    • Klik [+] (Add New)
    • Name: misalnya Notify-Telegram
    • Type: pilih Execute on server.
    • Copy-paste script dibawah ini ke dalam kotak Text:
# ==========================================
# 1. SESUAIKAN PARAMETER
# ==========================================
:local botToken "BOT-TOKEN"
:local chatId "CHAT-ID"
:local threadId "THREAD-ID"
:local msgText "\\uD83D\\uDEA8 The Dude Alert\\nDevice: [Device.Name]\\nIP: [Device.FirstAddress]\\nService: [Probe.Name]\\nStatus: [Service.Status]"

# ==========================================
# 2. TIDAK PERLU DIEDIT
# ==========================================
:local url ("https://api.telegram.org/bot" . $botToken . "/sendMessage")
:local payload "{\"chat_id\": \"$chatId\", \"message_thread_id\": $threadId, \"parse_mode\": \"HTML\", \"text\": \"$msgText\"}"

/tool fetch http-method=post http-header-field="content-type:application/json" url=$url http-data=$payload keep-result=no

Klik Apply dan OK.

Notifikasi via Whatsapp (CallMeBot)

  1. Melalui Winbox -> menu Dude -> Notifications.
    • Klik [+] (Add New)
    • Name: misalnya Notify-Whatsapp
    • Type: pilih Execute on server.
    • Copy-paste script dibawah ini ke dalam kotak Text:
# ==========================================
# 1. SESUAIKAN PARAMETER
# ==========================================
# Masukkan nomor WA (tanpa tanda +, cukup angkanya)
:local waPhone "62819xxxxxxxx"

# Masukkan API Key CallMeBot Anda
:local apiKey "API-KEY"

# PENTING: Jangan pake spasi biasa! ketik %20 untuk spasi dan %0A untuk baris baru.
:local msgText "The%20Dude%20Alert%0ADevice:%20[Device.Name]%0AIP:%20[Device.FirstAddress]%0AService:%20[Probe.Name]%0AStatus:%20[Service.Status]"

# ==========================================
# 2. TIDAK PERLU DIEDIT
# ==========================================
:local url ("https://api.callmebot.com/whatsapp.php?phone=" . $waPhone . "&text=" . $msgText . "&apikey=" . $apiKey)
/tool fetch url=$url keep-result=no

Catatan Penting!

Karena kita menggunakan metode GET via URL, script ini sangat rentan terhadap Error 400 Bad Request jika The Dude memasukkan teks berspasi ke dalam URL.

Perhatikan dua hal ini saat menggunakan CallMeBot:

  1. Nama Device Tidak Boleh Ada Spasi: Pastikan nama router atau switch Anda di device The Dude menggunakan tanda hubung atau underscore (contoh: Router-Core-JKT, BUKAN Router Core JKT) termasuk Probe Name nya juga. Jika ada spasi, URL akan putus di tengah jalan dan request gagal.
  2. Hindari [Service.ProblemDescription]: atau variable dude lainnya, karena (seperti “connect failed: Host is unreachable” atau “no route to host”) kadang outputnya mengandung spasi.

Menerapkan Notification ke Device/Service

Setelah tiga jenis notification dibuat (WhatsApp, Telegram, Gotify), langkah berikut:

Device Polling

  • Di menu Dude -> Devices -> pilih device yang ingin dimonitor.
  • Masuk ke tab Polling, centang Enabled -> centang Use Notifications -> pilih jenis notifikasi di opsi Notifications misal Notify-Whatsapp.

Service Level (Ping, HTTP, dll.)

  • Di menu Dude -> Services -> pilih service yang ingin dimonitor (misalnya Ping)
  • Di tab General -> centang Use Notifications -> pilih jenis notifikasi di opsi Notifications misal Notify-Whatsapp.

Kesimpulan

Dengan cara ini, Kita bisa terima notifikasi dari dude MikroTik ke WhatsApp, Telegram atau Gotify ketika ping time-out, ketika CPU load tinggi atau service tidak jalan. Kita bisa monitoring jaringan real‑time dan notifikasi langsung terkirim ke WhatsApp, Telegram, maupun aplikasi push (Gotify), jadi respon masalah jaringan bisa jauh lebih cepat.

Tags , ,
guest

0 Comments
Oldest
Newest Most Voted