by acls us

IoT Electric Imp monitoring with Zabbix and Grafana

ImpThe Electric Imp range of IoT devices offer a simple means to interface with a number of different physical data collection devices and connect back to a central controlling Server Platform via built-in WiFi. Code can be written and deployed from the central Server Platform that controls how the collected data is made available. In the following example I have used the built-in light level sensor data and exposed it via a simple web interface on the Server Platform. This data is collected and stored by a Zabbix Server and presented via a Grafana Dashboard.

Imp Network

The Electric Imp itself is packaged in an SD Card like enclosure which can be plugged into a number of different SD Card type sockets to give connectivity to power and physical interfaces. The Electric Imp has a light level sensor inside the SD Card type package that is used to read configuration instructions from a Smart Phone App (BlinkUp) to setup the WiFi parameters and can be used as a Light Sensor at run-time. Once configured and connected to a WiFi Network with Internet connectivity, the Electric Imp connects to the central Imp Cloud from which it will download any updates and Device code created for the device. The Imp Cloud will also have Agent code that runs on the Imp Cloud and controls communication between the Imp Cloud and the device.

The Imp Device code used simply registers a function to be called when and Agent message of type "queryLight" arrives. When the function is called by the arrival of the message it reads the hardware lightlevel and sends that back to the Agent.

 Imp Device Code

The Imp Agent code used is a little more complicated but all it does is to get triggered when a http get request arrives (the URL to use for the specific device is shown in the Development environment on Imp Cloud), sends a message to the device and passes the reply back as the http response. There is also code to handle timeouts communicating with the device. If there is any error communicating, a zero value is returned on the http response.

Imp Agent Code

At the Zabbix Server, the local Zabbix Agent is used to send the https request to the Imp Cloud on the specific URL for the device and extract the Light Level data by using a "" item (xxxxxxxxxxx replaced with the specific value from the Development Environment);[,xxxxxxxxxx/?queryLight,80,"([0-9]+)$"]

The data is then held on the Zabbix Server and used by a Grafana Dashboard to show a graph of the level and a status panel which shows red if there is a problem communicating with the device.



Part two here.