Part 1: Marrying Zabbix and Cozify IoT hub

This is how it always starts

For those of you who know me, this should not come as a surprise: I absolutely love Zabbix. It gives me the ultimate freedom to monitor whatever I need to monitor and is flexible enough to be able to monitor absolutely everything you can imagine. It's free, it's open source, and scales to whatever needs you might have.

What does a monitoring nerd who is a technical lead for monitoring in a global cyber security company do during his downtime? That's a silly question, mind you. Of course he monitors his home with a home Zabbix instance.

No alt text provided for this image

 

Hello, Cozify

We have had Cozify home automation system in our household since 2017. It is a nice central hub which supports IoT devices from plethora of vendors and vast selection of device categories, ranging from Philips Hue lights to motion sensors to cameras to fire alarm systems. You can then configure actions on some other device based on actions on one device: for example, turn on a light if a motion sensor detects movement.

Cozify is a very capable device, but where it definitely lacks is monitoring and analytics about what's going on underneath.

As a monitoring addict, that is something I simply cannot stand.

Let's build a bridge between Cozify and Zabbix

Someone has built an unofficial Python library for communicating with Cozify API. The library is a bit limited in functionality, most limiting factor being that it only supports read-only operations. However, for my monitoring purposes, that does not matter, as I anyway need to read data.

For my initial testing purposes, I wrote couple of small Python scripts to gather temperature and humidity data from our temperature sensors, and one script to monitor the general availability of the different IoT devices we have around. The scripts are run from cron every five minutes, and the results are written to text files which Zabbix reads. Zabbix has master items for temperature, humidity and reachability files, and using the dependent items, it can populate the data for all the 40+ data points I have now using just three polls.

No alt text provided for this image

Benefits of such project

Other than cool geek factor, what's the benefit of monitoring your home IoT hub? There's plenty!

 

  • I get to learn all kinds of patterns about our home status: temperatures, reliability of individual devices, amount of time any device has been on/off ....
  • I get notified immediately if a critical device such as smoke alarm does not function properly
  • I get notified if battery level on any battery operated IoT device is getting low and can react before a device dies
  • I can follow how quickly battery is draining on some device

 

Still for me to do

The current implementation is way too manual. It would be possible to utilise Zabbix low-level discovery to parse the JSON received from Cozify, but if I just dump everything from it, it contains all the possible device categories with different parameters: Philips Hue lights do report everything from their current brightness/color settings to if their firmware has been upgraded, and then the temperature or motion sensors do report back completely different set of data. That makes creating the monitored items automatically in a sane way a bit difficult.

So, I need to think a bit and figure out how to make my Cozify template more automatic.

I also need to setup a home Grafana instance speaking to Zabbix. Zabbix is excellent at collecting the monitoring data and sending out alerts, but Grafana is the perfect partner for Zabbix to do all the analytics and eye candy.

Proceed to part 2 of this blog series

I have been working at Forcepoint since February 2014 and never get tired of monitoring.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
Buy me a coffee

Like these posts? Support the project and Buy me a coffee