WiFi generally works well, but sometimes it does not and I’d like to know why: Is the signal weak? Is the noise floor increasing? To measure that, get the data and collect and make nice graphs out of it!
Gather data

You need a method to get raw data out of your wireless device (Mikrotik SXT Lite5). In my case:
- Create an account on the SXT to log in (via ssh key, see here)
- A script to gather the data (I use telegraf with the InfluxDB line protocol). The REST API of RouterOS 6.x is unfortunately not yet usable.
#!/bin/bash
set -euo pipefail
# gather_one(router,interface)
function gather_one {
ssh -i ~/.ssh/id_sxt17 telegraf@$1 "/interface wireless monitor $2 once" | tr -d '\r' >/tmp/f1
radio_name=$(awk '/^ *radio-name:/{print $2}' /tmp/f1)
if [[ -z "$radio_name" ]] ; then
radio_name=$2
fi
tx=$(awk '/^ *tx-ccq:/{print $2/100}' /tmp/f1)
rx=$(awk '/^ *rx-ccq:/{print $2/100}' /tmp/f1)
tx_overall=$(awk '/^ *overall-tx-ccq:/{print $2/100}' /tmp/f1)
nf=$(awk '/^ *noise-floor:/{print $2/1}' /tmp/f1)
sn=$(awk '/^ *signal-to-noise:/{print $2/1}' /tmp/f1)
if [[ ! -z "$rx" ]] ; then echo "signal,host=$1,radio=$radio_name rx=$rx" ; fi
if [[ ! -z "$tx" ]] ; then
echo "signal,host=$1,radio=$radio_name tx=$tx"
else
echo "signal,host=$1,radio=$radio_name tx_overall=$tx_overall"
fi
if [[ ! -z "$sn" ]] ; then echo "signal,host=$1,radio=$radio_name sn=$sn" ; fi
if [[ ! -z "$nf" ]] ; then echo "signal,host=$1,radio=$radio_name nf=$nf" ; fi
}
gather_one sxt17.lan wlan1-gateway
gather_one router.lan wlan1
gather_one router.lan wlan2
- telegraf.conf needs to run the above script and feed the data into InfluxDB:
[[inputs.exec]]
commands = ["/home/harald/bin/wlan-influxdb.sh"]
timeout = "10s"
data_format = "influx"
Display Data
Create a new panel in Grafana:

And here the resulting graphs:

Note that the various hardware variations don’t always show the same raw data about the wireless interfaces. E.g. my router does not show the signal strength, only the noise floor.