APC UPS Management on XenServer
Hi,
Today I finally added some management tools for my APC UPS. In my case this means the XenServer can run longer on the UPS and is turned off properly when there is no power left.
Click the read more link to see how to set up apcupsd on XenServer.
First off you need to install apcupsd on your XenServer. I found several posts on the internet stating this wouldn’t work, or you would need to compile several packages extra.
My experience is this: Download the latest apcupsd-xxx-1.el5.i386.rpm from here (Make sure it is the el5 and non-gui rpm).
Install with “rpm -i apcupsd-3.14.7-1.el5.i386.rpm”.
I editted the /etc/udev/rules/50-udev.rules file and added
apcupsd.BUS=”usb”, SYSFS{idVendor}=”051d”, NAME=”usb/hiddev%n”
I’m not really sure this was indeed needed. I will edit this post when I have the time to remove this line and test apcupsd again. (You can try without and let me know your results in the comments)
After this you need to configure apcupsd.
Edit the file /etc/apcupsd/apcupsd.conf with vi
Here you find the user manual with some sample configuration options. This is different for each ups so I can’t explain you this.
Here are some more advanced options (I didn’t need this).
To test your configuration run apcaccess.
If you get a connection refused error try
apcaccess status ipaddress:3551
If you want to be able to use NIS (To read the UPS status from another host / server), you will have to allow the NIS port in the XenServer firewall.
Edit the file /etc/sysconfig/iptables and add the following line after “-A RH-Firewall-1-INPUT -p tcp -m tcp –dport 631 -j ACCEPT”
-A RH-Firewall-1-INPUT -p tcp -m tcp –dport 3551 -j ACCEPT
Then you need to restart iptables with
/etc/init.d/iptables restart
It might also be a good thing to change the listening port in apcupsd.conf to your local network ip address, instead of 0.0.0.0.
This is done by changing the NISIP option.
I will edit this post when I change the shutdownscripts to suspend the virtual machines prior to shutting down.
I did install apcupsd on a 2nd physical server which is running from the same ups. I then configured it to shutdown after running for 5 minutes from battery power. By shutting down the 2nd not so important server, my XenServer has more power to stay online for longer. If you want more information how I configured this on my Windows Server click here.
I just came across this & am quite pleased! This is one of those things that I had been planning on getting to, and this post inspired me. I had been unaware of this utility, so I am happy to say that the minimal configuration was necessary for me and the service is running and properly reporting my usb-ups information.
For newbies, it might be helpful to note a couple of things – this command will list your usb drivers:
# ls -l /sys/bus/usb/drivers
once you have installed the package, you must start the service:
# service apcupsd start
then try
# apcacess
It should output your ups info
I pressume your UPS is connected to your xenserver via USB. So whats the configuration did you set on your xenserver’s apcupsd.conf on your xenserver so that you would be able to shutdown the other server first?
Thanks
@kegler
To shut down another physical server you need to enable NIS (and open the necessary ports in the firewall).
Afterwards you can install apcupsd on the other server and let it connect to the NIS server.
The XenServer part is explained in this post, while the windows part (the nis client) is linked to at the bottom of this post.