A client is currently implementing Citrix XenServer 5.0 and had hit a snag trying to get the new XenServer hosts communicating with their APC UPS. They had read How to Integrate XenServer and APC PowerChute but the example given is very basic and not dynamic; the script needs to know the pool master and the names of all your VMs. But the script was a great starting point and with the XenServer CLI documentation I was able to create a dynamic shutdown script.
The script runs on a physical box with XenCenter (or at least with the command line xe tool). A username, password and two XenServer IP addresses are specified in the script. Why two XenServer IPs? In case the first XenServer is down/has changed IP etc – a basic fall back plan. When the script runs it disables all hosts in the pool, shutsdown all the VMs in the pool and finally shutsdown all the hosts in the pool.
For this particular client they have the APC software installed on the same physical box as XenCenter and have configured the software to run this script when the UPS reaches a critical level.
Download the script here and use as you please – just leave my details at the top.
Deptive - Commercial Bay
11-19 Customs Street West St
Commercial Bay Tower, Level 17, Room 1715
We also have a virtual office in Wellington.
0800 000 141
PO Box 34797,
Birkenhead, Auckland 0746