For my fellow sysadmins who would like to be responsible and monitor server room temperature but professional monitor appliances are too expensive.
The plan here is pretty simple, all you need is:
- Some sort of x86/ARM capable single-board computer like RaspberryPI with GPIO pins
- A few components, the star of the show is 1-Wire temperature sensor like MAX31820
- Basic soldering experience
1-Wire ambient temperature sensing devices are cheap (~$1CAD/each), easy to control (1-wire protocol drivers are readily available) and one can chain a lot of them on a single wire. I'm using UTP since every server room has plenty spare.
I'm chose a standalone C++ web framework to avoid running the bloat that are NGINX/Apache2 + Django/PHP/... on an rpi. But deep down I just wanted to try something new.
- Download/clone Drogon: https://github.com/an-tao/drogon
- Follow its installation steps, before running cmake add this line to drogon's CMakeList.txt to fix linking errors on RaspberryPI
target_link_libraries(${PROJECT_NAME} PUBLIC atomic)- Install drogon
- Download/clone this code, do usual
$ mkdir build
$ cd build
$ cmake ..
$ make- initialize database
sqlite3 database.db
> .read sqlite3.sql- put poll_devices.py in a crontab at arbitrary interval, ie every minute:
* * * * * /home/pi/poor_admins_monitor/poll_devices.py /home/pi/poor_admins_monitor/database.db- while database is filling up with first data, rename config.json.template to config.json and adjust settings to your liking
- run web server with
./poor_admins_monitor- Point browser to:
http://host:port/api/v1/device/listhttp://host:port/api/v1/device/get/1http://host:port/api/v1/device/get/1/history
- Advertise service over avahi
- Configuration script to assign each device a verbose name and location
- Add systemd timer example file for a <1m polling interval (impossible in cron)
