![]() ![]() The apcupsd container is nothing more than the latest Alpine linux image apcupsd from the apk repository and a very lightweight apcupsd configuration files (configured to watch onlythe UPS at /dev/ups – more on this later) This docker-compose file also contained pointers to specific Dockerfiles to actually build an image for each service (hint: the two apcupsd services use the same container with different configurations). Apache/Multimon to provide an HTTP based interface.APCUPSD for the “Compute and Network” UPS.Next, I created a docker-compose file with the three “services” I decided I’d like for this setup: Lrwxrwxrwx 1 root root 7 Dec 18 19:55 ups-screen -> hiddev0Įxcellent! Now, anytime these devices are plugged/unplugged, we shouldn’t have to guess which is hiddev0 and which is hiddev1, since udev will automagically provide us named mount points for these USB devices, which will be critical to the next steps Lrwxrwxrwx 1 root root 7 Dec 18 19:55 ups-compute-and-network -> hiddev1 Ĭrwxrwxrwx 1 root root 180, 0 Dec 18 19:55 hiddev0Ĭrwxrwxrwx 1 root root 180, 1 Dec 18 19:55 hiddev1 Now, we should have some “nicely named” UPS USB devices:ĭrwxr-xr-x 2 root root 120 Dec 18 19:55. Now to get the serialnumbers: # udevadm info -attribute-walk -name=/dev/usb/hiddev0 | egrep 'manufacturer|product|serial'ĪTTRS="8675310", OWNER="root", SYMLINK+="usb/ups-compute-and-network"Īnd now to re-run the udev rules: udevadm trigger -verbose -sysname-match=hiddev* Great! we’ve got things that look like UPS devices on /dev/usb/hiddev0 and /dev/usb/hiddev1. ![]() UPS devices are generally mounted at /dev/usb/hiddev*, so we should confirm that we have a few present: # ls /dev/usbīus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubīus 004 Device 002: ID 051d:0002 American Power Conversion Uninterruptible Power Supplyīus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubīus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubīus 003 Device 002: ID 051d:0002 American Power Conversion Uninterruptible Power Supplyīus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub I decided to use the first step outlined in the apcupsd guide on the Debian Wiki (creating udev rules to ensure physical devices are given a persistent path on boot/attach). Dockerizing APCUPSDĪt this point, I decided to take a different approach to isolating each apcupsd process: an approach with far greater discoverability, version-control potential, and scalability. I’m generally not a fan of creating large “custom” configuration files in obscure locations with great variance from the distributed package, so this process seemed a little “hackey” to me especially since the end result of all of these configuration files was to have “isolated processes” for each UPS to monitor. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |