-->

  • Mikrotik script with Telegram bot Notification

    Mikrotik script with Telegram bot Notification
    Mikrotik script with Telegram bot Notification - Hi every one, we are going to create notification using simple script with scheduler and sent it to telegram chat messaging. With this setup, we can monitor such as real time active pppoe, hotspot and etc.So, my goal is to check whether pppoe and hotspot which is currently running in several router and then sent message it to our telegram bot. For the simple step, make sure that :
    • Network time is active
    • Router can resolve DNS
    • Register telegram bot, make sure you have bot token and chat-id. For further reference you can check this link
    • Understand how to using RouterOS
    • This setup tested running good at v6.42.7 and v6.42.3
    Okay, if all requirements has been fullfiled, here the next step :

    Telegram Script

    Create single script, go to system>scripts>add
    set any name and copy paste this script. Notice that you must change :
    • XXXXXXXXXXXXXXXXXXXXX with Telegram Bot Token
    • YYYYYYYYYY with chat-id
    
    {
    :local sysid [/system identity get name]
    :local time [/system clock get time]
    :local date [/system clock get date]
    :local hsac [:len [/ip hotspot active find radius]]
    :local ppac [:len [/ppp active find service=pppoe]]
    /tool fetch url="https://api.telegram.org/XXXXXXXXXXXXXXXXXXXXX/sendMessage?chat_id=-YYYYYYYYYY&text=Router_Name= $sysid%0ADate= $date - Time= $time%0AHotspot_Active= $hsac Users%0AActive_PPPoE= $ppac Account" keep-result=no
    };
    
    Next, you can try to run the script, if this script giving you message to you telegram bot, then its mean your bot is working.

    Create Scheduler

    This scheduler will run script1 every time depend interval. You can adjust interval for script will be running  for example every 1 hours. So, every hours you can get message to your telegram bot chat regarding active  PPPoE and Hotspot. Go to system>scheduler>add
    Of course you can send anything to your Telegram bot,this tutorial only giving you option to monitoring Active user on PPPoE and Hotspot. Thank you.
  • 0 comments:

    Post a Comment

    GET A FREE QUOTE NOW

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

    Search This Blog

    Powered by Blogger.

    Download Modul Cisco sertifikasi CCENT ICND Part 1 100-105

    Dalam modul ini berisi sekitar 26 Lab CCENT. Awalnya modul yang berbentuk PDF ini hanya penulis jadikan sebuah dokumentasi belajar saja, ...

    ADDRESS

    4759, NY 10011 Abia Martin Drive, Huston

    EMAIL

    contact-support@mail.com
    another@mail.com

    TELEPHONE

    +201 478 9800
    +501 478 9800

    MOBILE

    0177 7536213 44,
    017 775362 13