noisyNodeLogging

telemetry logger idea
This commit is contained in:
SpudGunMan
2025-09-16 17:09:47 -07:00
parent 5703cfb381
commit 642738e3b6
5 changed files with 37 additions and 16 deletions
+9 -15
View File
@@ -16,6 +16,7 @@ Welcome to the Mesh Bot project! This feature-rich bot is designed to enhance yo
### Network Tools
- **Build, Test Local Mesh**: Ping allow for message delivery testing with more realistic packets vs. telemetry
- **Test Node Hardware**: `test` will send incremental sized data into the radio buffer for overall length of message testing
- **Network Monitoring**: Alert on noisy nodes, node locations, and best placment for relay nodes.
### Multi Radio/Node Support
- **Simultaneous Monitoring**: Monitor up to nine networks at the same time.
@@ -318,10 +319,9 @@ myRegionalKeysDE = 110000000000,120510000000
This uses the defined lat-long of the bot for collecting of data from the API. see [File-Monitoring](#File-Monitoring) for ideas to collect EAS alerts from a RTL-SDR.
```ini
# EAS Alert Broadcast
wxAlertBroadcastEnabled = True
# EAS Alert Broadcast Channels
wxAlertBroadcastCh = 2,4
wxAlertBroadcastEnabled = True # EAS Alert Broadcast
wxAlertBroadcastCh = 2,4 # EAS Alert Broadcast Channels
ignoreEASenable = True # Ignore any headline that includes followig word list
ignoreEASwords = test,advisory
```
@@ -438,19 +438,13 @@ training = True # Training mode will not send the hello message to new nodes, us
In the config.ini enable the module
```ini
[scheduler]
# enable or disable the scheduler module
enabled = False
# interface to send the message to
interface = 1
# channel to send the message to
enabled = False # enable or disable the scheduler module
interface = 1 # channel to send the message to
channel = 2
message = "MeshBot says Hello! DM for more info."
# value can be min,hour,day,mon,tue,wed,thu,fri,sat,sun
value =
# interval to use when time is not set (e.g. every 2 days)
interval =
# time of day in 24:00 hour format when value is 'day' and interval is not set
time =
value = # value can be min,hour,day,mon,tue,wed,thu,fri,sat,sun
interval = # interval to use when time is not set (e.g. every 2 days)
time = # time of day in 24:00 hour format when value is 'day' and interval is not set
```
The basic brodcast message can be setup in condig.ini. For advanced, See mesh_bot.py around the bottom of file, line [1491](https://github.com/SpudGunMan/meshing-around/blob/e94581936530c76ea43500eebb43f32ba7ed5e19/mesh_bot.py#L1491) to edit the schedule. See [schedule documentation](https://schedule.readthedocs.io/en/stable/) for more. Recomend to backup changes so they dont get lost.
+3
View File
@@ -325,5 +325,8 @@ wantAck = False
maxBuffer = 200
#Enable Extra logging of Hop count data
enableHopLogs = False
# Noisy Node Telemetry Logging and packet threshold
noisyNodeLogging = False
noisyTelemetryLimit = 20
+2
View File
@@ -1488,6 +1488,8 @@ async def start_rx():
logger.debug(f"System: CheckList Module Enabled")
if ignoreChannels != []:
logger.debug(f"System: Ignoring Channels: {ignoreChannels}")
if noisyNodeLogging:
logger.debug(f"System: Noisy Node Logging Enabled")
if enableSMTP:
if enableImap:
logger.debug(f"System: SMTP Email Alerting Enabled using IMAP")
+2 -1
View File
@@ -367,7 +367,8 @@ try:
wantAck = config['messagingSettings'].getboolean('wantAck', False) # default False
maxBuffer = config['messagingSettings'].getint('maxBuffer', 200) # default 200
enableHopLogs = config['messagingSettings'].getboolean('enableHopLogs', False) # default False
noisyNodeLogging = config['messagingSettings'].getboolean('noisyNodeLogging', False) # default False
noisyTelemetryLimit = config['messagingSettings'].getint('noisyTelemetryLimit', 20) # default 20 packets
except KeyError as e:
print(f"System: Error reading config file: {e}")
print(f"System: Check the config.ini against config.template file for missing sections or values.")
+21
View File
@@ -998,6 +998,13 @@ def consumeMetadata(packet, rxNode=0):
# Remove the oldest entry
oldest_nodeID = next(iter(positionMetadata))
del positionMetadata[oldest_nodeID]
# add a packet count to the positionMetadata for the node
if 'packetCount' in positionMetadata[nodeID]:
positionMetadata[nodeID]['packetCount'] += 1
else:
positionMetadata[nodeID]['packetCount'] = 1
except Exception as e:
logger.debug(f"System: POSITION_APP decode error: {e} packet {packet}")
@@ -1040,6 +1047,17 @@ def consumeMetadata(packet, rxNode=0):
logger.critical(f"System: Error consuming metadata: {e} Device:{rxNode}")
logger.debug(f"System: Error Packet = {packet}")
def noisyTelemetryCheck():
global positionMetadata
if len(positionMetadata) == 0:
return
# sort the positionMetadata by packetCount
sorted_positionMetadata = dict(sorted(positionMetadata.items(), key=lambda item: item[1].get('packetCount', 0), reverse=True))
top_three = list(sorted_positionMetadata.items())[:3]
for nodeID, data in top_three:
if data.get('packetCount', 0) > noisyTelemetryLimit:
logger.warning(f"System: Noisy Telemetry Detected from NodeID:{nodeID} ShortName:{get_name_from_number(nodeID, 'short', 1)} Packets:{data.get('packetCount', 0)}")
def get_sysinfo(nodeID=0, deviceID=1):
# Get the system telemetry data for return on the sysinfo command
sysinfo = ''
@@ -1249,6 +1267,9 @@ async def watchdog():
handleMultiPing(0, i)
if noisyNodeLogging:
noisyTelemetryCheck()
if wxAlertBroadcastEnabled or emergencyAlertBrodcastEnabled or volcanoAlertBroadcastEnabled:
handleAlertBroadcast(i)