Why should I deploy Docker to IoT devices? What are the use cases of running containers inside the IoT device like Raspberry Pi? Is Docker on IoT devices just for hobbyists? – To answer all these burning queries, I just thought of sharing one of the most interesting use case inside the datacentre lab which will surely attract infinite number of possibilities and implementation with Docker containers.
Imagine a small credit card size server sitting just below your ToR (Top of the Rack) switch, consuming very low power ( similar to your mobile device), not bound by wired Ethernet( Wi-Fi Direct, ZigBee) for mobile access and control, connected to ToR switch to discover the overall hardware, software managed and deployed through air, no monitor, keyboard and mouse intervention required – just boots up, discovers all your servers(rack/blades), storage(FC/iSCSI), Converged Infrastructure and network devices automatically and ready to monitor all of these datacentre equipment on the mobile & Web UI . Sounds interesting?? What if I say I have a single DOCKER container running inside this credit card size device handling all these functionality? Sounds crazy? Let me share the recent experience I had prototyping and designing this solution.
Why should I deploy Docker to IoT devices?
Docker is an open platform to build, ship and run your application anywhere: in your laptop, workstation, server, in a private or public cloud, within a local VM, or on physical hardware including IoT devices. Docker is very lightweight and this is what attracts developers who can apply to rapidly develop, test, deploy, and update IoT applications at scale. With very less disk, low memory resources and almost zero run-time overhead, deploying Docker on IoT devices like Raspberry Pi is considered a feasible solution.
Example: Let’s consider NagiosPi – a lightweight, feature rich & fully configured Server Monitoring Distro for the Raspberry Pi. To setup NagiosPi, one need to download the image and flash to SD card. Then, you need to boot through this SD card to use this tool. Why not just pull Nagios Docker image from Dockerhub and run it? I am sure you will save a lot rather than flashing your entire SD card and loosing the underlying OS.In short, if you run containers directly on your device, you can avoid having to constantly flash your device or overwrite the entire firmware. Instead you can build new images, pull them and run them within the host OS on the device.
I built the first Nagios container for ARM device few days back and pushed it to Dockerhub. You can refer https://github.com/ajeetraina/nagios-centos-arm
Just run the single Docker run command and Nagios is ready which you can easily see on the WebUI through http://<IP>/nagios.
Building Out-of-Band Monitoring Tool using Docker
Nagios is a free and open source monitoring and alerting service for servers, switches,applications and services. It basically collects the statistics of your server using agents like nrpe, check_mk or using SNMP and sends the alert if the metric value is above the predefined threshold. One of the implementation of such tool is most of the time it’s configured as in-band connectivity which means software that is installed on the remote system being managed and only works after the operating system has been booted. If you want to monitor hundreds and thousands of such servers, you need to ensure that the agent plugin should be running on each nodes.
What if I want to monitor the physical health of servers, storage and network switches? Say, you are running a huge data center for High Performance Cluster Computing (HPCC) kind of workloads and you want to make sure that the health of your servers is all fine. In case, any of the servers goes bad in terms of memory DIMMs, the in-band monitoring system needs lots of complex configuration to be carried out to meet the right implementation. Out-of-band(OOB) monitoring system finally comes for a rescue. OOB uses a dedicated channel for managing the hardware devices like network devices. This allows the network operator to establish trust boundaries in accessing the management function to apply it to network resources.
How about using the tiny Raspberry Pi which can do OOB monitoring for the entire infrastructure? Why do I need to setup a big system if this small credit card size can do what I really need? I spent considerable amount of time to come up with a viable solution and finally initiated building Out of Band monitoring tool . This was purely based on one of my previous work https://hub.docker.com/r/ajeetraina/dell-oob-monitoring/ which I built for X86 infrastructure.
https://www.youtube.com/watch?v=lpaeTepVETg&feature=youtu.be
How does it work?
All you need is list out all the IP addresses in one simple text file and run the below command:
Step-1: List out the IP addresses of Chassis, Storage devices, iDRAC IPs etc. in a plain text file using notepad or vim editor. Example: I saved the file called “ips” under /IP folder in the Docker Host machine as:
File: /IP/ips
100.94.214.181
100.94.214.178
100.94.214.190
100.94.214.210
……
……
Step:2: Execute the below command to start the container:
$sudo docker run -dit --net=host -v /IP:/IP ajeetraina/dell-oob-monitoring:v1.0
Step3: Execute the following command to add the list of Dell servers, storage and chassis in a single shot:
$sudo docker exec -it <container-id> sh discover
Open up your browser http://<dockerhost>/nagios to see all the listed servers, storage and chassis added automatically to Nagios console and ready to be monitored.
Sounds Interesting?? Though I have tested this container internally and it just works out of box, I am still working on making it more lightweight. Stay tuned !
In the future post, I am going to talk more use cases of Docker on Raspberry Pi box. Keep Reading !
Comments are closed.