Remote Server Management Tool with the M5Stack StickS3
Today, we are diving into a highly practical project: building a system that allows us to interact with our remote server or switch when we lose normal network connectivity.
The Cost of Remote Management
How many of you have experienced a server or network device crashing, disconnecting from the local network, and leaving you with no way to manage it remotely? When the operating system crashes or the standard IP network fails, you are usually forced to physically stand in front of the rack to type commands by hand.
There are several fantastic solutions on the market to prevent this. PiKVM is one of the most famous open-source projects that redirects both serial and HDMI video outputs to a web interface. There are also hardware solutions like the GL.iNet Comet (GL-RM1). If we look at the enterprise level, we have Dell iDRAC and HP iLO, which give you a complete hardware overview of your server.
While prices for these tools have dropped in recent years, they still come with a significant cost. Over the weekend, I needed a remote management solution for the Intel NUC server I keep here in the office. I challenged myself: could I build a functional out-of-band management tool for under €20? The answer is yes, and I did it using the M5Stack StickS3.
Enter the M5Stack StickS3
For my project, I chose the M5Stack StickS3. It connects directly via USB-C to my Intel NUC and acts as a bridge to redirect the serial console. Despite its tiny size and sub-€20 price tag, this device is packed with hardware:
- Connectivity: Built-in 2.4GHz WiFi and Bluetooth.
- LCD Display: Provides real-time information like the connected WiFi network, IP address, and host status.
- Backup Battery: It features a 250mAh internal battery. While small, this backup battery allows the device to survive for 10 to 20 minutes if the server completely loses power—just enough time to save logs and send alerts!
Key Features of the Custom Firmware
I developed a custom lightweight software for the StickS3 that transfers all the serial console content via a web interface. Even if my server drops off the local network, I can still operate it remotely. Here are the main features I implemented:
- VT100 Terminal: A standard web-based terminal to execute commands by hand.
- Kernel Panic & Netconsole Logging: In the event of a global crash, the StickS3 captures the kernel dump. If the server dies, the internal battery ensures the buffer is saved and transmitted so you can analyze what went wrong.
- Zabbix Alerting: I integrated this tool with Zabbix. If the server turns off or experiences an Out of Memory (OOM) error, the StickS3 intercepts the logs using regular expressions and immediately sends an alert to the Zabbix server. I even monitor the USB voltage!
- Dual Network Modes: You can configure it in Station Mode (connecting to your local network) or Access Point (AP) Mode. If the local network is entirely down, you can connect directly to the StickS3's AP to manage your server without needing serial cables.
- Wake-on-LAN (WoL): The web interface allows you to send a UDP datagram to wake up or restart the machine remotely.
- Web Configuration: Easily configure WiFi credentials, Wake-on-LAN MAC address, IP settings, host port, and the Zabbix item key directly from the browser.
- M5Launcher Compatibility: The firmware is fully compatible with M5Launcher, a microkernel-like tool that makes flashing and installing software on M5Stack products incredibly easy.
How to Configure Your Server
Setting this up on your server is incredibly simple. Once you connect the M5Stack StickS3 via USB, you just need to enable the redirection of the serial console.
Step-by-Step Setup:
- Plug the M5Stack StickS3 into your server's USB port.
- Check your system logs (using
dmesg) to see which serial port has been assigned to the device (for example,ttyACM0). - Enable the serial console on that port by running the following command:
systemctl enable serial-getty@ttyACM0.service
Once activated, the LCD on the StickS3 will turn green, indicating that the host is connected. From there, you can access the web interface, log in with your secure credentials, and you will have full control over your machine!
Real-World Testing
During my tests, I simulated an Out of Memory error using the top command. The moment the kernel threw the error, the StickS3 intercepted it, saved the buffer, and instantly triggered an "OOM detected" event in Zabbix. When I physically disconnected the device, the web interface immediately registered the drop in USB voltage and alerted me that the host was disconnected. Reconnecting it brought everything back online within seconds.
Final Thoughts
As a home experiment and a general utility, this €20 tool has been a lifesaver. It gives me peace of mind and helps me understand exactly what is happening inside my network when I am working remotely. No more going crazy over mysterious network drops!
I have left all the source code and the firmware in the description of my YouTube video so you can try it yourself. What do you think of this budget-friendly KVM alternative? Do you have any ideas on how to improve it?
Let me know in the comments below, and don't forget to share this post if you found it helpful! A greeting from Dimitri, and I will see you next week. Bye everyone!
Stay Connected:
- 📺 Subscribe to my YouTube Channel: Quadrata
- 💬 Join the community on Telegram: ZabbixItalia