Skip to content

sinMonitor

sinMonitor is a Discord bot written in Python 3.9 that monitors the temperature and humidity of the SIN server room with an aosong am2302 sensor (basically a DHT22 sensor) and a webcam. sinMonitor also hosts a Prometheus server (hosted on port 8000) so that the temperatures can be accessed with a GET request.

Where and how does it run?

sinMonitor runs on our trusty Raspberry PI 4! The bot python file is located at /home/pi/sinMonitor. The bot runs on startup with a systemd service located at /lib/systemd/system/sinMonitor.service. The content of this file is as follows. (Change BOT_TOKEN_HERE with your bot token with the correct token if copied!)

[Unit]
Description=A python discord bot that monitors SIN
After=multi-user.target

[Service]
Type=idle
Environment="BOT_TOKEN=xxx"
ExecStart=/usr/bin/python3 /home/pi/sinMonitor/main.py > /home/pi/sinMonitor.log 2>&1
WorkingDirectory=/home/pi/sinMonitor

[Install]
WantedBy=multi-user.target

More info on gitlab!