Collecting Unifi controller data with collectd

This is an old post!

This post is over 2 years old. Solutions referenced in this article may no longer be valid. Please consider this when utilizing any information referenced here.

As you can tell from the last few posts, I’ve been having a lot of fun with collectd and instrumenting my systems. But I had one glaring hole until recently: my Ubiquti Unifi AP access points. Well no longer!

I came across an NPM package that could easily extract data from the Unifi controller software. From there, it was trivially easy to implement a script that harvests data from the controller and passes is along to collectd.

Thus, collectd-unifi was born.

Getting started with it is pretty easy. Just clone the repo, install the NPM dependencies and edit the config file. Once you have the script working, you can use the Exec plugin in collectd to run the script:

LoadPlugin exec
<Plugin "exec">
    Interval 60
    Exec "daemon:daemon" "/usr/bin/nodejs" "/opt/collectd-unifi/unifi.js"
</Plugin>

Restart collectd and you should now have Unifi data flowing.

Comments (0)

Interested in why you can't leave comments on my blog? Read the article about why comments are uniquely terrible and need to die. If you are still interested in commenting on this article, feel free to reach out to me directly and/or share it on social media.

Contact Me
Share It
Release Announcements
Okay, no profit in this, but it certainly is fun! I have two Nest thermostats in my house and, after some teething pains (yay the life of an early adopter) they have been pretty solid. But they’re also black boxes that I know little about. I know they’re collecting mountains of data and sending it back to the Google mothership. Wouldn’t it be nice to get at some of that data and build my own reports?
Read More
Parenthood
Well, here we are five months later and COVID-19 is still a thing. And like many parents we are facing the need to continue our daughter’s education at home. Our local school district has stated that all learning will be conducted online for at least the first nine weeks. And even if they allow for students to return, we will probably opt to keep her at home for awhile longer until things are more stable. Now, our daughter is seven and will be turning eight in a couple months. So she’s at that age where she’s old enough to do some things independently. But, as most of us know, the Internet is not a safe place for a seven year old and we as parents need to exercise some level of control over the things they can access. And while the best solution is a set of eyes, we obviously can’t be everywhere at all times. So this is the solution I came up with.
Read More
collectd
Extending my post from last year, here’s some additional data I’m grabbing from pfSense and stuffing into collectd via a script. I’m now grabbing: DHCP Leases CPU Temperature Thermal Zone Temperature SSD Drive Temperature UPS information (via NUT) Here’s the exec script:
Read More