Small utility to read messages from Azure IoThub and forward to InfluxDB.
Flow:
- Receive events from Azure IotHub using AMQP
- Convert from IotHub format to InfluxDB JSON format and ensure (custom) properties are in payload
- Write new message to influxdb
In case of (network) errors:
- sleep for 30 seconds
- retry
- still an error? goto 1
If restarted it will read all messages from the beginning of the queue. InfluxDB will ignore duplicate entries.
Packaged with Docker. Image available here: https://hub.docker.com/r/eihag/amqp-influxdb-forwarder/
docker build -t amqp-influxdb-forwarder:latest .
docker run -d --name influxdb -p 8083:8083 -p 8086:8086 influxdb docker run --net container:influxdb -v $(pwd)/config.properties:/config.properties amqp-influxdb-forwarder
brew install openssl export LDFLAGS="-L/usr/local/opt/openssl/lib" export CPPFLAGS="-I/usr/local/opt/openssl/include" export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig" pip3 install python-qpid-proton
Info about amqp settings: https://github.com/Azure/azure-event-hubs-python.git
Remove dangling images
docker rmi $(docker images -f "dangling=true" -q)
Attach to running container
docker exec -i -t influxdb /bin/bash