Monitor UPSs with Nagios uisng Custom Nagios Plugins

I have a couple of CyberPwoer UPSs and to monitor them through Nagios I’ve been uisng some custom Nagios plugins I’ve written sometime back.

CyberPower UPSs can be monitored uisng the pwrstat utility uisng their PowerPanel software but it will not work with other UPS brands. I have one UPS connected to host running Debian so the pwrstat command can be used for that. But I have another UPS which needs t be monitored through a Raspberry Pi (above pic) which is near it and unfortunately the CyberPowers’s PowerPanel doesn’t support ARM bases systems yet (as of today). Therefore, I’m uisng the Network UPS Tools (NUT) and monitoring that second UPS uisng the nut-server. If your UPS is not CyberPower you can check if your UPS supports the NUT utility here. NUT will run on any Linux based system regardless, if it’s x86/64 or ARM.

Let’s first get to how we could setup a UPS to be monitored thru Nagios uisng NUT

This is how the monitoring works :

  1. The Linux host (I have a raspberry PI – any Linux host should work) which the USP is connected (by USB) must have nut-server and nut-driver installed.
  2. The custom Nagios plugins will use the nuts command line utility to fetch information about the UPS.
  3. We add services in the Nagios config in the Nagios server to call these custom plugins. The first steps here would be to install nut-server and nut-driver on the host. There are some good links provided by NUT website (Links here), so I will not go through the process of installing nut-server and nut-driver.

After getting NUT installed you can get the status of the ups by running this command as sudo.

sudo upsc <ups-name>@localhost