To run apcupsd with a SNMP UPS, you need the following things:
SNMP packet requests are relayed to the UPS from monitoring APCUPSD servers over Ethernet via a switch, hub, or router. Protecting these Ethernet devices with UPS supplied power is necessary to ensure reliable SNMP communication during power failures. Servers may fail to shutdown quietly during power failures if SNMP communication is lost.
The following instructions come from the APC knowledge base:
The Network Management Card (AP9617, AP9618, AP9619) must be configured with network settings before it can communicate on the network. Once the cards have been configured with an IP address, Subnet Mask, and Default Gateway the cards can be access, managed, and controlled from other computers on the network.
There are two ways to configure the Network Management Card (NMC) with its initial settings: the (windows) Wizard and Address Resolution Protocol (ARP).
1. The wizard in included on the CD that comes with the card. The wizard must run on a Windows operating system. You can configure the card using the wizard over the network via FTP. If using the wizard please note, the un-configured NMC must be on the same subnet as the computer running the wizard.
2. Address resolution protocol (arp) can also be used to configure the NMC. The MAC Address of the NMC is needed for this method of configuration. The MAC address is located on the quality assurance slip that is shipped with the NMC, and is also located on the white sticker on the NMC itself. From a computer on the same subnet as the un-configured NMC, follow the instructions:
Open up a command prompt and type the following (replacing <IPaddress> and <MacAddress> with the actual values):
arp -s <IPaddress> <MacAddress>
Next, use Ping with a size of 113 bytes to assign the IP address defined by the ARP command.
~$ telnet <IPaddress>
Login using "apc" for both the username and password and the following menu will display:
******************************************************************************* American Power Conversion Network Management Card AOS v2.6.4 (c) Copyright 2004 All Rights Reserved Smart-UPS & Matrix-UPS APP v2.6.1 ------------------------------------------------------------------------------- Name : Date : 07/03/2006 Contact : Time : 04:43:33 Location : User : Administrator Up Time : 0 Days 01 Hours 57 Minutes Stat : P+ N+ A+ Smart-UPS 1000 named : On Line, No Alarms Present ------- Control Console ------------------------------------------------------- 1- Device Manager 2- Network 3- System 4- Logout <ESC>- Main Menu, <ENTER>- Refresh, <CTRL-L>- Event Log > *******************************************************************************
Select Option 2 for Network. Next select Option 1 for TCP/IP settings.
At this point the following settings will be to be specified:
Specifying these parameters will complete the General Parameters setup. Additionally the SNMP Network Management Card can now be connected to from a web browser for monitoring and additional configuration.
There are two shutdown parameters that must be set in the SNMP card to ensure that connected servers shutdown quietly. These parameters can be set via the telnet terminal or the web browser interface.
One of the draw-backs of SNMP communication to the UPS is that the Stand-alone or Primary server must issue the power down command to the UPS early in server halt procedure. This server must issue an early command to the SNMP UPS to power down before its ethernet service is halted. This creates a potential problem where the UPS may kill power to any connected servers before these affected servers' halt scripts complete a successful shutdown.
The SNMP Shutdown Delay parameter is used to delay the UPS from killing power to its load by a prescribed period of seconds. The delay should be long enough to ensure that the Stand-alone or Primary server has enough time to successfully halt. The prescribed time should at least be 180 seconds. Any additional computers connected to the SNMP UPS must not be configured to issue the command to initiate UPS power down. These servers can be thought of as secondary stand-alone server. The APCUPSD daemons of secondary servers should be configured to initiate server halt a prescribed period of time before the Primary server issues the UPS power down command.
The Return on Battery Capacity is useful during intermittent sequential power failures. This parameter insures that the UPS will not restore power to its loads until it has recharged it battery to a prescribed percentage. This parameter should be set to a value greater than value that the APCUPSD daemons configured "BATTERYLEVEL" shutdown of any connected servers. This will ensure that when the UPS restores power, any additional power failures will successfully re-trigger a server shutdown.
By default, APCUPSD will poll the SNMP UPS card once per minute. In this case, server notification of UPS alarms could potentially be delayed one minute. Event trap catching mitigates this shortcoming. Any UPS alarms are instantly sent to prescribe servers connected SNMP UPS. These servers are referred to as Event Trap Receivers. The SNMP UPS card can be configure to send event traps to a maximum of four receivers that will "catch" these events.
Event trap receivers IP address can be set using a telnet terminal or web browser interface.
Also, be aware that servers configured to be Event Trap Receivers should have static IP set. Severs obtaining IPs from DHCP server will not catch instantaneous Events if the IP address changes from the address set in the SNMP UPS.
The previous sections describe configuration of the actual SNMP card. The remaining sections describe configuration of the APCUPSD to communicate using SNMP Protocol.
The Simple Network Management Protocol provides an interface to connect to remote devices through the network. apcupsd is now capable of using the SNMP interface of an SNMP-enabled UPS to communicate with an UPS. Currently apcupsd supports only APC's PowerNet MIB. To enable the SNMP support it is enough to configure the correct device in your apcupsd.conf configuration file. The directive needed for this configuration is:
DEVICE 192.168.100.2:161:APC:private
Where the directive is made by four parts:
If more than one server is connected to the UPS the following configuration types still apply to SNMP enable UPS. (see Choosing a Configuration Type). A NIS Server/Client (Master/Slave) configuration with multiple servers is still applicable.
However, an alternative configuration is possible with an SNMP enabled UPS. In this arrangement, all connected servers will be configured as a standalone server. Each will independently communicate to the UPS. One (primary) server will be chosen to manage the task of commanding the UPS to power down. All remaining (secondary) servers will be configured to quietly power down before the primary server issues the UPS power down command.
Follow the instructions in Building and Installing apcupsd, being sure to include the following options (in addition to any others you need) on the ./configure line:
./configure \ --with-serial-dev=<your-SNMP-device> \ --with-upstype=snmp \ --with-upscable=smart \ --enable-snmp
apcupsd-3.11.14 introduces support for SNMP trap catching with the APC PowerNet MIB driver. Previous versions polled the UPS status once per minute, leading to significant delays before UPS state changes were recognized. With SNMP trap handling, apcupsd monitors the SNMP trap port and will re-poll the UPS whenever a trap is received. This happens, for example, when the UPS switches on or off battery.
In order for this feature to work, you must configure your UPS to deliver traps to the server running apcupsd. This is generally done by connecting to your SNMP card via a web browser or telnet connection. You will need to enter your server's IP address as a trap receiver and make sure trap delivery is enabled.
Trap catching can lead to problems if you are already running another SNMP trap daemon on your server. Only one daemon can listen to the trap port, so whichever one is started first will succeed and the others will fail. Apcupsd will fall back to polling behavior if it is unable to open the trap port. You can also forcibly disable trap catching by setting your vendor string in the apcupsd.conf DEVICE directive to "APC_NOTRAP".
Currently (as of 3.10.0) the code to power off the UPS needs special configuration. The killpower command for SNMP UPSes can not be issued during shutdown as typically at some time during shutdown operations the network stack is stopped. To overcome this problem it is needed to modify the /etc/rc.d/apcupsd system control script to tell apcupsd to issue the power down command (killpower) to the UPS immediately before apcupsd initiates the system shutdown. For this reason it is paramount to set your UPS grace time to a value greater than 120 seconds to allow for clean shutdown operations before the UPS removes the power from its plugs. To enable correct shutdown operation during powerdown do the following:
With this setup your UPS operations should be safe.