Simple examples for creating zabbix-agent and prometheus-exporter (in progress) on ESP-devices
NodeMCU v3
Wemos D1 Mini
DHT11
DS18B20
(Tested only with D2 pin, I recommend to use it. GPIO16 (D0) can't be used - checked by me twice)BMP280
AHT10
(Only with GPIO4/D2 and GPIO5/D1 - view comments section for pinout)
- Async web-server was taken here
- Zabbix Agent by Azq2
- AHTxx Library by enjoyneering
- Because of using millis() / 1000 as uptime, zabbix uptime value can't be more than 41 days 17 hours (int32 overflow). You'll recieve "Device was restarted" message
- Sometimes devices are losing wi-fi connectivity in roaming wireless networks (such as CAPsMAN on Mikrotik)
Simple script, including:
- Reading temperature & humidity from DHT11 sensor (should work for DHT22 too)
- Providing simple web-server for displaying them (routes are: "/", "/temperature", "/humidity")
- Zabbix-agent on port 10050 with this items:
- agent.ping
- agent.hostname
- agent.uptime
- agent.version
- read.temperature
- read.humidity
Simple script, including:
- Reading temperature & pressure from BMP280 sensor (maybe should work for BMP180 too, idk)
- Providing simple web-server for displaying them (routes are: "/", "/temperature", "/pressure")
- Zabbix-agent on port 10050 with this items:
- agent.ping
- agent.hostname
- agent.uptime
- agent.version
- read.temperature
- read.pressure
- Prometheus exporter on
http://IP/metrics
with this metrics:esp_device {ip="DEVICE_IP", type="BMP280", title="HOSTNAME"} UPTIME
esp_sensor {ip="DEVICE_IP", type="BMP280", title="HOSTNAME", sensor="temperature"} TEMPERATURE
esp_sensor {ip="DEVICE_IP", type="BMP280", title="HOSTNAME", sensor="pressure"} PRESSURE
Simple script for detecting 64-bit addresses of DS18B20 sensors. Flash it & view address in console
Update: if you're using only one sensor - no need to do this, view ds18b20.ino
comments section
Simple script, including:
- Reading temperature from DS18B20 sensor
- Providing simple web-server for displaying it (routes are: "/", "/temperature")
- Zabbix-agent on port 10050 with this items:
- agent.ping
- agent.hostname
- agent.uptime
- agent.version
- read.temperature
Simple script, including:
- Reading temperature & humidity from AHT10 sensor (should work for AHT15/AHT20 too)
- Providing simple web-server for displaying them (routes are: "/", "/temperature", "/humidity")
- Zabbix-agent on port 10050 with this items:
- agent.ping
- agent.hostname
- agent.uptime
- agent.version
- read.temperature
- read.humidity
- Prometheus exporter on
http://IP/metrics
with this metrics:esp_device {ip="DEVICE_IP", type="AHT10", title="HOSTNAME"} UPTIME
esp_sensor {ip="DEVICE_IP", type="AHT10", title="HOSTNAME", sensor="temperature"} TEMPERATURE
esp_sensor {ip="DEVICE_IP", type="AHT10", title="HOSTNAME", sensor="humidity"} HUMIDITY
- Template for Zabbix (DHT11 sensor). Tested on 5.4.
- Included items:
- agent.ping
- agent.hostname
- agent.uptime
- agent.version
- read.temperature
- read.humidity
- Triggers:
- ESP is unavailable
- ESP was restarted
- Hostname was changed
- Agent Version was changed
- Simple graphs:
- Temperature
- Humidity
- Temperature & humidity
- Template for Zabbix (BMP280 sensor). Tested on 5.4.
- Included items:
- agent.ping
- agent.hostname
- agent.uptime
- agent.version
- read.temperature
- read.pressure
- Triggers:
- ESP is unavailable
- ESP was restarted
- Hostname was changed
- Agent Version was changed
- Simple graphs:
- Temperature
- Pressure
- Template for Zabbix (DS18B20 sensor). Tested on 5.4.
- Included items:
- agent.ping
- agent.hostname
- agent.uptime
- agent.version
- read.temperature
- Triggers:
- ESP is unavailable
- ESP was restarted
- Hostname was changed
- Agent Version was changed
- Simple graphs:
- Temperature
- Template for Zabbix (AHT10 sensor). Tested on 5.4.
- Included items:
- agent.ping
- agent.hostname
- agent.uptime
- agent.version
- read.temperature
- read.humidity
- Triggers:
- ESP is unavailable
- ESP was restarted
- Hostname was changed
- Agent Version was changed
- Simple graphs:
- Temperature
- Humidity
- Temperature & humidity