Shutdown VMware ESXi Virtualization Server on UPS Power Off

A little introduction



Doctors often have similar stories, in childhood they were ridiculed because of crooked teeth - I became a dentist, there were complexes due to acne - I became a dermatologist. The situation here is similar in that I searched for information for a long time, printed and re-read it on paper ( so that my eyes would not get tired ), but I found a solution only in English-language sources, the documentation sent by the software developers was also in English, the information was taken partially from him. When I did everything, I realized that I wanted to share my solution. There is such software ( operating system ) for installing on a server and deploying virtual machines on it, called VMware ESXi,there was a need to make sure that when the light is turned off, the servers are not turned off, thereby endangering the databases that work there. So, to warn this, a UPS was bought, an SNMP card (for monitoring it) I collected the rest from the Internet and decided to try to revive it all.



The following components will be needed



1. Uninterruptible power supply ( hereinafter UPS );

2. Network SNMP card for the UPS, for its monitoring and control ( hereinafter SNMP card );

3. Installed and functioning VMware ESXi hypervisor - installed directly on the server itself ( as an operating system ) or on a virtual machine ( hereinafter virtualization server );

4. Clientmate package - for monitoring the UPS and in the event of a power outage and the transition of the UPS to batteries - timely, correct termination of virtualization servers, also installed on it virtual machines ( hereinafter Clientmate);

5. File manager for WinSCP servers that works with SCP, SFTP protocols ( hereinafter WinSCP );

6. Client for network protocols Putty ( hereinafter Putty );



Attention



In order to avoid incompatibility of SNMP card with Clientmate software - it is strongly recommended to check it on the developer's website or write a letter to them by mail, indicating the model and asking to check for compatibility with your SNMP card.



Despite the fact that the article describes the process as clearly as possible - nevertheless, deep explanations of the tools, protocols, actions are not given in order not to clutter up the material, it is also possible that not everything will turn out exactly as on the tutorial (the difference is working software, hardware, as well as their condition ). It is assumed that the virtualization server is functioning properly and that the specialist has basic knowledge in this area, or at least ( which is also not bad ) read about the purpose and principle of operation of the VMware ESXi hypervisor and other tools given in this tutorial, and then, through logic and search for information, you can understand what and how.



Installation will be done on the basis



System: ( hypervisor ) VMware ESXi 6.5 virtualization server;

SNMP network card: Megatec HDL801;

The installation directory, for example, will be called: mydata



1. Installation of the UPS itself



Insert the SNMP card into the UPS, turn it on, connect to the local network, on the PC that will be used during the installation process - install the Netility utility ( for the initial configuration of the SNMP card ) interface intuitive, set the IP address, to be sure, it will not be superfluous to test the operation by connecting to the UPS through a browser, the setup is completed.



2. Preparing Clientmate



Unpack the Clientmate archive, rename the folder to clientmate_install, open the install.clientmate file inside, change the path where Clientmate will be installed, specifying the name of the directory, for example: mydata ( after volumes / )



image


the name of the directory can be viewed in Putty by following the path cd vmfs / volumes and displaying the contents of the directory with the ls command , or in the web interface of the virtual machine, by going to the storage tab, save the file. Pre-enable SSH on the virtual machine, in the web interface (may differ depending on the version)



image


Next, you need to copy the prepared folder from Clientmate to the virtual machine, for installation, open the WinSCP file manager, enter the IP address, login, password of the virtualization server and connect to it, a normal, understandable file manager will open



image


go to the directory mydata, which was corrected at the top and copy the prepared folder with Clientmate there.



3. Installing Clientmate



Connect via Putty to the virtual machine, in the console go to the folder of the directory cd vmfs / volumes / mydata , display the contents by typing ls , among other things, the folder with Clientmate that you copied will be displayed, go to it cd clientmate_install / , set the rights to the chmod 755 setup file ./install.clientmate



image


install ./install.clientmate , type y when asked , press Enter when the installation is complete . Installation of Clientmate is now complete, then the primary configuration will open



image


1. The time of the virtual machine shutdown, when the power is turned off and the UPS switches to batteries: it is selected individually, depending on how long it takes to save the files opened on the virtual machines, before they start turning off;

2. Urgent shutdown, when the battery charge is low: it is recommended to set it as low as possible, so that disconnecting the server from the power supply does not disrupt the operation of the software running on virtual machines;

3. If you need to shutdown the UPS itself, specify the time for which the UPS will start shutting down (counting from the moment the virtual machines are shut down) ;

4. Switch to IP2 by pressing the corresponding letter and write the same as in IP1;

5. public;

6.IP Address: IP SNMP card UPS;

7. SNMP card version: if the UPS is protected by a login, password (set if the UPS is visible from the Internet) then select V3 and write down the login and password, otherwise you can choose V1

Save the configuration.



Go to the folder with installed Clientmate, in a way that is already familiar to us.



Commands for managing Clientmate:



./clientmate config - opens the Clientmate configuration, can be configured (make adjustments or if something has changed)

./clientmate start - enables Clientmate

./clientmate stop - disables Clientmate accordingly

./clientmate status - shows state



4. Configuring the virtualization server



Go to the file for communication with SNMP devices, along the vi /etc/vmware/snmp.xml path, write access to the SNMP card there



image


can be in a line, but formatting in the xml style would be a good form, save the configuration, exit the file and restart the service: /sbin/services.sh restart.



Check the Clientmate operation, go to the directory with the Clientmate installed and call ./clientmate status, if the configuration was successful - in the status window, the following values ​​should appear about the connection to the UPS:



image


To configure the shutdown of virtual machines installed on the (main) virtual machine itself, download Clientmate for the required OS from the developer's site, install, configure, the main settings for Clientmate Windows are shown below



image


If you find errors, misunderstandings or additions to the material - please write in the comments



All Articles