Pada tutorial kali ini akan membahas bagaimana caranya untuk Memonitoring dengan menggunakan telegram user hotspot ketika login dan logout menggunakan script. Mikrotik OS yang saya gunakan yaitu versi V6.43.7. Script ini di masukkan pada /ip hotspot user profile dan pilih lah user-profile yang akan di tambahkan script untuk di monitoring. Kita juga bisa memanagement user hotspot dengan menggunakan bantuan Bot Telegram, seperti membuat user hotspot, enable dan disable user hotspot, menghapus user hotspot, mengganti user profile, dan menampilkan informasi secara detail user hotspot yang sedang aktif simak tutorialnya dengan judul : Membuat dan Mengatur User Hotspot Mikrotik dengan Bot Telegram Tanpa PHP

Agar monitoring ini bekerja dengan baik, anda diharuskan mempunyai bot telegram. Cara membuat bot telegram anda bisa baca tutorial sebelumnya yang berjudul : Mikrotik Netwach – Monitoring Status Access Point Hotspot Dengan Menggunakan Telegram

Script ketika Login

/tool fetch url="https://api.telegram.org/bot(token anda)/sendMessage?chat_id=(chat id anda)&text=Login $user $address" keep-result=no

Script ketika Logout

/tool fetch url="https://api.telegram.org/bot(token anda)/sendMessage?chat_id=(chat id anda)&text=Logout $user $address" keep-result=no

Hasilnya

Untuk dapat menampilkan secara lengkap informasi dari pengguna hotspot dapat memakai skrip berikut ini:

 

Share to Unlock Contentimage/svg+xml

Silahkan share untuk membuka link download dan membuka scriptnya

Apabila tutorial ini bermanfaat support saya dengan cara share artikel ini.. Terimakasih 

Sekian tutorial Monitoring Telegram User Hotspot Ketika Login dan Logout Menggunakan Script, apabila ada kesalahan atau kekeliruan silahkan tinggalkan di komentar dibawah ini. Baca juga : Membuat Halaman Pemberitahuan Ketika Internet Mati Untuk Pelanggan Hotspot

Anda boleh menyebarluaskan artikel ini dengan syarat mencantumkan link sumbernya

105 COMMENTS

  1. :local nama “$user”;
    :local ips [/ip hotspot active get [find user=”$nama”] address];
    :local mac [/ip hotspot active get [find user=”$nama”] mac-address];
    :local host [/ip dhcp-server lease get [find address=”$ips”] host-name];
    :local lby [/ip hotspot active get [find user=”$nama”] login-by];
    :local limit [/ip hotspot active get [find user=”$nama”] limit-bytes-total];
    :local useraktif [/ip hotspot active print count-only];
    :local totq [(($limit)/1048576)];
    /tool fetch “https://api.telegram.org/botXXXXXXXXX/sendMessage?chat_id=XXXXXXX&text=Login :%0A$nama%0A$ips %0A$mac%0A$host%0Alogin-by : $lby%0Akuota : $totq Mb%0ATerhubung : $useraktif user” mode=http keep-result=no;

    cara di atas sudah berhasil tapi sy ingin menampilkan /system scheduler next-run namun belum berhasil,
    :local exp [/system scheduler get [find name=”$nama”] next-run];
    bagaimana untuk bisa berhasil ??

      • untuk mengetahui expired user hotspot, nb : sudah berhasil ^^

        {
        :local nama “$user”;
        :local ips [/ip hotspot active get [find user=”$nama”] address];
        :local mac [/ip hotspot active get [find user=”$nama”] mac-address];
        :local host [/ip dhcp-server lease get [find address=”$ips”] host-name];
        :local lby [/ip hotspot active get [find user=”$nama”] login-by];
        :local limit [/ip hotspot active get [find user=”$nama”] limit-bytes-total];
        :local totq [(($limit)/1048576)];
        :local exp [/system scheduler get [find name=”$nama”] next-run];
        :local useraktif [/ip hotspot active print count-only];
        /tool fetch “https://api.telegram.org/bot694917272:AAEKlDIkU1GP0TlbvHqr-yj4YHYsGYdaArU/sendMessage?chat_id=-388372085&text=Login :%0A$nama%0A$ips %0A$mac%0A$host%0Alogin-by : $lby%0Akuota : $totq Mb%0AExpired : $exp%0ATerhubung : $useraktif user” mode=http keep-result=no;
        }

  2. mac mac address nya kok gak mau muncul yak gan ? itu ss di telegram juga gan muncul padahal di script nya ada variabel mac nya

  3. itu di tarok dimana ya bagian

    {
    :local nama “$user”;
    :local ips [/ip hotspot active get [find user=”$nama”] address];
    :local mac [/ip hotspot active get [find user=”$nama”] mac-address];
    :local host [/ip dhcp-server lease get [find address=”$ips”] host-name];
    :local lby [/ip hotspot active get [find user=”$nama”] login-by];
    :local limit [/ip hotspot active get [find user=”$nama”] limit-bytes-total];
    :local totq [(($limit)/1048576)];
    :local exp [/system scheduler get [find name=”$nama”] next-run];
    :local useraktif [/ip hotspot active print count-only];
    /tool fetch “https://api.telegram.org/botXXXXXXXXXXXXXXXXXXXXXXXXXXX/sendMessage?chat_id=XXXXXXXX&text=Login :%0A$nama%0A$ips %0A$mac%0A$host%0Alogin-by : $lby%0Akuota : $totq Mb%0AExpired : $exp%0ATerhubung : $useraktif user” mode=http keep-result=no;
    }

    ga tampil notif nya
    di manuall oke masuk?

    di tarok dmn bang?

  4. kenapa ini kok ngga bisa dapat notif ya pak ?
    {
    :local nama “$user”;
    :local ips [/ip hotspot active get [find user=”$nama”] address];
    :local mac [/ip hotspot active get [find user=”$nama”] mac-address];
    :local host [/ip dhcp-server lease get [find address=”$ips”] host-name];
    :local lby [/ip hotspot active get [find user=”$nama”] login-by];
    :local limit [/ip hotspot active get [find user=”$nama”] limit-bytes-total];
    :local totq [(($limit)/1048576)];
    :local useraktif [/ip hotspot active print count-only];
    /tool fetch “https://api.telegram.org/bot858815791:AAF0LEeMEGXMIESqrnXAqVIUkw3LzVXXXXX/sendMessage?chat_id=3596XXXXX&text=Login :%0A$nama%0A$ips %0A$mac%0A$host%0Alogin-by : $lby%0Akuota : $totq Mb%0ATerhubung : $useraktif user” mode=http keep-result=no;
    }

    tapi kalo yang ini bisa dapat notif.
    /tool fetch url=”https://api.telegram.org/bot858815791:AAF0LEeMEGXMIESqrnXAqVIUkw3LzVXXXXX/sendMessage?chat_id=35969XXXXX&text=User $user Telah Keluar dengan IP $address $mac” keep-result=no

      • masih tetap tidak bisa pak.

        {
        :local nama “$user”;
        :local ips [/ip hotspot active get [find user=”$nama”] address];
        :local mac [/ip hotspot active get [find user=”$nama”] mac-address];
        :local host [/ip dhcp-server lease get [find address=”$ips”] host-name];
        :local lby [/ip hotspot active get [find user=”$nama”] login-by];
        :local limit [/ip hotspot active get [find user=”$nama”] limit-bytes-total];
        :local totq [(($limit)/1048576)];
        :local useraktif [/ip hotspot active print count-only];
        /tool fetch “https://api.telegram.org/bot858815791:AAF0LEeMEGXMIESqrnXAqVIUkwXXXXX/sendMessage?chat_id=359XXXXX&text=Login :%0A$nama%0A$ips %0A$mac%0A$host%0Alogin-by : $lby%0Akuota : $totq Mb%0ATerhubung : $useraktif user” mode=http keep-result=no;
        }

        • {
          :local nama “$user”;
          :local ips [/ip hotspot active get [find user=”$nama”] address];
          :local mac [/ip hotspot active get [find user=”$nama”] mac-address];
          :local host [/ip dhcp-server lease get [find address=”$ips”] host-name];
          :local lby [/ip hotspot active get [find user=”$nama”] login-by];
          :local limit [/ip hotspot active get [find user=”$nama”] limit-bytes-total];
          :local totq [(($limit)/1048576)];
          :local useraktif [/ip hotspot active print count-only];
          /tool fetch url= “https://api.telegram.org/bot552750641:AAGlWdQJkfAIOZzbyGXlbst6_NJXk-XXX/sendMessage?chat_id=39641XXX&text=Login :%0A$nama%0A$ips %0A$mac%0A$host%0Alogin-by : $lby%0Akuota : $totq Mb%0ATerhubung : $useraktif user” mode=http keep-result=no;
          }

          • kok masih ga bisa ya pak ?
            padahal sudah sama persis, apa yang salah ya >?
            {
            :local nama “$user”;
            :local ips [/ip hotspot active get [find user=”$nama”] address];
            :local mac [/ip hotspot active get [find user=”$nama”] mac-address];
            :local host [/ip dhcp-server lease get [find address=”$ips”] host-name];
            :local lby [/ip hotspot active get [find user=”$nama”] login-by];
            :local limit [/ip hotspot active get [find user=”$nama”] limit-bytes-total];
            :local totq [(($limit)/1048576)];
            :local useraktif [/ip hotspot active print count-only];
            /tool fetch url= “https://api.telegram.org/bot858815791:AAF0LEeMEGXMIESqrnXAqXXXXXX/sendMessage?chat_id=3596XXXXX&text=Login :%0A$nama%0A$ips %0A$mac%0A$host%0Alogin-by : $lby%0Akuota : $totq Mb%0ATerhubung : $useraktif user” mode=http keep-result=no;
            }

          • alhamdullillah bisa pak, ternyata ada tanda ” yang berbeda, setelah saya nonton video bapak, saya coba ternyata berhasil.. terimakasih pak.

            dan untuk menampilkan waktu saat user login bagaimana ya pak ?

          • menampilkan tanggal dan waktu bisa tambahkan baris ini

            :local datetime “$[/system clock get date] $[/system clock get time]”

            lalu variabel datetime ditambahkan di baris “&text=”

          • pak agar waktu user logout agar tampil pada pesan status logoutnya itu by request, eror atau apapun itu bagaimana ya pak ?

          • maksudnya menampilkan waktu/jam ke bot ketika user logout atau menampilkan informasi waktu ketika user logout di halaman logout.html ya?
            kalau di bot tinggal tambahkan saja

            :local datetime “$[/system clock get date] $[/system clock get time]”

          • maksudnya seperti user login pak ada laporan user login by apa, nah saya juga mau menampilkan hal serupa pada waktu user logout, logout by reques, logout karna eror, atau logout karna apa, agar bisa kontrol user waktu keluar masuk, itu bagaimana ya pak ?

      • This is my Mikhmon Hotsopt profile script pls help me to correct this so that I can get messsage to Telegram

        :put (“,remc,90,15d,100,,Enable,”); {:local date [ /system clock get date ];:local year [ :pick $date 7 11 ];:local month [ :pick $date 0 3 ];:local comment [ /ip hotspot user get [/ip hotspot user find where name=”$user”] comment]; :local ucode [:pic $comment 0 2]; :if ($ucode = “vc” or $ucode = “up” or $comment = “”) do={ /sys sch add name=”$user” disable=no start-date=$date interval=”15d”; :delay 2s; :local exp [ /sys sch get [ /sys sch find where name=”$user” ] next-run]; :local getxp [len $exp]; :if ($getxp = 15) do={ :local d [:pic $exp 0 6]; :local t [:pic $exp 7 16]; :local s (“/”); :local exp (“$d$s$year $t”); /ip hotspot user set comment=$exp [find where name=”$user”];}; :if ($getxp = 8) do={ /ip hotspot user set comment=”$date $exp” [find where name=”$user”];}; :if ($getxp > 15) do={ /ip hotspot user set comment=$exp [find where name=”$user”];}; /sys sch remove [find where name=”$user”]; :local mac $”mac-address”; :local time [/system clock get time ]; /system script add name=”$date-|-$time-|-$user-|-90-|-$address-|-$mac-|-15d-|-15Days-|-$comment” owner=”$month$year” source=$date comment=mikhmon; [:local mac $”mac-address”; /ip hotspot user set mac-address=$mac [find where name=$user]]}}

        {
        :local nama “$user”;
        :local ips [/ip hotspot active get [find user=”$nama”] address];
        :local mac [/ip hotspot active get [find user=”$nama”] mac-address];
        :local host [/ip dhcp-server lease get [find address=”$ips”] host-name];
        :local lby [/ip hotspot active get [find user=”$nama”] login-by];
        :local limit [/ip hotspot active get [find user=”$nama”] limit-bytes-total];
        :local totq [(($limit)/1048576)];
        :local useraktif [/ip hotspot active print count-only];
        :local exp [/ip hotspot active get [find user=”$nama”] comment];
        /tool fetch url=”https://api.telegram.org/botBOT/sendMessage?chat_id=CHAT_ID&text=Login :%0A$nama%0A$ips %0A$mac%0A$host%0Alogin-by : $lby%0Akuota : $totq Mb%0ATerhubung : $useraktif user %0AExpire: $exp” mode=http keep-result=no;
        }

  5. sudah ada comment dak waktu

    {
    :local nama “$user”;
    :local ips [/ip hotspot active get [find user=”$nama”] address];
    :local mac [/ip hotspot active get [find user=”$nama”] mac-address];
    :local host [/ip dhcp-server lease get [find address=”$ips”] host-name];
    :local exp [/ip hotspot active get [find user=”$nama”] comment];
    :local lby [/ip hotspot active get [find user=”$nama”] login-by];
    :local limit [/ip hotspot active get [find user=”$nama”] limit-bytes-total];
    :local datetime “$[/system clock get date] $[/system clock get time]”
    :local totq [(($limit)/1048576)];
    :local useraktif [/ip hotspot active print count-only];
    /tool fetch url=”https://api.telegram.org/botxxx/sendMessage?chat_id=-xxxx&text=Logout :%0A$nama%0A$ips %0A$mac%0A$host%0A$exp%0Alogin-by : $lby%0Akuota : $totq Mb %0Awaktu : $datetime %0ATerhubung : $useraktif user” mode=http keep-result=no;
    }

  6. sudah berhasil

    infovoucher_bot, [31.10.19 23:35]
    Login :
    RYNNNNAK
    10.10.20.63
    74:23:44:F5:B6:47
    MIMAX-MiPhone
    vc-747-10.28.19-
    login-by : http-chap
    kuota : 5120 Mb
    waktu : oct/31/2019 23:35:19
    Terhubung : 371 user

  7. Punya saya masih gak mau keluar pak,, Padahal udah sama persis
    {
    :local nama “$user”;
    :local ips [/ip hotspot active get [find user=”$nama”] address];
    :local mac [/ip hotspot active get [find user=”$nama”] mac-address];
    :local host [/ip dhcp-server lease get [find address=”$ips”] host-name];
    :local lby [/ip hotspot active get [find user=”$nama”] login-by];
    :local limit [/ip hotspot active get [find user=”$nama”] limit-bytes-total];
    :local datetime “$[/system clock get date] $[/system clock get time]”
    :local totq [(($limit)/1048576)];
    :local useraktif [/ip hotspot active print count-only];
    /tool fetch url=”https://api.telegram.org/bot(token)/sendMessage?chat_id=-2290xxx&text=Masuk %0ANama : $nama%0AIP : $ips%0AMac : $mac%0A$host%0Alogin-by : $lby%0Akuota : $totq Mb %0Awaktu : $datetime %0ATerhubung : $useraktif user” mode=http keep-result=no;
    }

    • kalau login logout yg sederhana sudah bisa jalan?
      script ini ga jalan biasanya ada variabel yg ga ada nilainya misalnya nama hostname ga ada di dhcp lease atau device tersebut baru pertama kali terhubung

    • to complete this

      /tool fetch url=”https://api.telegram.org/bot1027397300:AAHbmnmd_rdrfDk9c_WdE2NWyKBtzYyjy1U/sendMessage?chat_id=1027898172&text=Voucher Code: $user%0AIP: $address %0AMAC: $”mac-address”%0AConnected : $useractive” keep-result=no

      Connected: no display

    • Bang, saya pakai router Os 6.46.5 + mikhmon.

      untuk script yang dimulai dari /tool fetch url bisa jalan kalau diletakkan di luar kurung, kekurangannya parameternya ga bisa ditunjukkan lleh si bot.

      misal user active ga nampil jumlahnya.

      Mohon bantuannya.

  8. Mas Yayan untuk nambah script Income Report Gimana yaa..?? biar laporannya gak nanggung.. misal tampil seperti ini.

    LOGIN : S3KC3ZY
    – IP Address : 10.12.0.4
    – Mac Address : 18:F0:E4:62:AB:E4
    – Device : android-3c3c751d86705ee5
    – Login-by : mac-cookie
    – Masuk : jun/26/2020 15:10:16
    – Expired : jun/27/2020 06:53:44
    – User Profiles : Umini-2000
    – Users Online : 7 user
    INCOME :
    Hari ini 9vcr : Rp 14.000
    Bulan ini 461vcr : Rp 948.000

    udah puyeng ngoprek gak kepanggil juga… para master yang bisa mohon pencerahan..

  9. kang punya saya dah di tambah script mikhmon tapi gak ada notip login,kalo logout ada,apakah ada yang salah ?

    :put (“,ntfc,0,30d,0,,Enable,”);
    {
    :local date [ /system clock get date ];
    :local year [ :pick $date 7 11 ];
    :local month [ :pick $date 0 3 ];
    :local comment [ /ip hotspot user get [/ip hotspot user find where name=”$user”] comment];
    :local ucode [:pic $comment 0 2];
    :if ($ucode = “vc” or $ucode = “up” or $comment = “”) do={ /sys sch add name=”$user” disable=no start-date=$date interval=”30d”;
    :delay 2s;
    :local exp [ /sys sch get [ /sys sch find where name=”$user” ] next-run];
    :local getxp [len $exp];
    :if ($getxp = 15) do={ :local d [:pic $exp 0 6];
    :local t [:pic $exp 7 16];
    :local s (“/”);
    :local exp (“$d$s$year $t”);
    /ip hotspot user set comment=$exp [find where name=”$user”];
    };
    :if ($getxp = 8) do={ /ip hotspot user set comment=”$date $exp” [find where name=”$user”];
    };
    :if ($getxp > 15) do={ /ip hotspot user set comment=$exp [find where name=”$user”];
    };
    /sys sch remove [find where name=”$user”];
    :local mac $”mac-address”;
    :local time [/system clock get time ];
    /system script add name=”$date-|-$time-|-$user-|-0-|-$address-|-$mac-|-30d-|-1-Bulan-|-$comment” owner=”$month$year” source=$date
    comment=mikhmon; [:local mac $”mac-address”; /ip hotspot user set mac-address=$mac [find where name=$user]]}

    :local ips [/ip hotspot active get [find user=”$user”] address];

    :local profile [/ip hotspot user get [find name=”$user”] profile];
    :local datetime “$[/system clock get date] $[/system clock get time]”;
    :local mac [/ip hotspot active get [find user=”$user”] mac-address];
    :local host [/ip dhcp-server lease get [find address=”$ips”] host-name];
    :local lby [/ip hotspot active get [find user=”$user”] login-by];
    :local limit [/ip hotspot active get [find user=”$user”] limit-bytes-total];
    :local totq [(($limit)/1048576)];
    :local useraktif [/ip hotspot active print count-only];
    /tool fetch url=”https://api.telegram.org/bot1200935181:AAHXa5Xq9ZsFShNIrCPjZpGMX4CA66Y4KHo/sendMessage?chat_id=788672882&text=====>> LOG-IN : $user%0A- IP Address : $ips %0A- Mac Address : $mac%0A- Menggunakan : $host%0A- Login-by : $lby%0A- Kuota : $totq Mb%0A- Expired : $exp%0A- Masuk : $datetime%0A- User Profiles : $profile%0A- Users Yang Online : $useraktif user” mode=http keep-result=no;
    }

  10. bang kalau script laporan jumlah user aktif dah sampai jumlah tertentu?? misalnya.. kita akan terima laporan jika user aktif mencapai sebanyak 40 orang (sesuai setingan)..

  11. Saya menggunakan Usermanager sebagai manager user hotspot saya. Menggunakan script lengkap diatas akan menampilkan data kosong pada Telegram. Simple setting sudah berhasil.Bila menggunakan string standar on-login dan on-logout sesuai https://wiki.mikrotik.com/wiki/Manual:IP/Hotspot/User maka akan tampil datanya. Namun tidak jika menggunakan script lengkap seperti diatas.
    Mohon petunjuknya.

  12. om, kalo untuk beberapa beberapa mikrotik gimana ya? misal beda kota 😀 😀 😀
    apa harus bikin bot sendiri2 di tiap device?
    trus manggilnya kl dijadiin 1 grup gimana??

    terimakasih

  13. Bang saya udah jalankan script nya tuh, untuk script logoutnya udah bisa, Pas Login tidak bisa muncul di telegram kalau login dengan 1 user saja , misal guru.xxx, guru.xxx, gimana bang solusinya?

  14. This is my Mikhmon Hotspot Profile script but did not get message to Telegram. Pls help me

    :put (“,remc,90,15d,100,,Enable,”); {:local date [ /system clock get date ];:local year [ :pick $date 7 11 ];:local month [ :pick $date 0 3 ];:local comment [ /ip hotspot user get [/ip hotspot user find where name=”$user”] comment]; :local ucode [:pic $comment 0 2]; :if ($ucode = “vc” or $ucode = “up” or $comment = “”) do={ /sys sch add name=”$user” disable=no start-date=$date interval=”15d”; :delay 2s; :local exp [ /sys sch get [ /sys sch find where name=”$user” ] next-run]; :local getxp [len $exp]; :if ($getxp = 15) do={ :local d [:pic $exp 0 6]; :local t [:pic $exp 7 16]; :local s (“/”); :local exp (“$d$s$year $t”); /ip hotspot user set comment=$exp [find where name=”$user”];}; :if ($getxp = 8) do={ /ip hotspot user set comment=”$date $exp” [find where name=”$user”];}; :if ($getxp > 15) do={ /ip hotspot user set comment=$exp [find where name=”$user”];}; /sys sch remove [find where name=”$user”]; :local mac $”mac-address”; :local time [/system clock get time ]; /system script add name=”$date-|-$time-|-$user-|-90-|-$address-|-$mac-|-15d-|-15Days-|-$comment” owner=”$month$year” source=$date comment=mikhmon; [:local mac $”mac-address”; /ip hotspot user set mac-address=$mac [find where name=$user]]}}

    {
    :local nama “$user”;
    :local ips [/ip hotspot active get [find user=”$nama”] address];
    :local mac [/ip hotspot active get [find user=”$nama”] mac-address];
    :local host [/ip dhcp-server lease get [find address=”$ips”] host-name];
    :local lby [/ip hotspot active get [find user=”$nama”] login-by];
    :local limit [/ip hotspot active get [find user=”$nama”] limit-bytes-total];
    :local totq [(($limit)/1048576)];
    :local useraktif [/ip hotspot active print count-only];
    :local exp [/ip hotspot active get [find user=”$nama”] comment];
    /tool fetch url=”https://api.telegram.org/botBOT/sendMessage?chat_id=CHAT_ID&text=Login :%0A$nama%0A$ips %0A$mac%0A$host%0Alogin-by : $lby%0Akuota : $totq Mb%0ATerhubung : $useraktif user %0AExpire: $exp” mode=http keep-result=no;
    }

  15. Bang, Itukan ada Script buat nampilkan expired ke Bot Telegram (:local exp [/ip hotspot user get [find name=”$nama”] comment];).

    Pertanyaannya Bisa gak Script Ini dibuat agar bisa nampilin Jumlah User Online di halaman status dan logout kayak ditutorial abang. Kalau bisa tolong dong bang bikin tutorialnya ini solusi bagus buat yg gak pake mikhmon online loh.

  16. Klu di kantor saya pnya beberapa router? jadi saya ingin mengetahui si user login nya dari routerA atau dari routerB. jadi nnt identynya juga muncul. makasih kak

  17. permisi kak, mau tanya. ini setelah sukses ada notif login dan logout nya, tetapi untuk jumlah atau pengguna aktif nya kok selalu 1 pengguna ya kak?
    ini pakai vlan, nah vlan a dan vlan b juga begitu, apa ada solusinya kak?
    terima kasih

Leave a Reply to RyuCancel reply