类别:RouterOS / 日期:2020-11-17 / 浏览:108 / 评论:0
几年前玩加速器时搞的在线统计,同时统计网吧客户端在线、pptp l2tp oepnxx,留个笔记吧
/ip firewall mangle add chain=prerouting src-address-list=lan action=add-src-to-address-list address-list="Online" address-list-timeout=1m comment="\D4\DA\CF\DF\D3\C3\BB\A7" disabled=no
/ip firewall address-list add address=192.168.1.2-192.168.1.58 disabled=no list=lan
:local Date [/system clock get date];:local Year ([:pick $Date 7 11]-1); :local Month ([:find jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec [:pick $Date 0 3]]); :local Day [:pick $Date 4 6]; :if ([:pick $Date 4 5] = 0) do={:set Day [:pick $Date 5 6]}; :set Day ($Day-1) :local leapyear 0,31,59,90,120,151,181,212,243,273,304,334,0,31,60,91,121,152,182,213,244,274,305,335 :local Today ($Year*365+$Year/4);:if (($Year-$Year/4*4) != 3) do={:set Today ($Today+[:pick $leapyear $Month]+$Day)} else={:set Today ($Today+[:pick $leapyear ($Month+12)]+$Day)} :local Week ($Today-$Today/7*7) :local time [/system clock get time] :local version [/system resource get "version"] :local ma [/system resource get cpu-load] :local userpptp [:len [/ppp active find service =("pptp")]] :local userl2tp [:len [/ppp active find service =("l2tp")]] :local userovpn [:len [/ppp active find service =("ovpn")]] :local zxzj [:len [/ip firewall address-list find list=("Online")]] :local maciii /interface monitor-traffic WAN once do={:set maciii $"rx-bits-per-second"}; :local maciqian /interface monitor-traffic WAN once do={:set maciqian $"tx-bits-per-second"}; :local s [:len [/ip firewall connection find protocol =("tcp")]] :local ss [:len [/ip firewall connection find protocol =("udp")]] :log warning "=====================================" :log error ("今天是星期" . $Week) :log warning ("当前北京时间:"."$time") :log warning ("当前系统版本是:"."$version") :log warning ("当前CPU使用率:"."$ma"."%") :log warning ("当前有:"."$userpptp"."个PPTP在线用户") :log warning ("当前有:"."$userl2tp"."个L2TP在线用户") :log warning ("当前有:"."$userovpn"."个openvpn在线用户") :log error ("当前共有:"."$zxzj"."台电脑在线") :log warning ("当前网络总上行速度为:"."$maciii"/1000 ."KB") :log warning ("当前网络总下行速度为:"."$maciqian"/1000 ."KB") :log error ("当前TCP共有:"."$s"."条") :log error ("当前UDP共有:"."$ss"."条") :log warning "====================================="
版权声明 : 本文未使用任何知识共享协议授权,您可以任何形式自由转载或使用。
发表评论 / 取消回复