ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    XenServer and APC UPS protection

    IT Discussion
    xenserver ups apc protection vms windows
    4
    25
    4.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • BRRABillB
      BRRABill @DustinB3403
      last edited by

      @DustinB3403

      This is what I started playing with. Have you seen this yet?

      Comes with a script and everything.

      https://pantsmanuk.org/2015/04/apcupsd-running-on-citrix-xenserver-7-0/

      DustinB3403D 1 Reply Last reply Reply Quote 0
      • DustinB3403D
        DustinB3403 @BRRABill
        last edited by

        @BRRABill said in XenServer and APC UPS protection:

        @DustinB3403

        This is what I started playing with. Have you seen this yet?

        Comes with a script and everything.

        https://pantsmanuk.org/2015/04/apcupsd-running-on-citrix-xenserver-7-0/

        I haven't seen that, but I will definitely take a look, nice find.

        1 Reply Last reply Reply Quote 0
        • DustinB3403D
          DustinB3403
          last edited by DustinB3403

          Here is the original article that PantsManUK converted for his installation. The article is from 2013, so it is is out of date. This is very much worth trying. If I get the chance I'll test it in my lab at home.

          Quoted from with pertinent parts highlighted from

          Citrix Xenserver does not include UPS / UPS services or setting options.

          The Windows version:

          From a host with Xencenter installed, The following command posted to shut down a VM:

          Xe.exe -s <XenServer-IP> -u root -pw password vm-shutdown vm = VM name
          However, why should a VM host system be dependent on another Windows host for a shutdown in case of power failure?

          My conclusion: NOT recommended, if UPS can be operated directly at the Xenhost (USB, Network or Serial connection)

          The Linux variant:

          In Linux, the apcupsd solution is called , which is actually contained in each distribution, or can be installed by repository. Stupid only the Xenserver (stripped down CentOS) is not the case. However, it is possible to manually install and customize the RPM package from the official CentOS repository on the Xenserver. However, in order to shut down the VM guests, mail notification, message in the Xencenter, several steps, more precisely script adaptions are required.

          Apcupsd at the Xenserver, an overview:

          Apcupsd, Daemon from CentOS
          Apcupsd.conf, customized configuration file, calls vm_shutdown.sh, log entry in Xencenter application.
          Vm_shutdown.sh, Shutdown of all VM guests on the local Xenserver (only local VMs if Xenserver in pool !!)
          Sendemail, package for simple SMTP sending the UPS status mails
          Mailconfigs, changeme; commfailure; commok; offbattery; onbattery; sendemail.conf

          Xenserver apcupsd Installation Instructions (Using Tar File):

          As always, "at your own risk", the operation of a Linux host with shell commands should be common ๐Ÿ˜‰

          1. Download the tar file to the Xenhost

          Cd ~
          mkdir apc
          cd apc`````` wget http://www.flurweg.net/linux/xenserver/apcupsd/xenserver6_apcupsd.tar
          2. Unpack files

          Tar xvf xenserver6_apcupsd.tar
          3. Installing apcupsd

          Yum localinstall -nogpgcheck apcupsd-3.14.10-1.el5.i386.rpm
          3. Error message in Xenserver version 6.2: Error: Can not find a valid base for repo: citrix

          Solution: Open the /etc/yum.repos.d/Citrix.repo file and temporarily disable this repository:

          [ 
          Citrix ] name = XenServer 6.2.0 updates 
          mirrorlist = http: //updates.vmd.citrix.com/XenServer/6.2.0/domain0/mirrorlist #baseurl 
          = http: //updates.vmd.citrix.com/XenServer/ 6.2.0 / domain0 / 
          gpgcheck = 1 
          gpgkey = http: //updates.vmd.citrix.com/XenServer/RPM-GPG-KEY-6.2.0 
          enabled = 0
          
          1. Back up the existing / original configuration files

          Mkdir -p /etc/apcupsd/org
          cp /etc/apcupsd/ * /etc/apcupsd/org
          5. Copy the new configuration files (overwrite: YES [y])

          Cp -f /etc/apcupsd/ * /etc/apcupsd/
          6. Customize the mail settings in /etc/apcupsd/sendemail.conf

          Nano /etc/apcupsd/sendemail.conf
          7. Install the Sendemail

          Cp usr /bin/sendemail/usr/bin/sendmail
          chmod + x /usr/bin/sendemail
          8. Testing the notification via e-mail, for example. With:

          Sh /etc/apcupsd/changeme
          9. Customize the apcupsd.conf configuration

          (The included apcupsd.conf is configured for a Smart APC-650 via USB interface)

          About apcupsd:

          UPS Check communication, output values:

          Apcaccess
          Configure APC UPS:

          Apctest
          However, the service has to be terminated before, (do not forget after the configuration!)

          /etc/init.d/apcupsd stop
          apctest
          /etc/init.d/apcupsd start
          Other tips:

          Xenserver firewall, unblock port:

          If you want to read the values โ€‹โ€‹of the UPS connected to the Xenserver (NISIP) from another Linux host with installed CGI-Multimon, the Xenserver firewall stands in the way. You must open Tcp Port 3551 by editing the / etc / sysconfig / iptables file, the line: "-A RH-Firewall-1-INPUT -p tcp -m tcp -dport 631 -j ACCEPT" and Reinsert it. Change the port to 3551 in this copied line:

          -A RH firewall-1-INPUT -p tcp -m tcp -dport 3551 -j ACCEPT
          Then restart the iptables service:

          /etc/init.d/iptables restart
          On the Multimon host under /etc/apcupsd/hosts.conf enter the Xenserver IP.

          APCUPSD Multimon on Debian host with lighttpd:

          Installation:

          Apt-get install lighttpd apcupsd-cgi
          CGI on lighttpd Enable web server:

          Lighty-enable-mod cgi
          Cgi-bin Create symlink:

          Ln -s /usr/lib/cgi-bin/ /var/www/cgi-bin
          Create short line with redirection:

          Mkdir /var/www/apc
          /var/www/apc
          nano index.html
          The directory /var/www/apc creates an "index.html" with the following content:

          Enter the Xenserver Host into the Multimon Page in the /etc/apcupsd/hosts.conf file:

          MONITOR 192.168.8.6 "Xenserver"

          travisdh1T 1 Reply Last reply Reply Quote 0
          • travisdh1T
            travisdh1 @DustinB3403
            last edited by

            @DustinB3403 That's a lot of stuff to do rather than just fixing the /etc/yum.repos.d/CentOS-Base.repo file. The line

            mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
            

            needs replaced. For XS7

            mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os
            

            Then you just need to run

            yum --enablerepo=base install apcupsd sendmail
            
            1 Reply Last reply Reply Quote 0
            • BRRABillB
              BRRABill
              last edited by

              The link is more recent, because he mention XS 7.

              I got acancel AARP (done, should have check by 4/13 and no mailings by 6 weeks from 3/16)I got about 50% of the way into this, and had to move on to other projects. But I really need to get back to it.

              1 Reply Last reply Reply Quote 1
              • 1
              • 2
              • 2 / 2
              • First post
                Last post