These days, I ordered the first bunch of hardware for my recent home automation project. However, beside all the sensors and actors I want to put into my home, I also would like to monitor and control as much devices as possible. Therefore, I came up with a little prototype to check whether some of my devices are online or not.
Candidates for my prototype where my
- Thecus N4200PRO (NAS)
- Lexmark Optra S 1255 (LAN-enabled laser printer)
- Canon PIXMA MG3150 (WLAN enabled inkjet printer/scanner)
My first thought was about using a tool such as Icinga for monitoring purposes. The tool is open source, well supported and used by many IT Pros in large companies. Icinga is based on NAGIOS, providing a REST API and a AddOn mechanism. However, the overhead to learn everything from the scratch was to much.
For now, I just wanted a prototype to verify whether my ideas work or not or if there are maybe any showstoppers.
While implementing the prototype, programmatically checking the availability using a simple ping was quite easy as the NAS and the laser printer both use a static IP address. However, the Wi-Fi-enabled inkjet printer uses dynamic assigned IP addresses from the DHCP server.
For those not familiar with ARP, ARP is the acronym for Ethernet Address Resolution Protocol and was originally specified in the RFC 826. arp.exe is a small Windows command line tool, allowing you to view the address translation tables.
“Displays and modifies the IP-to-Physical address translation tables used by address resolution protocol (ARP).”
Based on this, I wrote a small client capable of checking whether any device talking over TCP/IP is available or not if either the IP or the MAC is known.