Monitor your UPS with NUT and Grafana

NUT Logo

If you are using NUT (Network UPS Tools) you can monitor your UPS current and historical usage with Grafana. There are several Grafana dashboards available for NUT however I decided to settle on Unraid NUT UPS Dashboard TR. Now don’t worry if you are not running Unraid, neither am I and I was able to tweak their Unraid instructions to running in my Docker Swarm environment of Raspberry Pies.

NUT UPS Grafana Dashboard
NUT UPS Grafana Dashboard

Requirements

This post is not going into setting up Grafana or NUT and is tweaked for running for containerized in a Docker Swarm cluster. However the information here should be enough to setup if you are not using containerization.

  • A running instance of Grafana
  • A running instance of InfluxDB version 1.x (the exporter script does not support v2+)
  • A running instance of NUT

nut-influxdb-exporter

nut-influxdb-exporter is a dockerized Python script that will send data from NUT to InfluxDB. Now here you have 2 options:

nut-influxdb-exporter service definition

nut-influxdb-exporter:
    image: eblabs/nut-influxdb-exporter
    environment:
      INFLUXDB_HOST: influxdb
      INFLUXDB_PORT: 8086
      INFLUXDB_USER: yourusername
      INFLUXDB_PASSWORD: 'yourpassword'
      INFLUXDB_DATABASE: nut
      NUT_HOST: NUTserverIP
      NUT_PORT: 3493
      NUT_USERNAME: nutusername
      NUT_PASSWORD: 'nutpassword'
      UPS_NAME: 'yourUPSname'
#      VERBOSE: 'true'

Setting up the Datasource in Grafana

  1. In Grafana go to Configuration -> Datasources
  2. Select “Add data source”
  3. Select “InfluxDB”

Influx-UPS-NUT datasource settings

Influx_UPS_NUT_Data_Source
If Save & Test works we are ready to import the dashboard

Importing the dashboard into Grafana

  1. In Grafana go to Create (+) -> Import
  2. ID is 10914
Grafana-Import-Screen

And now you should be able to monitor your UPS

NUT UPS Grafana Dashboard
NUT UPS Grafana Dashboard

Looking for a UPS?

I’ve been using APC Uninterruptible Power Supplies for over twenty years. I’ve worked with probably their entire product line from desktop, rack mounted and data center power distribution. If you’ve never had a UPS or need a new one APC is the way to go.

Posted in GrafanaSoftware

Tags - GrafanaNUTUPS