Community discussions

MikroTik App
 
idugless
just joined
Topic Author
Posts: 3
Joined: Fri Dec 30, 2022 5:51 am

Log Signal Strength & GPS Coordinates

Fri Dec 30, 2022 5:56 am

I would like to just have a simple script logging WiFi signal strength & GPS coordinates.

I'm not sure where to start...I tried doing it with SNMP which works well for the GPS coordinates, but the signal strength is difficult because the OID keeps changing.

I'd like to be able to just log at a set interval, say every 5 seconds.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3297
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Log Signal Strength & GPS Coordinates

Mon Jan 02, 2023 4:40 pm

If you can see the value in command line on the router, you can make a script that runs every 5 seconds and sends data to a syslog server.

If you have many devices to monitor, syslog may be better in some case compare to SNMP
With SNMP, you need to tell SNMP server each IP/DNS to monitor.
For Syslog, its the device talking home that needs the Syslog server IP, that will be the same for all devices (same config)
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3423
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: Log Signal Strength & GPS Coordinates

Mon Jan 02, 2023 5:36 pm

I tried doing it with SNMP which works well for the GPS coordinates, but the signal strength is difficult because the OID keeps changing.
Are you trying to do this from a PC/Mac?
Or are running script on the Mikrotik itself?
...Either can work, but what/where/format you want to the resulting GPS+WiFi data determine the script you need.

When you say "OID keeps changing" what specifically are you trying to read on the Wi-Fi?
...OIDs don't change, just not all may not be useful ;).
 
idugless
just joined
Topic Author
Posts: 3
Joined: Fri Dec 30, 2022 5:51 am

Re: Log Signal Strength & GPS Coordinates

Mon Jan 02, 2023 10:05 pm

Thanks for the replies.

If you can see the value in command line on the router, you can make a script that runs every 5 seconds and sends data to a syslog server.
The values I want to read are:
interface wireless>registration-table>signal-strength
system>gps>longitude
system>gps>lattitude

I can easily get the OID for these...not sure how I can view the value in the command line though.

Are you trying to do this from a PC/Mac?
Or are running script on the Mikrotik itself?
I'd like to be able to run the script on the Mikrotik itself.

When you say "OID keeps changing" what specifically are you trying to read on the Wi-Fi?
Just trying the read the signal-strength from the registration table. I think the OID changes dependendant on what AP my Mikrotik is connected to.

Thanks heaps for the assistance!
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3297
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Log Signal Strength & GPS Coordinates

Mon Jan 02, 2023 10:51 pm

Here is part of my Syslog script that sends wireless registration table to a Syslog server found here: viewtopic.php?t=179960
{
/interface wireless registration-table
:foreach i in=[find] do={
	:log info message=".id=$i;ap=$([get $i ap]);interface=$([get $i interface]);mac-address=$([get $i mac-address]);signal-strength=$([get $i signal-strength]);tx-rate=$([get $i tx-rate]);uptime=$([get $i uptime]);script=wifi"
}
}
To test it out, copy past this to terminal
{
/interface wireless registration-table
:foreach i in=[find] do={
	:put ".id=$i;ap=$([get $i ap]);interface=$([get $i interface]);mac-address=$([get $i mac-address]);signal-strength=$([get $i signal-strength]);tx-rate=$([get $i tx-rate]);uptime=$([get $i uptime]);script=wifi"
}
}
I do not have gps, but should be simple to get data.
 
idugless
just joined
Topic Author
Posts: 3
Joined: Fri Dec 30, 2022 5:51 am

Re: Log Signal Strength & GPS Coordinates

Thu Jan 05, 2023 1:13 am

The suggested command works.

As for GPS, it's located in /system gps
I can run the monitor command and this shows me all the information. I can also print the OID's for longitude & lattitude...just not sure how I call these through the command line and therefore incorporate them into the script.

Who is online

Users browsing this forum: Bing [Bot] and 18 guests