# Monitor your Network with the WatchYourLAN Docker Container

## Метаданные

- **Канал:** Pi My Life Up
- **YouTube:** https://www.youtube.com/watch?v=9lUxFb8dBd0
- **Источник:** https://ekstraktznaniy.ru/video/39349

## Транскрипт

### Segment 1 (00:00 - 05:00) []

Hi everyone. It's Emmet from Pi My Life Up. In this video we'll be showing you how to set up the software WatchYourLAN using Docker. WatchYourLAN is a super lightweight IP based network scanner. It will automatically scan the chosen network interfaces for any devices. It will then monitor any of the devices that it finds and checks, whether it's online or offline. You can even set it up so that it will notify you when a new host is found on your local network. One of the best things about setting up WatchYourLAN is, how easy it is to use. All you need to do is provide the software, your time zone and the network interfaces it should scan and it will automatically begin monitoring. While not the most configurable piece of software, it is great for those who do not need a fully fledged software. In fact, you can even get it running in just a few short minutes, especially if you already have Docker installed to your system. Now for the first part of this guide will be walking through the process of installing Docker on to your machine. If you already have Docker installed, you can skip the first part of this tutorial. The first thing we need to do is install the packages we require by typing sudo apt install curl wget and then hyphen y and then press enter. Once the packages have been installed, we can move on to installing Docker itself, which we can do by typing curl space hyphen S, capital L space https colon forward slash get dot docker dot com space pipe symbol space s h and then press enter. This command will grab and run the docker install script from the official Docker website. Once done, you will want to add your current user to the Docker group, which you can do by typing Sudo space user mod space hyphen a capital G space, docker space dollar symbol and then USER all in uppercase. This will allow your current user to interact with the Docker daemon without you needing to elevate to the super user. For this change to take effect, you need to reboot your system by typing sudo space reboot and press enter. Once your system has finished restarting, we can move on to setting up the WatchYourLAN Docker container. Let's start this process by making a directory to store it’s compose file as well as its database. You can create this directory by typing sudo space mkdir space hyphen p space slash opt slash stacks slash watchyourlan. Now change to this new directory by type in CD space slash opt slash stacks slash watchyourlan and then press enter. Now, before we can begin writing the docker compose file for WatchYourLAN we will need to work out your network interface names. We can display these by typing IP space link space show and then pressing enter. Typically, with the result of this command, you'll want to ignore the first entry, which is typically the loopback device. The loopback interface is basically just there, so your system can talk with itself if it needs to. Now you'll want to take a look at the other network interfaces and identify the one that you're using for your network, and also the one that you want to scan. Now in our case, ours is called ens2. Now, typically you're more likely to see something such as eth0 for the Ethernet or wlan0 for Wi-Fi. If you have multiple Wi-Fi or Ethernet interfaces, these numbers will increase. Some systems use a completely different naming scheme, but just to identify the one that you use for your network and then write it down. We can now move on to setting up the compose file that will set up the WatchYourLAN Docker container. To save you a bunch of typing, we'll use the wget command to grab a template from our GitHub. Download this file by typing sudo space wget space https colon symbol forward slash git dot pimylifeup dot com slash compose slash watchyourlan slash compose dot y a m l. Once saved to your system, we can open it for editing by typing sudo space nano space compose dot yaml. Within this file, there are two placeholders that you'll want to replace. The first is the time zone placeholder.

### Segment 2 (05:00 - 08:00) [5:00]

This must be a valid TZ identifier for where you live. If you don't know your TZ identifier, we'll leave a link below to where you can easily find yours. This is used by WatchYourLAN to ensure that its logs match your current time. For it to match our timezone, we'll be typing Australia slash Hobart. Next we must tell the WatchYourLAN Docker container what network interfaces we want it to monitor. We do this by replacing the interfaces placeholder with the name of the network interfaces that you got earlier. For our example, we would set ours to ens2. If you want to monitor multiple network interfaces, all you need to do is add a space and then type in the additional name. For example, eth0. As we don't have multiple interfaces to monitor, we'll just be leaving it as ens2. Now save and quit by pressing control plus x, then y, and then enter. With that now written, we can get the WatchYourLAN software up and running by starting up the Docker compose stack. All we need to do this is type in docker space, compose space up space hyphen d and then press enter. The use of the hyphen D option ensures that the Docker container will start up in the background. If you ever run into issues with the container not being able to start, remove the hyphen D option and try again. It should show the error logs within the command line. With the monitoring software now up and running, you'll want to access its web interface. If you don't know the IP address of your machine, you can use the command hostname Space hyphen I to retrieve it. In our case, you can see that our IP address is 192. 168. 0. 212. Now open up your favorite web browser and go to HTTP colon forward slash, followed by the IP address of the machine where you're hosting what your LAN, and then followed by a colon symbol and then the port 8840. At this point, you should now have full access to the WatchYourLAN software and can see all the various devices that are available on your network. If you make the window a bit bigger, you'll also be able to mark devices as known so that you know that you already know what that device is, as well as the ability to check whether it's online or offline. You can even configure WatchYourLAN to save it’s data to influx or Prometheus. This can be useful if you want a better way of being able to graph the data over time. Hopefully at this point you have also managed to get the n WatchYourLAN software up and running on your device. You quickly see, the huge advantage of watching land is that it is incredibly straightforward and easy to use. Now, while there are much more feature packed solutions out there, WatchYourLAN does an incredibly good job at achieving what it does without consuming a lot of resources. This makes it perfect for devices like a Raspberry Pi as you aren't sacrificing your precious resources. If you liked this guide on setting up WatchYourLAN using Docker. Be sure to give us a thumbs up and subscribe. Until next time. Have a good one.
