Results 1 to 5 of 5
  1. #1
    Untangle Ninja proactivens's Avatar
    Join Date
    Sep 2008
    Location
    Greensburg, Pa
    Posts
    2,372

    Default UPS management support in 7.4

    The following how to will allow you to install NUT, which allows you to monitor your UPS and shut down untangle if the battery gets too low.

    USE AT YOUR OWN RISK - I have installed this and its working fine, but you may have different results. Please report problems here, but I am not responsible if something "unexpected" happens.

    1: Go make sure your UPS is compatable: http://www.networkupstools.org/compat/stable.html

    2: If it is, then fire up putty (if you have SSH enabled) or log in to the terminal from the console.

    Code:
    nano /etc/apt/sources.list
    un-comment the first 2 lines. When finished save the file (CTRL-o) and exit (CTRL-x)
    # WARNING - DO NOT MODIFY THIS FILE
    # Untangle can not support systems with modifications and third-party software $
    # Proceed only if you know what you are doing
    deb http://ftp.debian.org/debian lenny main contrib non-free
    deb http://security.debian.org lenny/updates main contrib non-free
    Run
    Code:
    apt-get update
    Wait for it to complete.

    Run
    Code:
    apt-get install nut
    press y if it asks you to accept the changes.

    Now nut is installed, but not functional. We need to make some config files first.

    Code:
    nano /etc/nut/ups.conf
    This creates a new file. Populate the file with this:
    [apc]
    driver = usbhid-ups
    port = auto
    The label in the square brackets can be anything. It identifies the UPS to upsd and upsmon. Find your UPS model on the NUT hardware compatibility list and substitute the corresponding driver for usbhid-ups above. If your UPS isnít listed, find similar ones. They probably use the same driver. If you have a USB-based UPS, you can leave the port as auto; itís ignored. Otherwise, the port will usually be /dev/ttyS0, the first serial port, or /dev/ttyS1, the second. If your UPS is connected via the serial port, youíll need to modify the permissions on the serial port device so that nut can access it.

    If you have a serial port, follow this next step. Make sure to change ttyS0 to match your serial port name.
    Code:
    nano /etc/udev/rules.d/99_nut-serialups.rules
    # /etc/udev/rules.d/99_nut-serialups.rules
    KERNEL=="ttyS0", GROUP="nut"
    Then run this command to reload the rules.
    Code:
    udevadm control --reload_rules
    Note that the preceding two steps are unnecessary if you have USB-based UPS.

    Now we can make sure that nut properly detects the UPS
    Code:
    upsdrvctl start
    You should see something like this:
    Network UPS Tools - UPS driver controller 2.2.2
    Network UPS Tools: 0.29 USB communication driver - core 0.33 (2.2.2)

    Using subdriver: APC HID 0.92
    Now, we need to configure upsd and upsmon. upsd communicates with the UPS driver that we just started. upsmon communicates with upsd and actually shuts down the machine in the event of a power failure.

    Create the file /etc/nut/upsd.conf
    Code:
    nano /etc/nut/upsd.conf
    # /etc/nut/upsd.conf
    ACL all 0.0.0.0/0
    ACL localhost 127.0.0.1/32
    ACCEPT localhost
    REJECT all
    This rejects all connections not originating from the local machine.

    Next, create /etc/nut/upsd.users
    Code:
    nano /etc/nut/upsd.users
    # /etc/nut/upsd.users
    [local_mon]
    password = strong_password_here
    allowfrom = localhost
    upsmon master
    Replace strong_password_here with a real password.

    Now we need to configure upsmon. Create /etc/nut/upsmon.conf
    Code:
    nano /etc/nut/upsmon.conf
    # /etc/nut/upsmon.conf
    MONITOR apc@localhost 1 local_mon strong_password_here master
    POWERDOWNFLAG /etc/killpower
    SHUTDOWNCMD "/sbin/shutdown -h now"
    Replace apc with the name you have your UPS in /etc/nut/ups.conf and strong_password_here with the password you set in /etc/nut/upsd.users.

    Now fix the file permissions
    Code:
    chown root:nut /etc/nut/*
    Code:
    chmod 640 /etc/nut/*
    Finally, edit /etc/default/nut so that upsd and upsmon will start at system boot. Change the following 2 entries:
    Code:
    nano /etc/default/nut
    START_UPSD=yes
    START_UPSMON=yes
    Now the MOT:
    Code:
    /etc/init.d/nut start
    Check the end of /var/log/daemon.log to make sure everything started up.

    You can also use this command to check status:
    Code:
    upsc apc
    Replace apc with whatever you named your UPS.

    Now lets clean up the sources list:
    Code:
    nano /etc/apt/sources.list
    put # signs at the beginning of the first 2 lines. (opposite of what we did in step 2)
    Code:
    apt-get update
    Done. Test it out when you have time. NUT will not shut down the appliance until battery becomes critical, so depending on your UPS you may be waiting a while.

    Let me know if anyone has any issues with this.
    Last edited by proactivens; 08-12-2010 at 11:23 AM.
    www.nexgenappliances.com
    Toll Free: 866-794-8879
    UNTANGLE STAR PARTNER
    Follow us at spiceworks!

  2. #2
    Untangle Ninja dwasserman's Avatar
    Join Date
    Jun 2008
    Location
    Argentina
    Posts
    4,367

    Default

    Nice and useful work.
    The world is divided into 10 kinds of people, who know binary and those not

  3. #3
    Untangle Ninja sky-knight's Avatar
    Join Date
    Apr 2008
    Location
    Phoenix, AZ
    Posts
    26,390

    Default

    I usually run apt-get update once more after putting the sources.list back for good measure. I don't trust the update scripts to do it for me, and all I need is an errant apt-get upgrade to fire without running update on the configuration first to nuke the box!
    Rob Sandling, BS:SWE, MCP
    NexgenAppliances.com
    Phone: 866-794-8879 x201
    Email: support@nexgenappliances.com

  4. #4
    Untangle Ninja proactivens's Avatar
    Join Date
    Sep 2008
    Location
    Greensburg, Pa
    Posts
    2,372

    Default

    noted and changed.
    www.nexgenappliances.com
    Toll Free: 866-794-8879
    UNTANGLE STAR PARTNER
    Follow us at spiceworks!

  5. #5
    Untangle Ninja sky-knight's Avatar
    Join Date
    Apr 2008
    Location
    Phoenix, AZ
    Posts
    26,390

    Default

    Oh and good post, nut sure looks simpler than apcupsd
    Rob Sandling, BS:SWE, MCP
    NexgenAppliances.com
    Phone: 866-794-8879 x201
    Email: support@nexgenappliances.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

SEO by vBSEO 3.6.0 PL2