retnet

dhcp server script to telegram

Jan 12th, 2026
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. :local botToken "123456:AAHR7faddfklksdjflskjsldfjlskjflkj"
  2. :local chatId "-12345698"
  3. :local routerName [/system identity get name]
  4. # Ambil comment dari daftar lease berdasarkan MAC Address
  5. :local leaseComment [/ip dhcp-server lease get [find where active-mac-address=$leaseActMAC] comment]
  6. # Jika comment kosong, beri nilai default agar tidak error
  7. :if ([:len $leaseComment] = 0) do={ :set leaseComment "Tidak+ada+Comment" }
  8. # Jika client TERPUTUS (unbound)
  9. :if ($leaseBound = "0") do={
  10. :local msg "%F0%9F%94%B4 *CLIENT TERPUTUS*%0A---------------------------%0AKet:+$leaseComment%0AIP: $leaseActIP%0AMAC: $leaseActMAC%0ARouter: RB3011 %E2%9A%A0"
  11. :local url ("https://api.telegram.org/bot" . $botToken . "/sendMessage?chat_id=" . $chatId . "&text=" . $msg)
  12. /tool fetch url=$url keep-result=no check-certificate=no
  13. }
  14.  
  15. # Opsional: Jika client TERHUBUNG (bound)
  16. :if ($leaseBound = "1") do={
  17. :local msg "%F0%9F%9F%A2 *CLIENT TERHUBUNG*%0A---------------------------%0AKet:+$leaseComment%0AIP: $leaseActIP%0AMAC: $leaseActMAC%0ARouter: RB3011 %E2%9A%A0"
  18. :local url ("https://api.telegram.org/bot" . $botToken . "/sendMessage?chat_id=" . $chatId . "&text=" . $msg)
  19. /tool fetch url=$url keep-result=no check-certificate=no
  20. }
Advertisement
Add Comment
Please, Sign In to add comment