APC Serial UPS

From SME Server

Jump to: navigation, search
Request for Deletion:
This article or section should be removed. Please help to correct all links to it or discuss the issue on the talk page

NUT (Network UPS Tools) in SME 7 defaults to using a USB connection between the UPS and computer. My APC Smart UPS only has a serial connection, this is how I made NUT talk to my UPS using the APC supplied 940-0024C serial cable.

NUT already exists in the configuration database as a disabled service. It needs to be enabled and a couple of properties changed. I also used a symlink for the serial port to use rather than a direct connection to the device. The use of a symlink and thus the udev custom template is optional. Just use the relevant /dev/ttyS? instead of /dev/apcups in the "config setprop nut Device xxx" command below.

[edit] How to do it:

  1. To adjust the configuration database issue the following commands as root:
    config setprop nut Device /dev/apcups
    config setprop nut Model apcsmart
    config setprop nut status enabled
    

    Note the case of "Device" and "Model".

    To check that these changes have stuck use:

    config show nut
    

    and you should get:

    nut=service
        Device=/dev/apcups
        Model=apcsmart
        status=enabled
    
  2. If using a symlink for the NUT Device, make a custom template so that udev creates this symlink on boot up.

    Create the directory /etc/e-smith/templates-custom/etc/udev/rules.d/10-local.rules and change to it. Using your favorite text editor create a file called apcups so that it contains:

    # For NUT and APC Smart UPS via Serial Port
    KERNEL="ttyS0", SYMLINK="apcups"
    

    Changing "ttyS0" to the serial port that your UPS is connected to of course.

    Expand the template:

    expand-template /etc/udev/rules.d/10-local.rules
    

    This is required as a seperate expansion as this template is not known to SME Server.

  3. Make SME Server fully aware of the changes by doing:
    signal-event post-upgrade
    signal-event reboot
    

    When the server comes back up NUT should be running. Login to the server and try upsc ups@localhost, if all is well this will return loads of information about the UPS state. /var/log/messages is a good place to look for hints if things aren't working.

[edit] Finally

Feeling brave? Pull the power to the UPS and the server should gracefully shut down, I haven't felt brave yet...

This HowTo can probably used a basis to get other serial port connected UPS's working with NUT. The man pages of the NUT suite are pretty good and NUT supports a large range of UPS's. Further information about NUT is available in another HowTo on Uninterruptable Power Supplies.


Personal tools