0% found this document useful (0 votes)
322 views1 page

Script Telegram

This document contains scripts to send login and logout notifications via Telegram for a PPPoE connection. The login script retrieves connection information like IP address, uptime, service, and sends it to a Telegram chat. The logout script sends disconnection details like last disconnect reason, last logout time, and last caller ID to the same chat. Both scripts retrieve user and connection data from MikroTik and send notifications using a Telegram bot API.

Uploaded by

afandi danutirta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
322 views1 page

Script Telegram

This document contains scripts to send login and logout notifications via Telegram for a PPPoE connection. The login script retrieves connection information like IP address, uptime, service, and sends it to a Telegram chat. The logout script sends disconnection details like last disconnect reason, last logout time, and last caller ID to the same chat. Both scripts retrieve user and connection data from MikroTik and send notifications using a Telegram bot API.

Uploaded by

afandi danutirta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Script UP

:local nama "$user";


:local bot "6046882232:AAEeCrHtcbhURKAEMj1WcOr7rgftXcF45o8";
:local chat "1424039583";
: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 bot "6046882232:AAEeCrHtcbhURKAEMj1WcOr7rgftXcF45o8";


:local chat "1424039583";
: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];
:local active [/ppp active print count];
/tool fetch url="https://api.telegram.org/bot$bot/sendmessage\?chat_id=$chat&text=\
E2\9D\8CPPPOE-LOGOUT %0A$datetime%0AUSER: $user%0ALast Disconnect Reason: $lastdisc
%0ALast Logout: $lastlogout %0ALast Caller ID: $lastcall" keep-result=no;

You might also like