How to monitor the signal strength

Hello everyone,

I am currently trying to monitor the signal strength of wireless devices on MikroTik in real time and output the records into a text file or table (CSV format). My approach is to use a script to periodically collect information from the wireless registry (including signal strength, TX/RX rate, etc.), and then append the data to the log file. But I found that when the log file size reaches about 4082B, the log record stops updating and no new data is appended.
The current question is: How to monitor the signal strength of wireless devices in real time and output the records stably into a text or table file?

The following is the script content:
:local fileName "wifi_signal_log.csv";
:local currentTime [/system clock get time];
:local currentDate [/system clock get date];
:local logEntry "";

:if ([:len [/file find name=$fileName]] > 0) do={
/file print file=$fileName;
/file set $fileName contents="Date,Time,MAC Address,Signal Strength (dBm),Uptime\r\n";
}

:local existingContent [/file get $fileName contents];

MAC TX RX

:foreach i in=[/interface wireless registration-table find] do={
:local MacAddress [/interface wireless registration-table get $i mac-address];
:local SignalStrength [/interface wireless registration-table get $i signal-strength];
:local Uptime [/interface wireless registration-table get $i uptime];

CSV

:set logEntry ($currentDate . "," . $currentTime . "," . $MacAddress . "," . $SignalStrength . "," . $Uptime . "\r\n");

:local existingContent [/file get $fileName contents];
/file set $fileName contents=($existingContent . $logEntry);
}

try using dude
dude-signal.png

Mikrotik has some pretty restrictive conditions on working with files. There is no way to “append” to a file, they suggest you read in the entire file, then add your new info. Unfortunately “file get” has a hard limit of 60kB , so you would have to use “file read” and get it in chunks. This is a bit tricky.

It is probably better to either use the Mikrotik tools like @panisk0 has pointed out, or grab the data from a server running a general purpose operating system that handles files better. This is fairly easily done remotely using the REST API. Even better use a system that sends the data into a time series DB for graphing. I haven’t looked lately, but things like Zabbix used to take care of this and are fairly easy to set up using Docker.