OPNsense & pfSense Store
Cart 0

Configure pfSense, NUT, and Nagios for UPS Monitoring

Introduction

UPS's work well with pfSense thanks to the Open Source 'Network UPS Tools' (NUT) providing the actual functionality. After installing the official pfSense package, the UPS is easily configured via web UI and also monitored via Nagios + NRPE. Hardware support is continuously improving as NUT is under active development and runs on a a variety of platforms besides pfSense (FreeBSD)

This guide assumes you are installing and configuring a UPS connected directly via USB to your pfSense firewall.

Hardware Selection

The official list of hardware supported by NUT is available at https://networkupstools.org/stable-hcl.html

A high-level Australia-centric recommendation would be:

  • Get a UPS with USB, its 2018 after all. Ensure you have a USB port spare on your firewall device
  • APC devices 'just work' over USB with the usbhid driver
  • The limited range of Upsonic devices we have used 'just work' over USB with the blazer driver
  • We have had no luck with the Eco-Alto from PSS
  • Jaycar UPS are hopeless and will probably never work as they dont have a proper USB vendor and device ID.

If in doubt, just buy an APC. They are also readily available with new batteries on Ebay, if you're cost conscious - and you'll get a 1000VA for around the price of a new ~600VA.

In all cases YMMV! Please let us know of your successes and we will add them here.

Install the NUT Package

Log in to the web UI of your pfSense firewall, then from the top bar menu click System, then Package Manager. The Package Manager page will load.

Install NUT Package 

Click the Available Packages tab then wait a second or two for the page to update.

Scroll down until you find the nut package, or use the Search feature at the top of the page.

Click "+ Install", then "Confirm" and wait a few moments for the package to install.

You may also like to install the Service_Watchdog and nrpe packages using the same steps.

Configure UPS Settings

From the top bar menu select Services then UPS.

Click UPS Settings and configuration options will appear.

Select UPS Type of Local USB.

Type in a UPS Name, spaces are not allowed. Note this value for use with NRPE later.

Select Driver to match your device, the usbhid will suit many devices including those from APC. The blazer driver is also very common. Consult the NUT Hardware Compatibility List for more information about your specific device.

Click Save.

You should now see the UPS Status page with all sorts of details.

UPS Status Details 

Configure Service Watchdog

(no graphics are provided for this section)

It's a good idea to install and configure the Service Watchdog. It will keep essential services running if they stop, and is trivial to configure.

Assuming you installed the package earlier, follow these steps.

From the top bar menu select Services then Service Watchdog.

On the page that appears, scroll to the bottom of the page and click "+ Add New Service". A new page will appear.

From the Service to Add drop down, select "nut: UPS monitoring daemon".

Click Add

You will be returned to the Service Watchdog page, and the nut service will now be listed under Monitored Services.

We recommend you repeat this simple process for all the services you use that are listed.

Configure NRPE for Nagios Monitoring

An exhaustive configuration guide for NRPE is outside the scope of this document.

You will however, need to check Enable NRPE, provide a Nagios Server(s) address or addresses. It is not recommended that you check Allow Arguments.

Now add the UPS configuration as follows.

Click "+ Add" near the bottom of the screen. A new row of input fields will appear under the Commands heading.

Provide the following values:

Input Field Value
Name check_ups
Sudo (leave unchecked)
Command check_ups
Warning Level 1
Critical Level 5
Extra Options -u Your_UPS_Name

 

In the Extra Options field replace "Your_UPS_Name" with the value of UPS Name you provided earlier in the UPS Settings. This is what tells the check_ups nagios plugin which UPS to query NUT about.

The Warning Level and Critical Level you should adjust to suit your tastes.

Finally, in your Nagios system's (or similar) configuration files you should configure a service like this that will check the status via NRPE:

define service {
    use generic-service
    service_description UPS State
    check_command check_nrpe_1arg!check_ups
    (other configuration to suit your needs)

UPS Status on Dashboard

The UPS Status can be added to the Dashboard by first clicking the pfSense logo on the top bar, which will take you to the Dashboard.

To the far right of the title "Status / Dashboard" there is a save, plus (+) and question mark icon. Click the plus (+) icon. The Available Widgets selection will appear.

From the Available Widgets click UPS Status. The page will reload and the UPS Status widget will now be at the bottom.

Drag this widget to your preference position on the Dashboard.

Click the Save icon to retain your Dashboard layout.

UPS Dashboard Widget

The Service Status widget may also be useful to you. It displays the status of all services including the nut service. Follow the same steps again to add it.

Stuck?

We offer commercial support, why not contact us

Thanks?

If these steps have helped you, please put a 5 star review on our Facebook page



Older Post Newer Post


Leave a comment

Please note, comments must be approved before they are published