In this article I described how all the aprs stations of my region are monitored on a dashaboard and how all the sysops are informed about downtimes of the Igate/digipeaters.
Here below, I’m going to describe another step for the local aprs situation awareness. Sometimes the sysops see stations transmitting a lot of unuseful beacons with excessive rate, both fixed or mobile ones. Wrong beacon intervals can congest the monitor frequency and increase packet collisions, so this issue is something we’re contiuously fighting woth. When one or more TX I-gates are part of the network, particular care must be taken for the smartphone apps like aprsdroid which sends a lot of beacon on the internet (APRS-IS) and then transmitted in RF by I-gates. More and more popular platform like MMDVM, PI-Star, DMR and C4FM contribute to the 144.800 congestion if they are not properly managed or filtered.
Most of the times, if the abnormal beacons are permanent, local sysops shall get in touch with these operators and explain why they’re doing spam and how to fix it, because they normally don’know very well how the APRS works and they don’t know how their packets are transmitted.
In order to identify as soon as possible these situations, I started to think to an automatic message system, based on telegram and similar to the vitality messages described in this article.
The requisites of the oftware are:
- Read logs of my aprx server
- Periodically check for spam stations in the log
- The spam rate shall be adjustable
- The check period shall be adjustable
- The notifications shall be sent by telegram
The solution was a simple python script based on telegram-send. The script is available on my github repository.
The script performs the following operations:
1) open aprx rf log file and takes the last ‘cycletime’ time interval;
2) for every stations heard, counts the number of beacons transmitted (excluding digipeated packets);
3) for every stations heard calculates the mean tx rate as: heard beacons / interval time;
4) if the rate is > ratelimit, the script sends telegram notification.
Note: the scripts calculates a mean beacon rate over the interval. Sometimes it can underestimates the rate, but I wanted to intercept only serious spam situations.
Installation and configuration
Dependencies: before using this script, intall and configure the library “telegram-send ( https://pypi.org/project/telegram-send/ ) and configure the destination of the notifications (single user, group or channel).
sudo pip3 install telegram-send
telegram-send –configure if you want to send to your account
telegram-send –configure-group to send to a group
telegram-send –configure-channel to send to a channel.
In the first part of the script, the following parameters shall be edited:
interface: radio interface (CALLSIGN) declared in aprx.conf
logfile: aprx rf log file (typically ‘/var/log/aprx/aprx-rf.log’)
telegram_conf_file: telegram_send config file (typically ‘/home/pi/.config/telegram-send.conf’)
cycletime: cycletime in seconds
ratelimit: max frames in a cycletime
The script should be executed every ‘cycletime’ by crontab. Here below, a typical crontab config for 10 minutes interval:
*/10 * * * * sudo /home/pi/Applications/aprs_spam_check/aprs_spam_check.py
Note: This script may have bugs and it’s written without all the best programming rules. But it works for me.
Here below, an example of spam notification is reported:
The script can be easily adapted to work with other logs, like direwolf or similar.
Any comment/suggestion will be appreciated.