LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (http://www.linuxquestions.org/questions/red-hat-31/)
-   -   Help with apcupsd (http://www.linuxquestions.org/questions/red-hat-31/help-with-apcupsd-659584/)

Rustylinux 07-31-2008 03:50 PM

Help with apcupsd
 
Hello,

This question isn't directly related to Red hat per say since it is a ESX 3.5 system i'm working on but it uses a light weight red hat enterprise 3 kernal so I hope someone here could help me.

I have a APC Smart UPS 750 hooked up to my server and I am trying to get apcupsd to work. I have it shutting down the host server (ESX 3.5 server) just fine however I need to shut down the Vm's running on the machine first. I have written the following script to shut down the VM's and tested it with success, however apcupsds's apccontrol script will not launch my script or any other commands i enter under the doshutdown) function. Here is the code of the script and the doshutdown) function in apcupsd

Shutdown VM script:

#!bin/sh
#
#Shutdown VMs

for vm in `vmware-cmd -l`
do
echo "Shutting down: " $vm
vmware-cmd "$vm" stop trysoft
done

I then added this script to the apccontrol script like this:

doshutdown)
echo "Shutdown VMs"
/etc/apcupsd/vmshutdown
echo "UPS ${2} INITATED sHUTDOWN sEQUENCE" | $WALL}
${SHUTDOWN} -h now "apcupsd UPS ${2} initiated shutdown

Now here is where it gets wierd. the doshutdown function totaly ignores my first 2 commands the echo and the script to shut down my vms and runs the last 2 commands. To make sure the function is triggering properly i commented out the shutdown command and it would shoot out the echo and then not shut down. So the function is triggering but just choosing to ignore my first few lines of code for some reason. I can't seem to make any sence of this. Any help would be greatly appricated.

skoona 07-31-2008 10:13 PM

APCUPSD.com has a mailing list and the guys there should be most helpful. As for your approach; have you considered using the NIS feature of apcupsd. Basically, its an client/server implementation where you configure the copy of apcupsd that is physically connected to the UPS as normal - but with its NIS server enabled (NIS is a apcupsd feature for broadcasting the true use state of other network based servers). Then install a copy of APCUPSD on every server, using the network as the ups_type, and pointing their device statements to the main copy's ip address. Logically all the client copies treat the main copy as if its the ups, and the main copy passes through significant events; so it makes since for the client copies to shutdown faster than the main. I.E. if the main copy will shutdown when the 3 minute battery left point is reached, then the client should shutdown at the 4 minute point, or at least 60 second sooner.


All times are GMT -5. The time now is 03:20 AM.