Logging Average CCQ and Wireless Clients Stats
Jump to navigation
Jump to search
This simple little script logs the specified wireless interface's overall ccq, noise floor, and frequencies. Very useful if you set this up on a scheduler, say each minute and syslog it to a remote server for parsing/graphing etc. Also handy for remembering what your frequency was set at previously
/int wir monitor [find name=wlan1] once do { :env; :log info ([/system identity get name] . "," . $clients . "," . $overall-tx-ccq . "," . $noise-floor . "," . $frequency . "," . $current-tx-powers); }
Sample output
Feb 8 11:53:40 64.114.36.194 script,info AP.Antar,32,62,-92,2412,1Mbps:18,2Mbps:18,5.5Mbps:18,11Mbps:18
This second script parses mac, last ip address, tx rates, uptime, last activity, snr etc... of each connected wireless client. Just be sure to change the interface= to your interface name. I usually set this one up on a 5 minute schedule. Good for matching IP/Mac Pairs
:foreach i in=[ /int wir reg find interface=wlan1] do={ :log info ([/system identity get name] . "," . [get $i mac-address ] . "," . [get $i last-ip] . "," . [get $i rx-rate] . "," . [get $i tx-rate] . "," . [get $i uptime] . "," . [get $i last-activity] . "," . [get $i signal-strength] . "," . [get $i signal- to-noise] . "," . [get $i tx-ccq] . "," . [get $i bytes] . "," . [get $i packets]) }
Sample Output
Feb 8 11:54:09 64.114.107.251 script,info AP.Grizz,00:02:6F:34:2E:1C,64.114.107.149,11Mbps,11Mbps,3w4d15:50:58,00:00:00.010,- 56dBm@11Mbps,36,100,3485064358,828420047,3532238,2666063
Check all the client ( all wireless interface) with this
:foreach i in=[ /int wir reg find ap=no] do={ :log info ("Mikrotik " . [/system identity get name] . " AP: " . [int wir reg get $i interface] . " MAC: " . [int wir reg get $i mac-address ] . " Last IP: " . [int wir reg get $i last-ip] . " RX: " . [int wir reg get $i rx-rate] . " TX: " . [int wir reg get $i tx-rate] . " Uptime: " . [int wir reg get $i uptime] . " LastACT: " . [int wir reg get $i last-activity] . " SignalStrength: " . [int wir reg get $i signal-strength] . " SNR: " . [int wir reg get $i signal-to-noise] . " TX/RX-CCQ: " . [int wir reg get $i tx-ccq] . " / " . [int wir reg get $i rx-ccq] . " PThroughput: " . [int wir reg get $i p-throughput] ) }
/system scheduler add disabled=no interval=6h name=log_reg_table on-event=log_client start-time=startup /system script add name=log_client policy=ftp,reboot,read,write,policy,test,winbox,password,sniff source=":foreach i in=[ /int wir reg find ap=no] do={\r\ \n:log info (\"Mikrotik \" . [/system identity get name] . \" AP: \" . [int wir reg get \$i interface] . \" MAC: \" . [int wir reg get \$i mac-address ] . \" Last IP:\ \" . [int wir reg get \$i last-ip] . \" RX: \" . [int wir reg get \$i rx-rate] . \" TX: \" . [int wir reg get \$i tx-rate] . \" Uptime: \" . [int wir reg get \$i upti\ me] . \" LastACT: \" . [int wir reg get \$i last-activity] . \" SignalStrength: \" . [int wir reg get \$i signal-strength] . \" SNR: \" . [int wir reg get \$i signal-t\ o-noise] . \" TX/RX-CCQ: \" . [int wir reg get \$i tx-ccq] . \" / \" . [int wir reg get \$i rx-ccq] . \" PThroughput: \" . [int wir reg get \$i p-throughput] )\r\ \n}"