You are here

Alert when a node joins the mesh

17 posts / 0 new
Last post
KQ9P
KQ9P's picture
Alert when a node joins the mesh
Hi folks

I finally have my second node installed and running here in Central Virginia (www.cvadn.net)!  As I open the net up for local hams to connect, I would like to know who is using the network.  Has anyone figured out how to get an alert when a node connects to the mesh?

Thanks much.  Mike KQ9P
K5DLQ
K5DLQ's picture
What alert mechanism are you

What alert mechanism are you thinking about???

  • a notice on the status page?
  • a txt message to your phone?
  • an entry in MeshChat?
  • a packet unproto message?
  • etc...
KQ9P
KQ9P's picture
Thanks for the very quick
Thanks for the very quick response!  I'm running an infrastructure monitoring system (Zabbix is my go-to, but I'm experimenting with PandoraFMS right now), so something that integrates with one of those.  An SNMP when a node joins or leaves the mesh, combined with the ability to query the list of active nodes, would probably be perfect.

Thanks.  Mike KQ9P
K5DLQ
K5DLQ's picture
SNMP is enabled on all AREDN
Hope this helps.
KQ9P
KQ9P's picture
That should do the trick
Thanks, I should be able to work with that to provide input to the monitoring software.

Mike KQ9P
kg9dw
kg9dw's picture
Mike, I'm interested in how
Mike, I'm interested in how you solve this. Keep us informed please!
KQ9P
KQ9P's picture
I whipped up a quick Python
I whipped up a quick Python script to read the sysinfo JSON, parse it, consolidate the list of nodes onto one line, and write it to stdout.  It takes the IP address or DNS name of the node you want to query as an argument.  This is suitable for use in a Zabbix "Remote Command" Item, invoked with the "system.run" Key.  I made a Trigger that sends me email if the output of the script changes (when a node joins or leaves the mesh).  Not fancy, but good enough for now...

#!/usr/bin/python
import urllib, json, sys
url = "http://" + sys.argv[1] + ":8080/cgi-bin/sysinfo.json?hosts=1"
sysinforaw = urllib.urlopen(url)
sysinfo = json.loads(sysinforaw.read())
hosts = sysinfo['hosts']
hosts.sort()
for i in hosts:
  if i['name'] != 'localhost':
    print i['name'],
N2MH
N2MH's picture
Python Script

Mike,

Looking at the json report from the node as well as the output of your script, you should be aware that both node names and advertised hosts are included. Thus, you will see not only nodes coming and going, but hosts that become advertised and unadvertised. This may not be a problem for you now, but as your network grows, you could get a lot of chatter.

Mark

w7rej
CACTI
Cacti has a supported plugin called DISCOVERY which I haven't tested yet. It is supposed to scan the network at a regular interval defined in the settings. Also defined in the settings is the subnet to scan. I can see where this would be an effective tool for smaller networks but the AREDN network has a total of 16,777,216 IP addresses. I don't think this is a realistic tool we can use to discover new hosts.

For testing purposes I added a node (temporarily) that is a neighbor to my other two nodes here at the QTH. I used its IP address to enter a subnet as (10.96.143.0/24) and set the scan to every hour. to test the DISCOVERY plugin. So far it has not been discovered but I'll wait another hour to see but as I said I don't think the DISCOVERY plugin is a realistic tool.

Cacti also has an unsupported (user provided) plugin called DPDISCOVERY. It does not require the entry of the subnet. I have it installed but not sure how correctly configure it or what its method of discovery is. Poor documentation.  I also set it to scan every hour but so far nothing shows up in the discovered list.

I know of no new nodes that have been set up on our overall network so I reset CACTI after adding my temporary node into the mix to see if either of these discovery tools work. I will post results here.

Honestly, I don't think either of these tools is suitable as they both have to scan and report where something like KQ9P has set up makes more sense. Maybe I should install ZABBIX and do the same. I'm not a programmer and have limited familiarity to Linux and tools. It would be nice if someone were to develop something we all could use.

--
Bob, W7REJ
 
w7rej
RE: CACTI
These tools do not work for me using what should be a proper configuration. CACTI does work for the other metrics I've set up that is was designed for.

--
Bob, W7REJ
AE6XE
AE6XE's picture
Bob, unless to tool
Bob, unless the tool systematically tests all individual 2^24 possible IP addresses, they wont find the devices on the AREDN network. Mesh nodes don't propagate broadcasts that would be searching for devices. This would thrash the RF links everywhere. Only way is to monitor OLSR produced host table or reproduce what OLSR does. Joe AE6XE
K5DLQ
K5DLQ's picture
You could "filter" the
You could "filter" the returned list of hosts by calling an extra GET request on each hosts to:  http://HOST:8080/AREDN.png
(I specifically called the logo, as, a request for it does not invoke the cgi processor like /cgi-bin/sysinfo.json (or similar) would.)
If it returns with a response 200, then, it's a NODE!  Yes, there's a remote chance that some could have a webserver running on port 8080 and have a file /AREDN.png, but, it's slim.

You would need to maintain a list of "NOT nodes" for your script so that you don't continually test the same non-nodes (for efficiency)

Just an idea.
N9ZL
Bash script for getting a list of nodes on the network

Here is a bash script I put in cron to periodically generate a list of nodes on the network from the OLSR topology list.  I run this on a raspberry pi. If you use a different flavor of linux you might have to fix some of the paths to the commands. 

If you keep the previous list of names this script generates and compare it with "diff olsrname.out olsrname.out.previous", it'll tell you who was added and who left.  Nodes with "<" were added, nodes with ">" left.  You can use this output to notify someone via email, snmp trap, whatever you like.

For example:
$ diff olsrname.out olsrname.out.previous
4d3
< N1NEW.local.mesh
17a17
> K9BYE.local.mesh


John N9ZL


#!/bin/bash
# Script pulls a copy of the topology database from NODE and builds a list of topology destination IPs in olsrip.out.
# It then builds a list of unique node names from the DNS entries for those ips and puts them in olsrname.out.
# John N9ZL 2/1/2017
#
NODE="localnode.local.mesh"

>olsrname.out
#get the topology dump from olsr
/usr/bin/wget -O olsr.out $NODE:9090 2>/dev/null
if [ $? -eq 0 ]; then
  #pull out the topology destination ips
  /bin/grep "destinationIP" olsr.out | /usr/bin/cut -d: -f2 | /bin/sed 's/"//g' | /bin/sed 's/,//' > olsrip.out
  cat olsrip.out | /usr/bin/sort | /usr/bin/uniq | while read IP
  do
    RESULT=`host -t PTR $IP`
    if [ $? -eq 0 ]; then
      NAME=`echo "$RESULT" | awk '{print $NF}' | sed 's/.$//'`
      echo $NAME
    fi
  done | /usr/bin/sort | /usr/bin/uniq > olsrname.out
fi
 

AB4YY
Unfortunately this no longer

Unfortunately this no longer works with the new (Nightly) builds.

- Mike ab4yy

KE4HGP
How do i go about joining
How do i go about joining once i have my node up and running?

Thank's
K6AH
K6AH's picture
"Joining" happens automatically
This discussion is about receiving some sort of notification when someone turns on a new node and connects with the local mesh.  "Joining" happens automatically so long as your node hears and connects to a neighboring node.

Andre, K6AH
KE4HGP
Thanks
OK Thanks

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer