# Monitoring This is the sub project to establish monitoring for various things, that cannot be implemented in the Kubernetes cluster. This goes mostly into the direction of client side MQTT messages from sensors. Various links: * [https://esphome.io](https://esphome.io) * [https://github.com/pvvx/ATC_MiThermometer](https://github.com/pvvx/ATC_MiThermometer) ## devices For credentials see repective esphome config file in subdirectory `./config`. | esp host | sensor name | mac | IP | |---------------|-------------|-------------------|-----------------| | muc-kitchen | outside | A4:C1:38:D5:9C:BD | 192.168.178.200 | | muc-kitchen | kitchen | A4:C1:38:AA:5F:9E | 192.168.178.200 | | muc-kitchen | bathroom | A4:C1:38:98:BA:CC | 192.168.178.200 | | muc-living | outside | A4:C1:38:04:1A:70 | 192.168.178.201 | | muc-living | living | A4:C1:38:01:90:9A | 192.168.178.201 | | muc-living | sleeping | A4:C1:38:CF:6D:2E | 192.168.178.201 | | rgbg-living | living | A4:C1:38:E1:36:C0 | | | rgbg-living | outside | A4:C1:38:9B:18:D0 | | | rgbg-living | outside-flora | A4:C1:38:67:44:95 | | | rgbg-living | krasser-kaktus | A4:C1:38:67:42:34 | | ## setup ### esphome Setup is based on [this guide](https://esphome.io/guides/getting_started_command_line.html). ```sh brew install esphome # wizard to create new devices esphome wizard muc-kitchen.secret.yml # flash to device # -hold boot button to enable flashing on esps esphome run ./config/muc-kitchen.secret.yml esphome run ./config/muc-living.secret.yml ``` ### custom firmware for hygrometers To flash a custom firmware for this sensor. * Android handy, go to [this page](https://pvvx.github.io/ATC_MiThermometer/TelinkMiFlasher.html). * Flash firmware. To test everything, check this YouTube Video and use the app "nRF Connect for mobile". ### dyndns-muc See file `dyndns-muc.moritzgraf.secret`. TODO: Not sure why the respective update URL does not work. ### prometheus Metrics are provided on `/metrics` link see in config file. ## no longer relevant Switched from MQTT to prometheus exporter setup. ### MQTT testing To test MQTT a cli can be used. See [hivemq install instructions](https://hivemq.github.io/mqtt-cli/docs/installation/#homebrew). ```sh mqtt sub -h moritzgraf.de -p 30024 --user sender -pw -t demo ############# general mqtt # get nodeport of mosquitto kubectl get svc mosquitto -n datalab # for password see `cat ../k8s/datalab/mosquitto.secret.yml` # subscribe to topic ❯ mqtt sub -h moritzgraf.de -p 30024 --user sender -pw -t demo # publish a msg in different shell ❯ mqtt pub -h moritzgraf.de -p 30024 --user sender -pw -m "HEllo" -t demo ``` #### paho ```sh pip install paho-mqtt python publish.py ```