Koozali.org: home of the SME Server

Nut Configuration for PAC

David S. Helmuth

Nut Configuration for PAC
« on: January 02, 2004, 01:11:01 PM »
Below is a quick overview of how I got NUT working with my APC UPS (BackUPS Pro 650 and serial cable (940-0024C).  I hope it helps others.  If you have any suggestions/tips they are welcome.  Thanks!

1 - Enable Nut
/sbin/e-smith/config set nut service status enabled

2 -  Set to the correct model/driver for your UPS
/sbin/e-smith/db configuration setprop nut Model newapc

3 -  Set the correct port for connection
/sbin/e-smith/db configuration setprop nut Device /var/lib/ups/ttyS0

4 - Set the correct cable type.  (Note this is a new configuration property, so we will need to update a template to use it properly.)
/sbin/e-smith/db configuration setprop nut Cable 940-0024C

5 - Make the new template directory
mkdir -p /etc/e-smith/templates-custom/etc/ups/ups.conf

6 - Copy the template fragments
cp /etc/e-smith/templates/etc/ups/ups.conf/UPS /etc/e-smith/templates-custom/etc/ups/ups.conf/UPS

7 - Edit the template fragments to include the new Cable Property  (
pico /etc/e-smith/templates-custom/etc/ups/ups.conf/UPS

{
    my $model = $nut{Model} || "hidups";
    my $device = $nut{Device} || "/var/lib/ups/hiddev0";
    my $cable = $nut{Cable}; #### Add this line
    $OUT .= "[UPS]\n";
    $OUT .= "\tdriver = $model\n";
    $OUT .= "\tport = $device\n";
    $OUT .= "\tcable = $cable\n"; #### Add this line
}

8 - Copy the /dev/ttyS0 to the location where it will be referenced.  This is an imitation of the delivered method and prefereble to changing ownership/permission on /dev/ttyS0.
cp -R /dev/ttyS0 /var/lib/ups/ttyS0

9 - Change the owner of the new one so that NUT can use it.
chown nutups:nutups /var/lib/ups/ttyS0

10 - Update Everything
/sbin/e-smith/signal-event post-upgrade

11 - Reboot
/sbin/e-smith/signal-event reboot

David S. Helmuth

Re: Nut Configuration for PAC
« Reply #1 on: January 02, 2004, 01:11:56 PM »
Sorry that Subject Should read - Nut Configuration for APC

mtaboada

Thank´s a lot for your help.
« Reply #2 on: January 23, 2004, 11:43:02 PM »
Thank´s a lot for your help.  ;-)

IceDizzy

How to get the newapc driver?
« Reply #3 on: May 05, 2007, 10:29:30 PM »
Solved: Read in Forum http://forums.contribs.org/index.php?topic=36539.0
combined with "man genericups" to understand how things joined each other.
The cable issue are crusial.

/Ice

Intitial thoughts and problem below:

Thanks 4 a nice guide still got one prob.

Stopping UPS monitor:                                      [  OK  ]
Stopping upsd:                                             [  OK  ]
Shutting down upsdrvctl: Network UPS Tools - UPS driver controller 2.0.5
Can't open /var/run/nut/newapc-UPS.pid: No such file or directory

Starting upsdrvctl: Network UPS Tools - UPS driver controller 2.0.5
Can't start /sbin/newapc: No such file or directory
                                                           [FAILED]
Starting upsd:                                             [  OK  ]
Starting UPS monitor (master):                             [  OK  ]


=============

[root@kor init.d]# config show nut
nut=service
    Cable=940-0024C
    Device=/var/lib/ups/ttyS0
    MasterPass=759964811456487
    Model=newapc
    SlavePass=176362351604865
    status=enabled
[root@kor init.d]#

 uname -a
Linux kor 2.6.9-42.0.10.ELsmp #1 SMP Tue Feb 27 10:11:19 EST 2007 i686 athlon i386 GNU/Linux

 SME Server 7.1.3

Any tip are welcome.
Also tried the generic driver.

/Ice