bdwilson / arp_notify

A network device ARP monitor Vyatta/EdgeMax routers with Pushover & Webhooks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

arp_notify

A network device monitor Vyatta/EdgeMax routers to notify you via Pushover if new devices join your network(s). Helpful if you frequently add things to your network and need to know what was added without looking in dnsmasq log.

Optional .arpignore file will not notify you about MAC addresses you "trust".

Optional .arpnotify file to trigger webhooks if someone arrives/leaves. This comes in handy with Hubitat and a Virtual Presence Sensor. Create virtual presence devices per person and connect it to MakerAPI to use with a webhook.

Installation

$ ssh admin@10.0.0.1 (or whatever your router IP is)
$ sudo su -; mkdir -p /config/arp_notify; cd /config/arp_notify
# curl https://raw.githubusercontent.com/bdwilson/arp_notify/master/arp_notify.sh > arp_notify.sh
# curl https://raw.githubusercontent.com/bdwilson/arp_notify/master/backup.sh > backup.sh
# chmod 755 *.sh

Edit variables in arp_notify.sh to reflect your Pushover user token and app token (which you'll need to create).

# crontab -e

23 11 * * * /config/arp_notify/backup.sh
*/5 * * * * /config/arp_notify/arp_notify.sh

Info

Q: Why are you storing things in /var/log?
A: Because /var/log is stored in RAM vs. writing to SD every 5 minutes which may kill your SD card prematurely. Data is backed-up nightly to SD and restored upon reboot.

Q: What do I need to do after a router firmware upgrade?
A: Assuming you have the same config or are restoring from a config backup, you'll likely only need to reinstall the crontab entries above. First run of arp_notify.sh will restore the config from backup.

Q: What if I have devices which I trust and never want to be notified about them?
A: Create a file called .arpignore and put the MAC address (or the full entry from .arptable file) into this file. Theoretically, you could copy .arptable to .arpignore and ignore all devices from the getgo, then only be notified about new things.

Q: How does the webhook work. A: Create a .arpnotify file. The file should consist of a + or - depending on if the webhook is for arrival or departing. Then the MAC address of the device, then the webhook. For instance:

# more .arpnotify
# User 1 
+ f0:99:b6:ab:cd:12 http://192.168.1.16/apps/8/devices/1669/on?access_token=abcd-1234-xxxx-xxxx-xxxx
- f0:99:b6:ab:cd:12 http://192.168.1.16/apps/8/devices/1669/off?access_token=abcd-1234-xxxx-xxxx-xxxx
# User 2 
+ 74:b5:87:ab:cd:12 http://192.168.1.16/apps/8/devices/1670/on?access_token=abcd-1234-xxxx-xxxx-xxxx
- 74:b5:87:ab:cd:12 http://192.168.1.16/apps/8/devices/1670/off?access_token=abcd-1234-xxxx-xxxx-xxxx

About

A network device ARP monitor Vyatta/EdgeMax routers with Pushover & Webhooks

License:MIT License


Languages

Language:Shell 100.0%