Hands-on tutorial

Tutorials · Monitoring

How to Shut Down NVRs and Servers Automatically on Power Failure (Network UPS Tools)

Use Network UPS Tools (NUT) to watch a UPS, alert the team on power loss and shut down NVRs, servers and storage cleanly before the battery runs out.

Intermediate9 min7 steps

Before you start

  • A UPS with USB or a network management card
  • A Linux server or small appliance near the UPS
  • SSH or agent access to the systems you want to shut down

Step by step

  1. Connect the UPS

    Connect the UPS by USB to the monitoring server, or enable SNMP on its network card.

  2. Install NUT

    Install the NUT server and configure the UPS driver.

    apt install nut
    # /etc/nut/ups.conf
    [rackups]
      driver = usbhid-ups
      port = auto
    
  3. Run the NUT server

    Set NUT to netserver mode and create a monitoring user so other machines can read the UPS status.

  4. Configure clients

    On each server, run the NUT monitor as a client of the NUT server, so it shuts down when the battery is low.

  5. Handle appliances

    NVRs and storage that cannot run NUT can be shut down by a script over SSH or their API, triggered by NUT's event commands.

  6. Alert the team

    Send a notification on 'on battery' and 'low battery' events by email or webhook.

  7. Test

    In a maintenance window, unplug mains power and confirm alerts and shutdown order: applications, then storage, then the network last.

Commands are generic, industry-standard examples. Exact syntax and menu names vary by model and firmware; check your device's manual on the Documentation page.

Pro tips

  • Shut down the network last so shutdown commands still reach other devices.
  • Set shutdown timing based on measured runtime, not the label.
  • Make sure systems start again automatically when power returns.