-
Login Hari Ini
-
Logout Hari Ini
-
User Unik Hari Ini
-
Peak Active (Hari Ini)
Login / Logout Harian (30 Hari)
Distribusi Per Jam (Hari Ini)
Top Users (Login Terbanyak)
| # | Username | Total Login | Terakhir Login |
|---|---|---|---|
| Loading... | |||
Aktivitas Terakhir
| Waktu | User | Event | IP | Router |
|---|---|---|---|---|
| Loading... | ||||
Cara Pasang Script di MikroTik
Setiap kali user PPPoE login/logout, MikroTik akan mengirim data ke backend secara otomatis. Copy script berikut ke PPP → Profiles → Scripts.
Paste ke kolom On Up
:do {
:delay 500ms
:local active [/ppp active print count-only]
:local ip ""
:local mac ""
:local svc ""
:do { :set ip [/ppp active get [find name=$user] address] } on-error={}
:do { :set mac [/ppp active get [find name=$user] caller-id] } on-error={}
:do { :set svc [/ppp active get [find name=$user] service] } on-error={}
:if ($svc != "pppoe") do={ :return }
/tool fetch url="http://192.168.66.15:3000/api/pppoe/event" http-method=post http-data="event=login&username=$user&ip=$ip&mac=$mac&active_count=$active" check-certificate=no keep-result=no
} on-error={ /log warning ("pppoe on-up failed: " . $user) }
Paste ke kolom On Down
:do {
:local active [/ppp active print count-only]
/tool fetch url="http://192.168.66.15:3000/api/pppoe/event" http-method=post http-data="event=logout&username=$user&active_count=$active" check-certificate=no keep-result=no
} on-error={ /log warning ("pppoe on-down failed: " . $user) }
- Buka PPP → Profiles di WinBox/WebFig
- Pilih profile yang dipakai user (contoh:
default,PPPoE) - Buka tab Scripts
- Paste Profile ON UP ke kolom On Up
- Paste Profile ON DOWN ke kolom On Down
- Klik OK
- Test login/logout user PPPoE
Catatan Penting
- Pastikan MikroTik bisa ping ke VPS
- Jika pakai HTTPS, tambahkan
check-certificate=no - Cek interface dengan:
/ip address print - Test manual:
/ppp active print
Troubleshooting: Kalau event tidak masuk, cek log MikroTik dengan
/log print