Changes

From SME Server
Jump to navigationJump to search
Line 1: Line 1:  
{{Level|Medium}}
 
{{Level|Medium}}
==Installation of Latest Version==
+
==Installation of apcupsd==
 +
===Introduction===
 
Apcupsd can be used for power management and controlling most of APC's UPS models on Unix and Windows machines. Apcupsd works with most of APC's Smart-UPS models as well as most simple signalling models such a Back-UPS, and BackUPS-Office. During a power failure, apcupsd will inform the users about the power failure and that a shutdown may occur. If power is not restored, a system shutdown will follow when the battery is exhausted, a timeout (seconds) expires, or runtime expires based on internal APC calculations determined by power consumption rates. Apcupsd is licensed under the GPL version 2.  
 
Apcupsd can be used for power management and controlling most of APC's UPS models on Unix and Windows machines. Apcupsd works with most of APC's Smart-UPS models as well as most simple signalling models such a Back-UPS, and BackUPS-Office. During a power failure, apcupsd will inform the users about the power failure and that a shutdown may occur. If power is not restored, a system shutdown will follow when the battery is exhausted, a timeout (seconds) expires, or runtime expires based on internal APC calculations determined by power consumption rates. Apcupsd is licensed under the GPL version 2.  
   −
The latest version of ''apcupsd'' is 3.14.8-1 (January 2010) and is available from sourceforge in two rpms - one for the UPS daemon and one for the web based monitoring scripts. Neither of these install exactly in line with the ''SME way'', and neither does the older version available on DAG.
+
The latest version of ''apcupsd'' is 3.14.10-1 (2011-10-04) and is available from sourceforge in two rpms - one for the UPS daemon and one for the web based monitoring scripts. Neither of these install exactly in line with the ''SME way'', and neither does the older version available on DAG.
   −
These installation instructions make some additional modifications for SME. They have been tested on SME 7.5 and an APC SmartUPS 1500i with both a usb and a 940-0024C smart serial cable. They have also been tested with an AP9617 Network Management Card using both the ''snmp'' and ''pcnet'' UPSTYPE drivers'
+
These installation instructions make some additional modifications for SME. They have been tested on:
{{Note box|SME uses Nut as standard for UPS monitoring and control and works with a more than just APC UPS models. See [[Uninterruptable_Power_Supply]] for details }}
+
- SME 7.5 and an APC SmartUPS 1500i with both a usb and a 940-0024C smart serial cable.  
 +
- SME 7.5.1 and an APC BackUPS BR800 with a usb cable.
 +
- AP9617 Network Management Card using both the ''snmp'' and ''pcnet'' UPSTYPE drivers'
 +
 
 +
{{Note box|SME uses Nut as standard for UPS monitoring and control and works with more than just APC UPS models. See [[Uninterruptable_Power_Supply]] for details }}
 
===Download and install===
 
===Download and install===
Get the rpms from sourceforge
+
Get the rpms from [http://sourceforge.net/projects/apcupsd/files/rpms%20-%20Stable/3.14.10/ APCUPSD sourceforge]
 
  −
wget https://sourceforge.net/projects/apcupsd/files/rpms%20-%20Stable/3.14.8/apcupsd-3.14.8-1.el4.i386.rpm/download
  −
wget https://sourceforge.net/projects/apcupsd/files/rpms%20-%20Stable/3.14.8/apcupsd-multimon-3.14.8-1.el4.i386.rpm/download
      +
wget http://sourceforge.net/projects/apcupsd/files/rpms%20-%20Stable/3.14.10/apcupsd-3.14.10-1.el5.x86_64.rpm/download
 +
wget http://sourceforge.net/projects/apcupsd/files/rpms%20-%20Stable/3.14.10/apcupsd-multimon-3.14.10-1.el5.x86_64.rpm/download
 +
 
Install with yum
 
Install with yum
  yum localinstall apcupsd-3.14.8-1.el4.i386.rpm apcupsd-multimon-3.14.8-1.el4.i386.rpm
+
  yum localinstall apcupsd-3.14.10-1.el5.x86_64.rpm apcupsd-multimon-3.14.10-1.el5.x86_64.rpm
    
===Configure apcupsd===
 
===Configure apcupsd===
Line 89: Line 94:  
Continue as above in the ''Configure apcupsd'' section - but note the requirements in the ''snmp and pcnet Killpower'' section below.
 
Continue as above in the ''Configure apcupsd'' section - but note the requirements in the ''snmp and pcnet Killpower'' section below.
 
=====snmp and pcnet Killpower=====
 
=====snmp and pcnet Killpower=====
 +
The standard rpm install copies the ''/etc/init.d/halt'' script to ''/etc/init.d/halt.old'' and then inserts the following code fragment near the end just after the file systems are remounted read only.
 +
# See if this is a powerfail situation.                              # ***apcupsd***
 +
if [ -f /etc/apcupsd/powerfail ]; then                                # ***apcupsd***
 +
    echo                                                              # ***apcupsd***
 +
    echo "APCUPSD will now power off the UPS"                          # ***apcupsd***
 +
    echo                                                              # ***apcupsd***
 +
    /etc/apcupsd/apccontrol killpower                                  # ***apcupsd***
 +
    echo                                                              # ***apcupsd***
 +
    echo "Please ensure that the UPS has powered off before rebooting" # ***apcupsd***
 +
    echo "Otherwise, the UPS may cut the power during the reboot!!!"  # ***apcupsd***
 +
    echo                                                              # ***apcupsd***
 +
fi                                                                    # ***apcupsd***
 +
 +
Thus for normal operation with a USB or serial cable, a killpower instruction is sent to the UPS just before the server powers down. The UPS then waits for the DSHUTD (Delayed shutdown) period (usually 60 or 90 seconds) and powers off, by which time the final server shutdown and power off should be complete.
    +
With the ''snmp'' and ''pcnet'' UPSTYPE however, communication is across the network and the ''/etc/init.d/halt'' script will have killed the network service before the above code instructs the UPS to power down. In order for the UPS to receive a ''killpower'' signal therefore it is necessary to edit ''/etc/init.d/halt'' and move the code fragment shown above to nearer the beginning of the script, inserting it as below.
 +
case "$1" in
 +
    *start)
 +
        ;;
 +
    *)
 +
        echo $"Usage: $0 {start}"
 +
        exit 1
 +
        ;;
 +
esac
 +
 +
# See if this is a powerfail situation.                              # ***apcupsd***
 +
if [ -f /etc/apcupsd/powerfail ]; then                                # ***apcupsd***
 +
    echo                                                              # ***apcupsd***
 +
    echo "APCUPSD will now power off the UPS"                          # ***apcupsd***
 +
    echo                                                              # ***apcupsd***
 +
    /etc/apcupsd/apccontrol killpower                                  # ***apcupsd***
 +
    echo                                                              # ***apcupsd***
 +
    echo "Please ensure that the UPS has powered off before rebooting" # ***apcupsd***
 +
    echo "Otherwise, the UPS may cut the power during the reboot!!!"  # ***apcupsd***
 +
    echo                                                              # ***apcupsd***
 +
fi                                                                    # ***apcupsd***
 +
 +
# Kill all processes.
 +
[ "${BASH+bash}" = bash ] && enable kill
 +
 +
runcmd $"Sending all processes the TERM signal..." /sbin/killall5 -15
 +
sleep 5
 +
runcmd $"Sending all processes the KILL signal..."  /sbin/killall5 -9
 +
 +
The UPS will therefore be instructed to power down before the network service is terminated.
 +
 +
This is much earlier in the server shutdown process however and it is important to set the shutdown delay to at least 180 seconds i.e. greater than the time it actually takes your SME server to shutdown following a halt signal. Therefore via the NMC web browser interface goto the ''UPS'' tab and under ''Configuration - Shutdown'' select the appropriate value for ''Shutdown Delay'' of 180 seconds or greater.
 
===Usage of apcupsd===
 
===Usage of apcupsd===
 
The file ''/etc/apcupsd/apcupsd.conf'' controls the configuration of the apcupsd daemon and is well documented. In addition to this ''/etc/apcupsd/apccontrol'' is called by the daemon whenever a UPS event occurs, and determines the standard action taken. User configurable actions can be taken by creating/editing files in /etc/apcupsd with names corresponding to relevant events, and these are called first by ''apccontrol''. For example, a file called ''onbattery'' will be called by ''apccontrol'' whenever an ON BATTERY event occurs, and if ''onbattery'' returns an exit code of 99, then ''apccontrol'' will not take its own default action.
 
The file ''/etc/apcupsd/apcupsd.conf'' controls the configuration of the apcupsd daemon and is well documented. In addition to this ''/etc/apcupsd/apccontrol'' is called by the daemon whenever a UPS event occurs, and determines the standard action taken. User configurable actions can be taken by creating/editing files in /etc/apcupsd with names corresponding to relevant events, and these are called first by ''apccontrol''. For example, a file called ''onbattery'' will be called by ''apccontrol'' whenever an ON BATTERY event occurs, and if ''onbattery'' returns an exit code of 99, then ''apccontrol'' will not take its own default action.
Line 242: Line 293:  
====Setup the DAG repository====
 
====Setup the DAG repository====
   −
{{Repository|Dag}}
+
You need to activate the [[Dag]] reposity before installing this contrib.<br />
 +
 
 +
see [[dag|dag repository]] <br />
    
====Installation====
 
====Installation====
Line 249: Line 302:     
Copy original ''conf'' file
 
Copy original ''conf'' file
  cp apcupsd.conf apcupsd.conf.orig
+
  cp /etc/apcupsd/apcupsd.conf /etc/apcupsd/apcupsd.conf.orig
    
Copy ''CGI'' files
 
Copy ''CGI'' files
22

edits

Navigation menu