Mointoring pppoe dengan bot telegram: Difference between revisions
Jump to navigation
Jump to search
Created page with "thumb|241x241px|Tampilan up pada telegram thumb|239x239px|tampilan down pada telegram" |
No edit summary |
||
Line 1: | Line 1: | ||
[[File:Tampilan up.png|thumb|241x241px|Tampilan up pada telegram]] | [[File:Tampilan up.png|thumb|241x241px|Tampilan up pada telegram]] | ||
[[File:Tampilan down.png|thumb|239x239px|tampilan down pada telegram]] | [[File:Tampilan down.png|thumb|239x239px|tampilan down pada telegram]] | ||
== Monitoring PPPoE dengan Bot Telegram == | |||
Artikel ini menjelaskan cara mengirim notifikasi otomatis ke Telegram saat user PPPoE login atau logout dari MikroTik. Monitoring ini berguna untuk memantau status koneksi pelanggan secara real-time. | |||
=== Langkah Konfigurasi === | |||
==== 1. Tambahkan User PPPoE ==== | |||
Buat user PPPoE seperti biasa melalui menu '''PPP > Secrets'''. | |||
==== 2. Tambahkan Script pada PPPoE Profile ==== | |||
Masuk ke menu '''PPP > Profiles''' lalu pilih profile yang digunakan. Pada bagian '''Scripts''', tambahkan script berikut: | |||
'''Script UP''' | |||
<syntaxhighlight lang="routeros"> | |||
:local nama "$user"; | |||
:local bot "<id bot>:<token telegram>"; | |||
:local chat "<id chat atau grup>"; | |||
:local ips [/ppp active get [find name=$nama] address]; | |||
:local up [/ppp active get [find name=$nama] uptime]; | |||
:local caller [/ppp active get [find name=$nama] caller-id]; | |||
:local service [/ppp active get [find name=$nama] service]; | |||
:local active [/ppp active print count]; | |||
:local datetime "Tanggal: $[/system clock get date] %0AJam: $[/system clock get time]"; | |||
:local lastdisc [/ppp secret get [find name=$user] last-disconnect-reason]; | |||
:local lastlogout [/ppp secret get [find name=$user] last-logged-out]; | |||
:local lastcall [/ppp secret get [find name=$user] last-caller-id]; | |||
/tool fetch url="https://api.telegram.org/bot$bot/sendMessage?chat_id=$chat &text=\E2\9C\85 PPPoE LOGIN%0A$datetime%0AUser: $user%0AIP Client: $ips%0ACaller ID: $caller%0AUptime: $up%0ATotal Active: $active Client%0AService: $service%0ALast Disconnect Reason: $lastdisc %0ALast Logout: $lastlogout %0ALast Caller ID: $lastcall" mode=http keep-result=no; | |||
</syntaxhighlight> | |||
'''Script DOWN''' | |||
<syntaxhighlight lang="routeros"> | |||
:local nama "$user"; | |||
:local bot "<id bot>:<token telegram>"; | |||
:local chat "<id chat atau grup>"; | |||
:local service [/ppp secret get [find name=$nama] service]; | |||
:local local [/ppp secret get [find name=$nama] local]; | |||
:local remote [/ppp secret get [find name=$nama] remote]; | |||
:local profile [/ppp secret get [find name=$nama] profile]; | |||
:local last [/ppp secret get [find name=$nama] last-logged-out]; | |||
:local lastcall [/ppp secret get [find name=$nama] last-caller-id]; | |||
:local lastdic [/ppp secret get [find name=$nama] last-disconnect-reason]; | |||
/tool fetch url="https://api.telegram.org/bot$bot/sendMessage?chat_id=$chat&text=\E2\9D\8C LOGOUT%0AUser: $user%0AService: $service %0ALocal Address: $local%0ARemote Address: $remote%0AProfile: $profile%0ALast Logout: $last%0ALast Caller ID: $lastcall %0ALast Disconnect Reason: $lastdic" mode=http keep-result=no; | |||
</syntaxhighlight> | |||
=== Tips Tambahan === | |||
* Pastikan bot Telegram sudah aktif dan memiliki akses ke grup atau chat yang dituju. | |||
* Gunakan format URL yang benar dan hindari spasi yang tidak di-encode. | |||
* Uji script dengan user PPPoE dummy sebelum diterapkan ke pelanggan. | |||
=== Referensi === | |||
* [Dokumentasi Notion: BOT MONITORING PPOE](https://www.notion.so/BOT-MONITORING-PPOE-570aa37e50f44ccda7349e06dd239228) | |||
* [Halaman Wiki: Mointoring pppoe dengan bot telegram](https://wiki.rizqin.my.id/wiki/index.php/Mointoring_pppoe_dengan_bot_telegram) | |||
---- |
Latest revision as of 12:27, 5 August 2025


Monitoring PPPoE dengan Bot Telegram
Artikel ini menjelaskan cara mengirim notifikasi otomatis ke Telegram saat user PPPoE login atau logout dari MikroTik. Monitoring ini berguna untuk memantau status koneksi pelanggan secara real-time.
Langkah Konfigurasi
1. Tambahkan User PPPoE
Buat user PPPoE seperti biasa melalui menu PPP > Secrets.
2. Tambahkan Script pada PPPoE Profile
Masuk ke menu PPP > Profiles lalu pilih profile yang digunakan. Pada bagian Scripts, tambahkan script berikut:
Script UP
:local nama "$user";
:local bot "<id bot>:<token telegram>";
:local chat "<id chat atau grup>";
:local ips [/ppp active get [find name=$nama] address];
:local up [/ppp active get [find name=$nama] uptime];
:local caller [/ppp active get [find name=$nama] caller-id];
:local service [/ppp active get [find name=$nama] service];
:local active [/ppp active print count];
:local datetime "Tanggal: $[/system clock get date] %0AJam: $[/system clock get time]";
:local lastdisc [/ppp secret get [find name=$user] last-disconnect-reason];
:local lastlogout [/ppp secret get [find name=$user] last-logged-out];
:local lastcall [/ppp secret get [find name=$user] last-caller-id];
/tool fetch url="https://api.telegram.org/bot$bot/sendMessage?chat_id=$chat &text=\E2\9C\85 PPPoE LOGIN%0A$datetime%0AUser: $user%0AIP Client: $ips%0ACaller ID: $caller%0AUptime: $up%0ATotal Active: $active Client%0AService: $service%0ALast Disconnect Reason: $lastdisc %0ALast Logout: $lastlogout %0ALast Caller ID: $lastcall" mode=http keep-result=no;
Script DOWN
:local nama "$user";
:local bot "<id bot>:<token telegram>";
:local chat "<id chat atau grup>";
:local service [/ppp secret get [find name=$nama] service];
:local local [/ppp secret get [find name=$nama] local];
:local remote [/ppp secret get [find name=$nama] remote];
:local profile [/ppp secret get [find name=$nama] profile];
:local last [/ppp secret get [find name=$nama] last-logged-out];
:local lastcall [/ppp secret get [find name=$nama] last-caller-id];
:local lastdic [/ppp secret get [find name=$nama] last-disconnect-reason];
/tool fetch url="https://api.telegram.org/bot$bot/sendMessage?chat_id=$chat&text=\E2\9D\8C LOGOUT%0AUser: $user%0AService: $service %0ALocal Address: $local%0ARemote Address: $remote%0AProfile: $profile%0ALast Logout: $last%0ALast Caller ID: $lastcall %0ALast Disconnect Reason: $lastdic" mode=http keep-result=no;
Tips Tambahan
- Pastikan bot Telegram sudah aktif dan memiliki akses ke grup atau chat yang dituju.
- Gunakan format URL yang benar dan hindari spasi yang tidak di-encode.
- Uji script dengan user PPPoE dummy sebelum diterapkan ke pelanggan.
Referensi
- [Dokumentasi Notion: BOT MONITORING PPOE](https://www.notion.so/BOT-MONITORING-PPOE-570aa37e50f44ccda7349e06dd239228)
- [Halaman Wiki: Mointoring pppoe dengan bot telegram](https://wiki.rizqin.my.id/wiki/index.php/Mointoring_pppoe_dengan_bot_telegram)