Skip to content

Instantly share code, notes, and snippets.

@mufus
Last active July 10, 2023 18:54
Show Gist options
  • Save mufus/1ace5f79f6908d3f35677edccecf0148 to your computer and use it in GitHub Desktop.
Save mufus/1ace5f79f6908d3f35677edccecf0148 to your computer and use it in GitHub Desktop.
Configuring NUT Server/Client on pfSense, Synology NAS, and VMware ESXi for Homelab UPS Management

NUT (Network UPS Tools) installation for HomeLab

This guide provides instructions on how to install and configure the Network UPS Tools (NUT) server/client to manage the power supply of your homelab components through a pfSense router, VMware ESXi hypervisor, and Synology NAS.

In this configuration, the pfSense router acts as the NUT server connected to the UPS, while the VMware ESXi and Synology NAS act as NUT clients, receiving UPS status information from the NUT server running on the pfSense router.

pfSense (NUT Server)

  1. Install the "NUT" package.

  2. For UPS Settings, configure as follows:

    • UPS type: Local USB
    • UPS Name: ups
    • Driver: usbhid

    Add the following Extra arguments:

    • ignorelb
    • override.battery.charge.warning = 40
    • override.battery.charge.low = 35
  3. Additional configuration lines for upsd.conf: LISTEN <local-ip-of-pfsense>

  4. Additional configuration lines for upsd.users:

    [monuser]
    password = secretupsmon
    slave
    

Synology NAS (NUT Client)

  1. Navigate to Control Panel -> Hardware & Power -> UPS -> Enable.
  2. Set UPS type as "Synology UPS server".
  3. Set IP as <local-ip-of-pfsense>.

VMware ESXi (NUT Client)

  1. Download the latest NutClient for ESXi from https://rene.margar.fr/2012/05/client-nut-pour-esxi-5-0/. For example: NutClient-ESXi-2.8.0-2.4.1.x86_64.tar.gz

  2. Enable Community VIB's:

    • Disable Secure Boot for UEFI / BIOS
    • Navigate to Host -> Manage -> Security & Users -> Acceptance level -> Edit settings.
    • Change setting to "Community".
  3. Upload the NutClient.tar.gz to your datastore and install:

    cp /opt/vmfs/volumes/datastore1/somewhereNutClient-ESXi-2.8.0-2.4.1.x86_64.tar.gz /tmp
    cd /tmp
    tar -xzf NutClient-ESXi-2.8.0-2.4.1.x86_64.tar.gz
    sh upsmon-install.sh
    
  4. Configure the service:

    • Navigate to Host -> Manage -> System -> Advanced settings.
    • Search for "UserVars.Nut" and configure as follows:
      • UserVars.NutUpsName = ups@
      • UserVars.NutUser = monuser
      • UserVars.NutPassword = secretupsmon
  5. Start the service and set policy:

    • Navigate to Host -> Manage -> Services -> NutClient.
    • Start the service and set Policy to "Start and stop with host".
  6. Test the connection to UPS: /opt/nut/bin/upsc ups@<local-ip-of-pfsense>.

  7. Test the shutdown via UPS: /opt/nut/sbin/upsmon -c fsd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment