Difference between revisions of "UPS Ubuntu Setup"

From Amahi Wiki
Jump to: navigation, search
 
Line 4: Line 4:
  
 
Adapted from the original instructions that this guidance is based on came from [http://www.mscs.dal.ca/~selinger/ups/backups.html here] and [http://billauer.co.il/blog/2010/01/fedora-mustek-powermust-600-ups-nut-howto/ here]. The former, by Peter Selinger, are closest to this case, but a lot of the work he had to do is now done for you out of the box. The latter are for a different UPS, but are also fresher.
 
Adapted from the original instructions that this guidance is based on came from [http://www.mscs.dal.ca/~selinger/ups/backups.html here] and [http://billauer.co.il/blog/2010/01/fedora-mustek-powermust-600-ups-nut-howto/ here]. The former, by Peter Selinger, are closest to this case, but a lot of the work he had to do is now done for you out of the box. The latter are for a different UPS, but are also fresher.
 
  
 
'''NOTE:'''  The Amahi Web Application [http://www.amahi.org/apps/ups-monitor UPS Monitor] provides web monitoring capability..
 
'''NOTE:'''  The Amahi Web Application [http://www.amahi.org/apps/ups-monitor UPS Monitor] provides web monitoring capability..
  
 +
First, do this as [[Open_Terminal_as_root|root user]]:
  
First, do this as [[Open_Terminal_as_root|root user]]:
+
sudo apt-get -y install nut nut-client nut-cgi
{{Code|Code=
 
sudo apt-get -y install nut nut-client nut-cgi
 
}}
 
  
 
Next, you will need to configure four files in /etc/nut: nut.conf, ups.conf, upsd.users, hosts.conf, and upsmon.conf. They will look almost identical to Selinger's (password1 and password2 can be changed to anything):
 
Next, you will need to configure four files in /etc/nut: nut.conf, ups.conf, upsd.users, hosts.conf, and upsmon.conf. They will look almost identical to Selinger's (password1 and password2 can be changed to anything):
{{Code|Code=
 
sudo vi /etc/nut/ups.conf
 
}}
 
  
{{Text|Text=
+
sudo vi /etc/nut/ups.conf
 +
 
 +
<pre>
 
[apc]
 
[apc]
 
         driver = usbhid-ups
 
         driver = usbhid-ups
 
         port = auto
 
         port = auto
 
         desc = "APC Back-UPS"
 
         desc = "APC Back-UPS"
}}
+
</pre>
  
 +
sudo vi /etc/nut/upsd.users
  
{{Code|Code=
+
<pre>
sudo vi /etc/nut/upsd.users
 
}}
 
 
 
 
 
{{Text|Text=
 
 
[admin]
 
[admin]
 
         password = password1
 
         password = password1
Line 40: Line 32:
 
         password = password2
 
         password = password2
 
         upsmon master
 
         upsmon master
}}
+
</pre>
  
 +
sudo vi /etc/nut/hosts.conf
  
{{Code|Code=
+
MONITOR apc@localhost "UPS on HDA"
sudo vi /etc/nut/hosts.conf
 
}}
 
  
{{Text|Text=
 
MONITOR apc@localhost "UPS on HDA"
 
}}
 
  
 
'''NOTE:'''  If using [http://www.amahi.org/apps/ups-monitor UPS Monitor], skip the hosts.conf portion or you will end up with double entries.
 
'''NOTE:'''  If using [http://www.amahi.org/apps/ups-monitor UPS Monitor], skip the hosts.conf portion or you will end up with double entries.
  
{{Code|Code=
+
sudo vi /etc/nut/upsmon.conf
sudo vi /etc/nut/upsmon.conf
 
}}
 
  
{{Text|Text=
+
<pre>
 
MONITOR apc@localhost 1 monuser password2 master
 
MONITOR apc@localhost 1 monuser password2 master
 
MINSUPPLIES 1
 
MINSUPPLIES 1
Line 69: Line 55:
 
NOCOMMWARNTIME 300
 
NOCOMMWARNTIME 300
 
FINALDELAY 5
 
FINALDELAY 5
}}
+
</pre>
 +
 
 +
sudo vi /etc/nut/nut.conf
  
{{Code|Code=
+
MODE=standalone
sudo vi /etc/nut/nut.conf
 
}}
 
  
{{Text|Text=
 
MODE=standalone
 
}}
 
  
 
The next step is to start the UPS service:
 
The next step is to start the UPS service:
{{Code|
 
sudo service ups-monitor stop
 
sudo service ups-monitor start
 
}}
 
  
 +
sudo service ups-monitor stop
 +
sudo service ups-monitor start
  
 
At this point, you should see something like this in your terminal:
 
At this point, you should see something like this in your terminal:

Latest revision as of 03:29, 23 June 2020

Powering Amahi (Ubuntu 12.04) with APC Back-UPS and Network UPS Tools (NUT)

The software APC Back-UPS comes with does not work in Linux. Instead, you need to use NUT or apcupsd. Google will turn up evidence that both work, but NUT seems to be the preferred one.

Adapted from the original instructions that this guidance is based on came from here and here. The former, by Peter Selinger, are closest to this case, but a lot of the work he had to do is now done for you out of the box. The latter are for a different UPS, but are also fresher.

NOTE: The Amahi Web Application UPS Monitor provides web monitoring capability..

First, do this as root user:

sudo apt-get -y install nut nut-client nut-cgi

Next, you will need to configure four files in /etc/nut: nut.conf, ups.conf, upsd.users, hosts.conf, and upsmon.conf. They will look almost identical to Selinger's (password1 and password2 can be changed to anything):

sudo vi /etc/nut/ups.conf
[apc]
        driver = usbhid-ups
        port = auto
        desc = "APC Back-UPS"
sudo vi /etc/nut/upsd.users
[admin]
        password = password1
        actions = SET
        instcmds = ALL
[monuser]
        password = password2
        upsmon master
sudo vi /etc/nut/hosts.conf
MONITOR apc@localhost "UPS on HDA"


NOTE: If using UPS Monitor, skip the hosts.conf portion or you will end up with double entries.

sudo vi /etc/nut/upsmon.conf
MONITOR apc@localhost 1 monuser password2 master
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +0"
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/killpower
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5
sudo vi /etc/nut/nut.conf
MODE=standalone


The next step is to start the UPS service:

sudo service ups-monitor stop
sudo service ups-monitor start

At this point, you should see something like this in your terminal:

Starting UPS monitor (master):                             [  OK  ]

If you do not, it may be because upsdrvctl refuses to cooperate at first. A reboot should fix that problem.