m1ghtybob
Contributor
Contributor

Help needed to finish Powerchute configuration on ESXi 4.1

Hi guys,

I am trying to configure Powerchute Network Shutdown so that in the event of a power outage it will gracefully shutdown first our virtual machines and then the hosts themselves.

The instructions I have followed thus far are these:

http://cosonok.blogspot.com.au/2011/12/installing-apc-ups-powerchute-network.html

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=100703...

Now a quick overview of my infrastructure:

3 x ESXi 4.1 Hosts (free version)

1 x APC Smart UPS (with Network Management Card)

I have got the vMA configured and it is up and running.  According to what I've read it should 'just work' once the UPS has kicked in but all I've seen happen is that the vMA itself communicates with the UPS as expected but no virtual servers shutdown nor do the ESXi hosts.

When I log in to the Powerchute Network Shutdown web interface there is a section called 'Configure Shutdown'.  Although the instructions don't indicate anything is really required here, I can't help but feel that this might be where my downfall lay.  Should I be putting something in this section to initiate the shutdown?

pcns-configure.jpg

I am sure it is something really silly that I am missing out on here but it is driving me nuts!  Are you guys able to help shed some light on what it is I have done wrong?

Cheers!

Tags (4)
Reply
0 Kudos
sakibpavel
Enthusiast
Enthusiast

have a look followings article for your kind information..
Sakibpavel
Reply
0 Kudos
m1ghtybob
Contributor
Contributor

That is not very helpful.  As in my Original post, I already tried that.

Reply
0 Kudos
m1ghtybob
Contributor
Contributor

Hi all,

I just wanted to let you know that I have found the solution.  It was referenced on another website

The suggested configuration contained within that blog worked in my environment and I wanted to share it here in the event that if  anyone else happens to have the same issue, they can find the resolution quicker than I could come by it:

Thanks to Canabalooza for his help in this:

Instructions on how to configure PCNS for ESXi (Free Version):

Boot the vMA machine, setup the network settings, and change the vi-admin password from the console window.

At this point I suggest you log out of console and use a telnet  client to connect to the vMA so you can copy/paste commands and avoid  mistakes.

Connected to the vMA virtual machine press Alt+F2 and login as vi-admin with your password.

Download the new ESXi PCNS 3.0 package from the APC website. You can  find it by going to their website and selecting the Software &  Firmware link under Popular Links to the left of the page. Once the page  loads select the "Software Upgrades - PowerChute Network Shutdown" from  the top drop down and click submit. Under the 3.0.0 section click the  download button to the right. Select the download button for the ESXi  package and login to the APC site. Select the download button on the  next page to download the file.

Using SCP or WGET transfer the ESXi PCNS 3.0 package to the new vMA machine. I used /home/vi-admin to avoid permission issues.

Browse to the folder you transferred the package to and extract it from the console window,

tar -xzvf pcns300ESXi.tar.gz

cd ESXi

Run the installer,

sudo ./install_en.sh

Enter your vi-admin password and agree to the license terms.

Press Enter for default install path.

Type Yes and press Enter to install.

Now press Enter to install the included java package.

Next it should ask for the IP and credentials of your ESXi.  You can  press "q" to skip.  If you put your IP in it will still work but you  will get an error that it wasn't able to add and that you should  manually add your host using vifp addserver. This is for vCLI  functionality only and is unimportant when using SOAP.  Just ignore it.

Edit the shutdown.pl file attached to the end of this post and enter your ESXi host credentials.

Use SCP or WGET to transfer the shutdown.pl and shutdown files to the vMA machine.

Still connected the the terminal change to the directory where you  transferred the files, if same location as the PCNS package use,

cd ..

Copy the shutdown.pl and shutdown files to the default setup of PCNS

sudo cp shutdown.pl /opt/APC/PowerChute/group1/bin

sudo cp shutdown /opt/APC/PowerChute/group1/bin

Create a host file and add the ESXi host IP, for multiple hosts use new lines for each IP,

sudo nano -w /opt/APC/PowerChute/group1/bin/host

Contents should look similar,

10.0.0.4

10.0.0.5

Press Ctrl+X to quit nano, Y to save, Enter to keep same file name.

Make sure the files are owned by root and set chmod 0744.

sudo chown root /opt/APC/PowerChute/group1/bin/shutdown

sudo chown root /opt/APC/PowerChute/group1/bin/shutdown.pl

sudo chmod 744 /opt/APC/PowerChute/group1/bin/shutdown

sudo chmod 744 /opt/APC/PowerChute/group1/bin/shutdown.pl

Next configure the ESXi shutdown order. Access the vSphere client, select the ESXi host, then the configuration tab.

Click on the Virtual Machine Startup/Shutdown link. Click properties  at the top right and use "Move Up" to move the VMs in the order you want  leaving the vMA VM at the top. Note that the startup order is the only  one displayed. Shutdown uses the startup list in reverse. If you want  the VMs to start on

their own move them all the way up to Automatic  Startup still leaving the vMA VM at the top.

Connect to the IP of the vMA machine ex. https://10.0.0.9:6547/login  and setup your connection and events as needed. Make sure you remove the  check box in the "Turn off UPS" box under Configure Shutdown unless you  have the "Restart when power is restored" option set on the APC.

To test you can either unplug utility power to your APC and use the  "UPS: On Battery" event or run the following command from the vMA  console window,

cd /opt/APC/PowerChute/group1/bin

sudo ./shutdown.pl host

This will gracefully shutdown the VMs in the order you set before  telling the ESXi host to power down. You should see the shutdown  commands in the log start when connected to the ESXi host with the  vSphere client. Also note that each VM must have VMWare Tools installed  for the shutdown to work gracefully and make sure you give each VM ample  time to power off before your battery power runs out.

NOTE: As pointed out by Andy some hosts have an issue shutting down  the VMs gracefully if you don't touch the order on the startup list. If  you don't want to access the ESXi host with the vSphere client whenever  the power is restored to manually power on the VMs I suggest you move  them all to the Automatic Startup section and setup the APC to power off  at the end of the PCNS shutdown and power back on when power is  restored in the APC settings. You can find the VMWare article here.

Also a note that PCNS and most management cards do NOT accept special characters in the password.  Please see this article on the APC site for details.

Credits to lamw for the SOAP script here.

Reply
0 Kudos
m1ghtybob
Contributor
Contributor

I found the answer myself and referenced the solution inside this thread for others to utilise.

Reply
0 Kudos
spiontek
Contributor
Contributor

Hi m1gthbob, your instructions reference a shutdown file but the only file that I found to download was the shutdown.pl file.  Is there another file that we are missing?  Right now I"m having an issue where I'm getting an error that says "Use of uninitialized value $loglevel in string eq at ./bin/shutdownhost.pl line 59." and the script only shuts down one of my hosts and not the other one.  Will the shutdown file that you reference fix this issue?

Reply
0 Kudos