I want to create a script that monitors the status of the network (I do not know if there are any programs that already do what I want to do even better).
I'm only interested in monitoring the signal strength and the bitrate of a device connected to an access point, and I'm trying to create a .sh script to do that, for example for a minute, and to create an output file, for example, with this format:
TIME (s) SIGNAL STRENGTH (dBm) BITRATE (Mbit/s)
00 -53 54
05 -50 300
10 -55 54
15 -60 36
This data can be obtained from the command:
$ iw dev wlan1 station dump
Station 12:34:56:78:9a:bc (on wlan0)
inactive time: 304 ms
rx bytes: 18816
rx packets: 75
tx bytes: 5386
tx packets: 21
signal: -29 dBm
tx bitrate: 54.0 MBit/s
Or the command:
$ iw dev wlan0 link
Connected to 04:21:b0:e8:c8:8b (on wlan0)
SSID: attwifi
freq: 2437
RX: 2272 bytes (18 packets)
TX: 232 bytes (3 packets)
signal: -57 dBm
tx bitrate: 36.0 MBit/s
I do not know if I have explained this well, I want to get this data in any way and save it in a file (e.g. .txt). I want to periodically write the data I need (Tx bitrate and signal) to a file, therefore the file will get bigger over time.
The way to get the data I do not know what would be, I know this data appears in the commands that I put above.
I would like for the script to record the start time (or to ask for a name) without overwriting the old data.
Could anyone help me in creating a script to get what I want? And another thing, how could I create the timer? Or failing that, could someone tell me some tool to do something? Does someone know a tool to do what I want to do?