Skip to content

Local network devices presence and activity diagnostic Dockerized system for Raspberry Pi

License

Notifications You must be signed in to change notification settings

MrLaki5/Home-presence

Repository files navigation

Local network devices presence and activity diagnostic Dockerized system for Raspberry Pi

  • Track devices activity over time on your local network
  • Be notified, with email, when new device is connected on your local network
  • Have overview of active times of every device on your local network
  • Have overview of top lists of devices with most active hours on your local network per: day, month, year, all time

Quick start:

  • Build and run Home-presence
  • From browser go to Raspberry Pi's ip address
  • Login, default password is: "toor"
  • Under settings set network attribute to match with used network
  • Under settings press start workers to start collecting data

Build:

Commands run on host os to build and compose project to Raspberry Pi. For this step all dependencies need to be installed and docker-macine setup.

  • Build frontend:
./build-front.sh [--install-packages] --raspberry-ip <Raspberry ip address>
# <raspberry ip address>: IP address of Raspberry Pi in local network.
# --install-packages needed only on first build.
# For more help run: ./build-front.sh --help
  • Connect to raspberry docker deamon with docker-machine:
eval "$(docker-machine env <Machine name>)"
# <Machine name>: Name of docker-machine
  • Compose and start docker containers on raspberry:
./build.sh [--recreate-db]
# --recreate-db when set db will be recreated (needed on first run).
# For more help run: ./build.sh --help

Dependencies:


Docker-machine host setup:

Commands run on host os to setup docker machine for communication with raspberry.

  • Generate SSH key for docker-machine communication:
ssh-keygen
  • Add generated key to raspberry:
ssh-copy-id -i <path to generated ssh key> pi@<raspberry ip address>
# <raspberry ip address>: IP address of Raspberry Pi in local network.
# <path to generated ssh key>: Path to key generated in previous steps.
  • Create docker-machine:
docker-machine create --driver generic --generic-ip-address <Raspberry ip address> --generic-ssh-user pi --generic-ssh-key <path to generated ssh key> --engine-storage-driver overlay2 <Machine name>
# <raspberry ip address>: IP address of Raspberry Pi in local network.
# <path to generated ssh key>: Path to key generated in previous steps.
# <Machine name>: Name of docker-machine that will be used to connect to Raspberry.

Interface overview:

Interface is composed of multiple pages that are used for collected data representation and system parameterization. Interface pages are shown on images below:

  • Graphs of active device numbers per time

  • List of active device in specific period of time

  • Specific device information and active times

  • Top lists of devices with most active times in last [Day, Month, Year, All time]

  • Settings with system parameterization, options to set update times of network analysis, setup email for new devices notifications, change system password


Stack:

  • Hardware platform: Raspberry Pi
  • Virtualization: Docker containers
  • Backend api for network statistics: Flask
  • Network statistics library: Nmap
  • Database: PostgreSQL
  • Frontend: React
  • System entry point: Nginx