Changes between Initial Version and Version 1 of VmwareESX41ToSmartUPS


Ignore:
Timestamp:
Nov 18, 2010 4:26:20 AM (13 years ago)
Author:
iva
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • VmwareESX41ToSmartUPS

    v1 v1  
     1
     2== Running APC UPS Daemon on ESX 4.1 Host ==
     3
     4
     51) Connect serial ports on ESX Host and Smart-UPS device with a Smart Signaling Cable (e.g. 940-0024C, or 940-1524C).
     6
     72) Install the {{{apcupsd}}} package built for the Enterprise Linux version corresponding to that of COS.
     8
     9{{{
     10# cat /etc/*-release
     11Red Hat Enterprise Linux Server release 5.1 (Tikanga)
     12VMware ESX 4.1 (Kandinsky)
     13# uname -sri
     14x86_64
     15#
     16# rpm -i apcupsd-3.14.8-1.el5.x86_64.rpm
     17#
     18}}}
     19
     203) Modify the apcupsd run-control script to work around shared library version mismatch.
     21
     22{{{
     23# ldd /sbin/apcupsd
     24/sbin/apcupsd: /usr/lib/vmware/lib64/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /sbin/apcupsd)
     25        libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003926200000)
     26        libcrypto.so.6 => /lib64/libcrypto.so.6 (0x0000003925600000)
     27        libnetsnmp.so.10 => /usr/lib64/libnetsnmp.so.10 (0x0000003925a00000)
     28        libgcc_s.so.1 => /usr/lib/vmware/lib64/libgcc_s.so.1 (0x0000003926800000)
     29        libc.so.6 => /lib64/libc.so.6 (0x0000003924e00000)
     30        /lib64/ld-linux-x86-64.so.2 (0x0000003924a00000)
     31        libdl.so.2 => /lib64/libdl.so.2 (0x0000003925200000)
     32        libz.so.1 => /usr/lib/vmware/lib64/libz.so.1 (0x0000003926600000)
     33#
     34# strings /usr/lib/vmware/lib64/libgcc_s.so.1 |grep GCC_4
     35GCC_4.0.0
     36#
     37# LD_LIBRARY_PATH="/lib64:/usr/lib64:/lib:/usr/lib" ldd /sbin/apcupsd
     38        libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003926200000)
     39        libcrypto.so.6 => /lib64/libcrypto.so.6 (0x0000003925600000)
     40        libnetsnmp.so.10 => /usr/lib64/libnetsnmp.so.10 (0x0000003925a00000)
     41        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002aaaaf3eb000)
     42        libc.so.6 => /lib64/libc.so.6 (0x0000003924e00000)
     43        /lib64/ld-linux-x86-64.so.2 (0x0000003924a00000)
     44        libdl.so.2 => /lib64/libdl.so.2 (0x0000003925200000)
     45        libz.so.1 => /usr/lib64/libz.so.1 (0x00002aaaaf5fa000)
     46#
     47# strings /lib64/libgcc_s.so.1 |grep GCC_4
     48GCC_4.0.0
     49GCC_4.2.0
     50#
     51#
     52# cp -a /etc/rc.d/init.d/apcupsd /etc/rc.d/init.d/apcupsd.orig
     53# vi /etc/rc.d/init.d/apcupsd
     54# diff -U 2 /etc/rc.d/init.d/apcupsd.orig /etc/rc.d/init.d/apcupsd
     55--- /etc/rc.d/init.d/apcupsd.orig       2010-01-18 14:59:07.000000000 -0800
     56+++ /etc/rc.d/init.d/apcupsd    2010-11-15 14:26:19.000000000 -0800
     57@@ -7,4 +7,5 @@
     58 # description: apcupsd monitors power and takes action if necessary
     59 #
     60+LD_LIBRARY_PATH="/lib64:/usr/lib64:/lib:/usr/lib" ; export LD_LIBRARY_PATH
     61 APCPID=/var/run/apcupsd.pid
     62 
     63#
     64}}}
     65
     664) Configure the {{{apcupsd}}} daemon.
     67
     68{{{
     69# cp -a /etc/apcupsd/apcupsd.conf /etc/apcupsd/apcupsd.conf.orig
     70# vi /etc/apcupsd/apcupsd.conf
     71# egrep '^(UPS|DEVICE)' /etc/apcupsd/apcupsd.conf
     72UPSNAME UPS-A
     73UPSCABLE 940-0024C
     74UPSTYPE apcsmart
     75DEVICE /dev/ttyS0
     76UPSCLASS standalone
     77UPSMODE disable
     78#
     79}}}
     80
     815) If need to configure UPS parameters (e.g. the {{{UPSNAME}}}), run the {{{apctest}}} utility.
     82
     83{{{
     84# LD_LIBRARY_PATH="/lib64:/usr/lib64:/lib:/usr/lib" /sbin/apctest
     85}}}
     86
     876) Start the daemon. Make sure it will start again after reboot.
     88
     89{{{
     90# service apcupsd start
     91Starting UPS monitoring:                                   [  OK  ]
     92#
     93# chkconfig apcupsd on
     94# chkconfig --list apcupsd
     95apcupsd         0:off   1:off   2:on    3:on    4:on    5:on    6:off
     96#
     97}}}
     98
     997) Check the UPS status.
     100
     101{{{
     102# service apcupsd status
     103apcupsd (pid 21893) is running...
     104APC      : 001,050,1203
     105DATE     : 2010-11-15 17:29:21 -0800 
     106HOSTNAME : esx41-1
     107VERSION  : 3.14.8 (16 January 2010) redhat
     108UPSNAME  : UPS-A
     109CABLE    : APC Cable 940-0024C
     110MODEL    : Smart-UPS 3000 XL
     111UPSMODE  : Stand Alone
     112STARTTIME: 2010-11-15 14:26:25 -0800 
     113STATUS   : ONLINE
     114LINEV    : 119.5 Volts
     115LOADPCT  :  66.9 Percent Load Capacity
     116BCHARGE  : 100.0 Percent
     117TIMELEFT :  25.0 Minutes
     118MBATTCHG : 5 Percent
     119MINTIMEL : 3 Minutes
     120MAXTIME  : 0 Seconds
     121MAXLINEV : 119.5 Volts
     122MINLINEV : 118.8 Volts
     123OUTPUTV  : 119.5 Volts
     124SENSE    : High
     125DWAKE    : 000 Seconds
     126DSHUTD   : 090 Seconds
     127DLOWBATT : 02 Minutes
     128LOTRANS  : 106.0 Volts
     129HITRANS  : 127.0 Volts
     130RETPCT   : 000.0 Percent
     131ITEMP    : 22.5 C Internal
     132ALARMDEL : 5 seconds
     133BATTV    : 55.4 Volts
     134LINEFREQ : 60.0 Hz
     135LASTXFER : Automatic or explicit self test
     136NUMXFERS : 0
     137TONBATT  : 0 seconds
     138CUMONBATT: 0 seconds
     139XOFFBATT : N/A
     140SELFTEST : NO
     141STESTI   : 336
     142STATFLAG : 0x07000008 Status Flag
     143REG1     : 0x00 Register 1
     144REG2     : 0x00 Register 2
     145REG3     : 0x00 Register 3
     146MANDATE  : 03/09/10
     147SERIALNO : AS1011290020
     148BATTDATE : 03/09/10
     149NOMOUTV  : 120 Volts
     150NOMBATTV :  48.0 Volts
     151EXTBATTS : 0
     152FIRMWARE : 691.19.D
     153APCMODEL : FWD
     154END APC  : 2010-11-15 17:29:44 -0800 
     155#
     156}}}
     157
     1588) If there are slave APCUPSd servers on the the LAN (or want to run the {{{multimon}}} CGI script on a separate host/virtual machine), allow remote connections to the //NIS// service by creating an opening {{{(tcp#3551)}}} in the host firewall.
     159
     160{{{
     161# esxcfg-firewall --ipruleAdd 10.4.8.32/27,3551,tcp,ACCEPT,"apcupsd"
     162#
     163# esxcfg-firewall -q |grep 3551
     164    4   168 ACCEPT     tcp  --  *      *       10.4.8.32/27         0.0.0.0/0           tcp dpt:3551
     165        apcupsd             : host 10.4.8.32/27 cport 3551 ACCEPT tcp
     166#
     167}}}
     168
     1699) Install MTA ({{{Postfix}}}) and MUA ({{{/bin/mail}}}) for being able to get notifications about power failures, and such.
     170
     171{{{
     172# rpm -i --nodeps postfix-2.3.3-2.1.el5_2.x86_64.rpm
     173# rpm -i mailx-8.1.1-44.2.2.x86_64.rpm
     174}}}
     175
     17610) Create the {{{doshutdown}}} script that will attempt graceful shutdown of all active virtual machines, and then will put host into the //Maintenance Mode//.
     177
     178{{{
     179# vi /etc/apcupsd/doshutdown
     180#
     181# pr -to3 /etc/apcupsd/doshutdown
     182   #!/bin/sh
     183   #
     184   # doshutdown - attempt graceful shutdown of all running VMs
     185   #
     186   SYSADMIN=root
     187   MAIL_CMD=/bin/mail
     188   VMWARE_CMD=/usr/bin/vmware-cmd
     189   #DO_CMD=echo
     190   DO_CMD=eval
     191   HOSTNAME=`uname -n | tr '[a-z]' '[A-Z]'`
     192   MSG="Initiating VM shutdown on the $HOSTNAME host"
     193   #
     194   ( echo "$MSG" ; echo ; /sbin/apcaccess status ) |\
     195     $MAIL_CMD -s "$MSG" $SYSADMIN
     196   
     197   $VMWARE_CMD -l |(while read vm; do
     198     vm="`echo $vm |sed -e 's/ /\\\\ /g'`"
     199     if [ -n "$vm" ]; then
     200       case `eval $VMWARE_CMD $vm getstate` in
     201         "getstate() = on") $DO_CMD "$VMWARE_CMD $vm stop trysoft" ;;
     202       esac
     203     fi
     204   done)
     205   /usr/bin/vmware-vim-cmd /hostsvc/maintenance_mode_enter
     206   exit 0
     207   
     208   ### End-Of-File
     209#
     210# chmod 744 /etc/apcupsd/doshutdown
     211#
     212}}}
     213
     214
     215=== See Also ===
     216
     217http://www.apcupsd.org/ \\ Apcupsd, a daemon for controlling APC UPSes
     218