Reply
Senior Member
Posts: 3,074
Registered: ‎08-06-2015
Kudos: 1304
Solutions: 175

Grafana dashboard for UniFi APs now available

Over the past couple of years technology has advanced quite a bit with respect to time-series databases, data collection solutions, and visualizations.  Given this, not too long ago I started to look at new options for datacenter monitoring and was impressed with what was available.

 

It was not long ago when the primary time-series "database" was RRDtool, which itself was the foundation for many monitoring solutions.  Now there are dozens of options all being actively suported and developed.

 

Visualization had traditionally been weak with a large number of monitoring solutions, but this area itself has exploded with highly-functional and well-supported options.

 

 

I ultimately settled on InfluxDB for TSDB, Telegraf for collection, and Grafana for visualization.  These three are integrated well and are a commonly-used combination that is well supported.

 

To that end, I have been creating dashboards and migrating existing collection in enironments where it makes sense.  Following the recent thread (Somewhat) functional SNMP example I have published my first dashboard to Grafana.net.

 

 

The dashboard and related details, including the Telegraf configuration, may be found at UniFi AP Dashboard. This is a detailed visualization though the individual panels may be used as examples for a summary dashboard.  This solution is templated with a simple single dropdown to choose the desired UAP to view.  No further dashboard configuration is required and as new APs are added to the collector they will automatically appear in the dashboard dropdown.

 

I am still adjusting and tuning the dashboard but some screenshots:

 

Snap1.png

 

 

Snap2.png

 

 

Snap3.png

 

 

Snap4.png

 

 

 

 

Senior Member
Posts: 3,074
Registered: ‎08-06-2015
Kudos: 1304
Solutions: 175

Re: Grafana dashboard for UniFi APs now available

I have made some small updates to the dashboard and also have made this avaialble via GitHub in addition to Grafana.net

 

I have added templating for selecting VAPs and Interfaces as well as corrected a query that was not working properly.  Grafana insists on using a 'string' even if a value is numeric so that query had to be fixed raw rather than with the wizard.

 

Any feedback would be welcome.

 

Established Member
Posts: 1,287
Registered: ‎05-25-2016
Kudos: 230
Solutions: 11

Re: Grafana dashboard for UniFi APs now available

Wauw... just... amazing looks.. I would LOVE to give you some feedback if you are able to help me install to my controller.. I have a cloud key where I host my own network.. would love to try it
Senior Member
Posts: 3,074
Registered: ‎08-06-2015
Kudos: 1304
Solutions: 175

Re: Grafana dashboard for UniFi APs now available

I don't know if a cloudkey could support this directly.  Unfortunately I don't have one to try.

 

However, any other linux, windows, macos, or bsd instance should work just fine.  Even a raspberry pi should be sufficient.

 

All three components should be a very straightforward install on any of the above, and configuration to get them going is also minimal/easy.

 

InfluxDB is the first step, and is the actual database:  InfluxDB 1.2 Introduction

Telegraf is the next step, and is the collector:  Telegraf 1.2 Introduction

Grafana is the third step, and is the visualization:  Grafana

 

The native package repository for your chosen OS may already include these, otherwise pre-built binaries and/or packages are available at the links noted.  All three have docker images available if you want to go that route, however many are not familiar with docker.

 

I include the needed Telegraf configuration to use with the dashboard - that would be the most tedious part.

 

 

Established Member
Posts: 1,287
Registered: ‎05-25-2016
Kudos: 230
Solutions: 11

Re: Grafana dashboard for UniFi APs now available

Okay I got docker on my nas but I am in no way familiar with it.. it's seeems tricky for a first timer in those system Man Happy

Would you care to help if I gave you remote access to a cloud key or rocker?
Established Member
Posts: 923
Registered: ‎12-18-2015
Kudos: 215
Solutions: 30

Re: Grafana dashboard for UniFi APs now available

OMG so beautiful! Thanks for sharing Man Happy

 

-Jamie M.

Established Member
Posts: 1,287
Registered: ‎05-25-2016
Kudos: 230
Solutions: 11

Re: Grafana dashboard for UniFi APs now available


waterside wrote:

I don't know if a cloudkey could support this directly.  Unfortunately I don't have one to try.

 

However, any other linux, windows, macos, or bsd instance should work just fine.  Even a raspberry pi should be sufficient.

 

All three components should be a very straightforward install on any of the above, and configuration to get them going is also minimal/easy.

 

InfluxDB is the first step, and is the actual database:  InfluxDB 1.2 Introduction

Telegraf is the next step, and is the collector:  Telegraf 1.2 Introduction

Grafana is the third step, and is the visualization:  Grafana

 

The native package repository for your chosen OS may already include these, otherwise pre-built binaries and/or packages are available at the links noted.  All three have docker images available if you want to go that route, however many are not familiar with docker.

 

I include the needed Telegraf configuration to use with the dashboard - that would be the most tedious part.

 

 


Would you be able to help me installing the controller on docker and then installing your theme? i knows its A LOT to ask for, but i would really like to test your product.
Senior Member
Posts: 3,074
Registered: ‎08-06-2015
Kudos: 1304
Solutions: 175

Re: Grafana dashboard for UniFi APs now available

I'll need a few days but yes I can try to give you some direction to get you going.

 

The documentation at the links provided is a good reference but indeed does not help with a docker install.

Senior Member
Posts: 3,074
Registered: ‎08-06-2015
Kudos: 1304
Solutions: 175

Re: Grafana dashboard for UniFi APs now available

I have put together a quick-start guide for getting a new stack running via docker at InfluxDB/Telegraf/Grafana Using Docker

 

It is based on a standard Linux install so a NAS likely will be a little different.  Typically you'll use a BUI instead of commandline, but the details of the configuration are the same.

 

Take a quick look to see if there's enough to figure out.  

 

  • There are three containers (influxdb, nuntz/telegraf-snmp, grafana/grafana).
  • The '-p' option is the port mapping.  For influxdb you'll want 8086:8086 and for grafana you'll want 3000:3000.  Telegraf does not need any ports exposed and instead has its network connected directly to the influxdb instance (--net option)
  • The '-v' option is the storage mapping.  For influxdb and grafana you'll want directories used to hold their data.  For telegraf you provide a read-only mapping for the configuration file and a read-only mapping for MIB files.

 

Established Member
Posts: 1,287
Registered: ‎05-25-2016
Kudos: 230
Solutions: 11

Re: Grafana dashboard for UniFi APs now available

[ Edited ]

waterside wrote:

I have put together a quick-start guide for getting a new stack running via docker at InfluxDB/Telegraf/Grafana Using Docker

 

It is based on a standard Linux install so a NAS likely will be a little different.  Typically you'll use a BUI instead of commandline, but the details of the configuration are the same.

 

Take a quick look to see if there's enough to figure out.  

 

  • There are three containers (influxdb, nuntz/telegraf-snmp, grafana/grafana).
  • The '-p' option is the port mapping.  For influxdb you'll want 8086:8086 and for grafana you'll want 3000:3000.  Telegraf does not need any ports exposed and instead has its network connected directly to the influxdb instance (--net option)
  • The '-v' option is the storage mapping.  For influxdb and grafana you'll want directories used to hold their data.  For telegraf you provide a read-only mapping for the configuration file and a read-only mapping for MIB files.

 


Ive been looking. Aparantly this.. and many other docker "install's" is not meant to appeal to a guy who is opening the docker program for the 1st time in his life.. wauw. i feel like a 2 year old trying to learn chinese language... Man Surprised

 

i seriously had to give up since i have NO idea where to even begin Man Happy

 

The guide seems nice, i believe the bug is my brain in this scenario..

 

what a shame.

would have loved to try it

Senior Member
Posts: 3,074
Registered: ‎08-06-2015
Kudos: 1304
Solutions: 175

Re: Grafana dashboard for UniFi APs now available

Let's take this a step at a time, if you are interested in giving it a shot.

 

You mentioned you have a NAS that supports docker.  Do you do your configuration via BUI (browser) or do you leverage a shell/cli?  I will guess the former but want to confirm.  I haven't done this on a NAS but I've looked over some documentation for a Synology DS series in the past.

 

Is docker already installed/available on your NAS (based on the documentation) or are there instructions you need to follow to add this?

 

 

Established Member
Posts: 1,287
Registered: ‎05-25-2016
Kudos: 230
Solutions: 11

Re: Grafana dashboard for UniFi APs now available


waterside wrote:

Let's take this a step at a time, if you are interested in giving it a shot.

 

You mentioned you have a NAS that supports docker.  Do you do your configuration via BUI (browser) or do you leverage a shell/cli?  I will guess the former but want to confirm.  I haven't done this on a NAS but I've looked over some documentation for a Synology DS series in the past.

 

Is docker already installed/available on your NAS (based on the documentation) or are there instructions you need to follow to add this?

 

 


 

i sure am interested.

 

Docker is installed. i am navigating in the GUI(browser)

 

i can enable terminal/cli access if needed Man Happy

 

Senior Member
Posts: 3,074
Registered: ‎08-06-2015
Kudos: 1304
Solutions: 175

Re: Grafana dashboard for UniFi APs now available

[ Edited ]

Docker containers are self-contained/isolated and considered "transient", in that they can be created and destroyed arbitrarily as an atomic operation (IE: The container either exists in its entirety or it does not exist at all).

 

Docker provides a method to map a persistent storage location (directory or file) outside of a container to a location inside the container so that when the container is removed the desired data & configuration remain available.  For this case we care about three primary items:

  1. The data collected from SNMP.  This is saved in InfluxDB so we want the InfluxDB data directory to be persistent.
  2. The dashboard configurations for Grafana.  This is saved by Grafana itself as you import/create/edit dashboards.
  3. Configurations.  The default for both InfluxDB and Grafana is sufficient to start, so all we care about at first is the configuration for Telegraf.

There is a fourth item for the SNMP MIBs that will be noted below.

 

The first step will be to identify the locations where you want these on your NAS.  You can start with a single directory and a few subdirectories as a starting point.  As an example:

  • Top level:  /docker/monitoring/
  • Configurations:  /docker/monitoring/conf (This is <configdir> in the QuickStart)
  • Databases: /docker/monitoring/data
    • InfluxDB data: /docker/monitoring/data/influxdb (This is <influxdir> in the QuickStart)
    • Grafana data: /docker/monitoring/data/grafana (This is <grafanadir> in the Quickstart)
  • MIBs: /docker/monitoring/mibs (This is <mibsdir> in the QuickStart)

 

Create these directories on your NAS and remember them for the next steps. This is a one-time step.

 

Next, grab the telegraf.conf configuration from the 'Quick Start' I referenced above and save it in the /docker/monitoring/conf directory on your NAS.

 

Next, grab the telegraf-inputs.conf from the UAP-AC-HD dashboard and add it to the end of the telegraf.conf you just saved on your NAS.  Any plaintext editor will work (use your favorite).

While you are there you'll want to edit a few items as noted in the doc for the dashboard.  Essentially you just need to set the list of agents (the hostnames of the APs to be monitored) and the SNMP community string and leave the rest as-is for now.

 

Next, for the UAP-AC-HD dashboard you'll need to grab the three MIB files noted and save those in the MIBs directory you created above:

  • UBNT-MIB from this site (identified in the UniFi release notes):  http://dl.ubnt-ut.com/snmp/UBNT-MIB
  • UBNT-UniFi-MIB from this site (identified in the UniFi release notes):  http://dl.ubnt-ut.com/snmp/UBNT-UniFi-MIB
  • FROGFOOT-RESOURCES-MIB:  A simple web search should find a copy of this one.  I got mine from the open-source Observium distribution but there are other sources as well since it is not uncommon.

So far all of the above is independent of docker and would need to be done regardless of method of install.  It sounds/looks complex but it really amounts to creating a few directories, downloading a few files and saving them to those directories, then making two minor edits to one file.

 

 

 

 

 

Senior Member
Posts: 3,074
Registered: ‎08-06-2015
Kudos: 1304
Solutions: 175

Re: Grafana dashboard for UniFi APs now available

After you have the above completed you can move to the next step of creating and starting the containers, but you do want the above completed first.

 

 

You'll want to create three containers, one each for InfluxDB (the database), Telegraf (the collector), and Grafana (the visualization).  We will "name" these containers as 'influxdb", "telegraf" and "grafana" respectively.

 

By default, docker containers do not expose any network ports and so will not be able to accept any inbound network connections from outside the container.  In this case, Telegraf does not need to accept any network connections so doesn't need any ports exposed.  InfluxDB needs to allow connections from clients such as collectors and visualizers.  A single port '8086' is used here which is the InfluxDB default.  Grafana similarly needs to accept connections from browsers to display the dashboards, and the single port '3000' is used here also as the Grafana default.

 

Each docker container is based on an image, typically available from a centralized repository such as DockerHub (the default used by most docker installs).  In this case:  'influxdb' container will be based on 'influxdb' image, 'telegraf' container will be based on 'nuntz/telegraf-snmp' image, and 'grafana' container will be based on 'grafana/grafana' image.

 

 

To create and start a container a single command line (per container) with various options is used.  In this case with three containers there are three commands (from the QuickStart):

 

docker run --name influxdb --rm -d -p 8086:8086 -v /docker/monitoring/data/influxdb:/var/lib/influxdb influxdb
docker run --name telegraf --rm -d -v /docker/monitoring/conf/telegraf.conf:/etc/telegraf/telegraf.conf:ro -v /docker/monitoring/mibs:/root/.snmp/mibs:ro --net=container:influxdb nuntz/telegraf-snmp
docker run --name grafana --rm -d -p 3000:3000 -v /docker/monitoring/data/grafana:/var/lib/grafana grafana/grafana

For using the above to configure containers via your NAS BUI:

  • Container name is identified in orange
  • Network port mapping is identified in green
  • Storage (file/directory) mapping is identified in violet
  • Image is identified in blue

Storage and network mapping is specified in pairs of 'host:container'.   For network we keep the port number the same to avoid unneeded complexity.

 

In your NAS, create the containers one at a time.  Use the details above to fill in the details in the BUI (IE: Name the container using the name above).  When you get to this point if you get stuck then post a follow-up here and we'll go from there.  The on-line help for your NAS may provide some additional hints.  Once you get through this you should be able to do similar mapping for other docker containers in which you may be interested.

 

For the telegraf container, you'll need an advanced option to change the type of network used.  This uses a "legacy" container-mapped network but if this is not available in your NAS there are other options to use instead.  Post here if you can't figure this one out.

 

The 'telegraf.conf' mapping is a file, while the others are directories (if your NAS wants you to choose).  Additionally the 'telegraf.conf' and 'mibs' mappings are read-only (The ':ro' at the end of the string) while the others are read-write.

 

 

Established Member
Posts: 1,287
Registered: ‎05-25-2016
Kudos: 230
Solutions: 11

Re: Grafana dashboard for UniFi APs now available

@waterside are you online?
Established Member
Posts: 1,287
Registered: ‎05-25-2016
Kudos: 230
Solutions: 11

Re: Grafana dashboard for UniFi APs now available

[ Edited ]

waterside wrote:

Docker containers are self-contained/isolated and considered "transient", in that they can be created and destroyed arbitrarily as an atomic operation (IE: The container either exists in its entirety or it does not exist at all).

 

Docker provides a method to map a persistent storage location (directory or file) outside of a container to a location inside the container so that when the container is removed the desired data & configuration remain available.  For this case we care about three primary items:

  1. The data collected from SNMP.  This is saved in InfluxDB so we want the InfluxDB data directory to be persistent.
  2. The dashboard configurations for Grafana.  This is saved by Grafana itself as you import/create/edit dashboards.
  3. Configurations.  The default for both InfluxDB and Grafana is sufficient to start, so all we care about at first is the configuration for Telegraf.

There is a fourth item for the SNMP MIBs that will be noted below.

 

The first step will be to identify the locations where you want these on your NAS.  You can start with a single directory and a few subdirectories as a starting point.  As an example:

  • Top level:  /docker/monitoring/
  • Configurations:  /docker/monitoring/conf (This is <configdir> in the QuickStart)
  • Databases: /docker/monitoring/data
    • InfluxDB data: /docker/monitoring/data/influxdb (This is <influxdir> in the QuickStart)
    • Grafana data: /docker/monitoring/data/grafana (This is <grafanadir> in the Quickstart)
  • MIBs: /docker/monitoring/mibs (This is <mibsdir> in the QuickStart)

 

Create these directories on your NAS and remember them for the next steps. This is a one-time step.

 

Next, grab the telegraf.conf configuration from the 'Quick Start' I referenced above and save it in the /docker/monitoring/conf directory on your NAS.

 

Next, grab the telegraf-inputs.conf from the UAP-AC-HD dashboard and add it to the end of the telegraf.conf you just saved on your NAS.  Any plaintext editor will work (use your favorite).

While you are there you'll want to edit a few items as noted in the doc for the dashboard.  Essentially you just need to set the list of agents (the hostnames of the APs to be monitored) and the SNMP community string and leave the rest as-is for now.

 

Next, for the UAP-AC-HD dashboard you'll need to grab the three MIB files noted and save those in the MIBs directory you created above:

  • UBNT-MIB from this site (identified in the UniFi release notes):  http://dl.ubnt-ut.com/snmp/UBNT-MIB
  • UBNT-UniFi-MIB from this site (identified in the UniFi release notes):  http://dl.ubnt-ut.com/snmp/UBNT-UniFi-MIB
  • FROGFOOT-RESOURCES-MIB:  A simple web search should find a copy of this one.  I got mine from the open-source Observium distribution but there are other sources as well since it is not uncommon.

So far all of the above is independent of docker and would need to be done regardless of method of install.  It sounds/looks complex but it really amounts to creating a few directories, downloading a few files and saving them to those directories, then making two minor edits to one file.

 

 

 

 

 


 

 

okay, i got to the part where you say this " Next, grab the telegraf-inputs.conf from the UAP-AC-HD dashboard and add it to the end of the telegraf.conf you just saved on your NAS"

 

 

i dont have the HD model, i have all the other.s but how/where do i "grab" the telegraf-inputs.cont from my UAP's??

where do i find those?

 

the new "system version" for synology just arrived, i can inside the docker program now "search" for "programs/container" in the docker, i can actually find "grafana" Man Happy

would that help me/you Man Happy

if youre up for the job, id love to see a teamviewer session on how you do it, i love learning by seeing and also doing.

 

 

oh an btw.. this is some NICE help, THANK you so MICH. i will make sure to spread your work whenever i get around friends and family Man Happy

Senior Member
Posts: 3,074
Registered: ‎08-06-2015
Kudos: 1304
Solutions: 175

Re: Grafana dashboard for UniFi APs now available

Sorry - I meant the UAP dashboard.  It would work with any Gen2 or Gen3 UAP.  You can get this either from the Grafana.net link in the first post or from the GitHub link I later noted.

 

if you use grafana.net, the config would be cut-n-pasted from the Overview page under the 'Collector configuration' section.  You don't need the bottom "output" part of the configuration as this should already be in the telegraf.conf.  If you use github, it will actually be the file called 'telegraf-inputs.conf' in its entirety in the same directory as the dashboard itself.

 

I don't have a synology but I've used the online documention in the past when working with others.  IIRC the standard 'hub.docker.com' Docker Hub should already be configured as a repository so you should be able to find all three images (the text in blue above) as you found grafana.  For reference, since it is not uncommon for many images to have similar naming, these are the three to which I refer in my notes:

 

You can use these as a reference to compare if you get multiple images listed when you search.

 

Likely once you have the first container going the other two should be easy - it is just getting through the first one that involves climbing the learning curve.  If you've already found one of the images you've made good progress already.

 

Emerging Member
Posts: 41
Registered: ‎10-13-2015
Kudos: 2

Re: Grafana dashboard for UniFi APs now available

I would love to see some works like this for the edgerouters. 

 

Senior Member
Posts: 3,074
Registered: ‎08-06-2015
Kudos: 1304
Solutions: 175

Re: Grafana dashboard for UniFi APs now available


GPConnect wrote:

I would love to see some works like this for the edgerouters. 

 


I have one but it requires functionality from a github PR for Telegraf that is not yet merged.  It is targeted for the 1.3 release but requires a custom build of Telegraf before then.

 

I'll post a note in the EdgeMax forum when I make it available.

New Member
Posts: 7
Registered: ‎03-09-2017

Re: Grafana dashboard for UniFi APs now available

Hey Waterside, 

 

Thanks for your great work on this. After taking forever to learn how to install MIB's and enable them in snmp.conf I got most of the dashboard working. However some are not, what would lead to this? (more are failing to load data below.) 

 

unifi.PNG

Reply