Monday, January 19, 2015

MonitorEsxiVMS

http://blogs.vmware.com/smb/2013/12/back-to-basics-managing-vmware-esxi-5-5-direct-user-interface-dcui.html


Managing VMware ESXi 5.5 Direct Console User Interface (DCUI)

Post By Mike Laverick, VMware, Senior Cloud Infrastructure Evangelist
This is a repost from Mike Laverick’s blog, mikelaverick.com
Well, it’s time for another post in my all-new “back to basics” series. That’s my term for wiping down my lab environment and deploying vSphere5.5 – and trying to reacquaint myself with all that vSphere knowledge that was once at my finger tips. This time its the turn of the DCUI.
The Direct Console User Interface (DCUI) is the front-end management system that allows for some basic configuration changes and troubleshooting options should the VMware ESXi host become unmanageable via conventional tools such as the vSphere Client or vCenter.
Screen Shot 2013-10-21 at 13.24.32.png
Typical administration tasks include:
  • Reset ‘root’ password
  • Configure Lockdown mode
  • Configure, Restart, Test and Restore the VMware ESX Management Network
  • Restart Management Agents
  • Configure Keyboard
  • Troubleshoot
  • View System Logs
  • Reset System Configuration (Factory Reset)
  • Shutdown/Restart the VMware ESX Host
Most actions are carried out by using [F2] on the keyboard or [F11] confirm changes, along with typical options such as [Y] and [N] to various system prompts. Before carrying out any task you will be required to supply the ‘root’ password. However, the first law of security is to secure the physical server – so take care to ensure your access to ILO/RAC/BMC interfaces are properly secured. Although the VMware ESX host can be rebooted from the DCUI this is regarded as an action of last resort. If the VMware ESX hosts has running VMs these will crash, and may or may not be restarted on other hosts depending on whether they are part of a cluster.

Back To Basics: Managing VMware ESX Direct User Interface (DCUI)


I’ve put together a demo video that guides you through the main functionality of the DCUI. There’s two version a youtube version – which if you make go full-screen and set the resolution quality to the max, and should display without a problem. There’s also “native quality” mp4 that streams directly from my site.
Show Me How: Installing VMware ESX Video – Native Quality

Reset ‘root’ password

You may need to reset the ‘root’ password because an inappropriate one was initially assigned, or it has become disclosed to individuals who should be denied access. There are easier ways to change the root password using the vSphere Client, and if you need to change the ‘root’ account password for many hosts (say on a quarterly basis) you might find VMware’s PowerCLI and other scripting automation tools are a better approach.
Whilst special characters are supported with the ‘root’ passwords there have been reported cases of certain character types causing a problem. Generally, if you stick with alphanumerics and common characters such as !@%&*()}{|”:?><,./\’;][ then you should have no problem. Aviod special characters which are region or culturally specific.
Update: According to recent reports the VMware ESX 5.5 host appears have a problem with the $ symbol. This is something I've seen in other password environment where the UK pound symbol £ is not supported.
1. Open a console window to the physical VMware ESX hosts
2. Press [F2] on the keyboard, and supply your current ‘root’ logon password and press [ENTER]
Screen Shot 2013-10-21 at 13.44.10.png
3. Select “Configure Password” and press [ENTER]
4. Supply the old password together with two copies of the new password, and press [ENTER]
Screen Shot 2013-10-21 at 13.46.41.png
NOTE: To carry out this same task in VMware PowerShell first authenticate to the VMware ESX host, and use the “Set-VMHostAccount” cmdlet.
Screen Shot 2013-10-21 at 14.01.16.png
Set-VMHostAccount -UserAccount root -password Password1

Configure, Restart, Test and Restore the VMware ESX Management Network

The installation of VMware ESX defaults to assigning the first network card discovered to the management network, and configuring the host for a DHCP assigned address. This might be unsuccessful depending on how the physical server is patched to the switch, and whether a DHCP server is present on the network. Additionally, the physical switch maybe configured for VLANs. The default installation of VMware ESX does not allow for the setting of VLAN Tags until after the vmkernel has been loaded, and the DCUI enabled.
Almost all of the changes made in the “Configure Management Network” require a restart of the networking for the management of the ESX host. This is something you will prompted to do when ever you exit these pages.
Screen Shot 2013-10-21 at 16.35.33.png
The following instructions are illustration of changing the default physical NIC, setting the VLAN value and configuring a static IP options.

Network Card Assignment

1. Open a console window to the physical VMware ESX hosts
2. Press [F2] on the keyboard, and supply your current ‘root’ logon password and press [ENTER]
Screen Shot 2013-10-21 at 13.44.10.png
3. Use the cursor keys to scroll down and select “Configure Management Network” and press [ENTER]
4. Select “Network Adapters” and press [ENTER]
5. Using the [SPACEBAR] and cursor keys you can select network interfaces. In the screen grab below two physical NICs (vmnic0 and vmnic1) have been allocated to the VMware ESX host. This will automatically offer out of the box load-balancing and redundancy.
Screen Shot 2013-10-21 at 15.31.36.png

VLAN Configuration

1. Open a console window to the physical VMware ESX hosts
2. Press [F2] on the keyboard, and supply your current ‘root’ logon password and press [ENTER]
Screen Shot 2013-10-21 at 13.44.10.png
3. Use the cursor keys to scroll down and select “Configure Management Network” and press [ENTER]
4. Select “VLAN (Optional)” and press [ENTER]
5. Type in the VLAN ID value, and press [ENTER]
Screen Shot 2013-10-21 at 15.43.16.png

IP Configuration

1. Open a console window to the physical VMware ESX hosts
2. Press [F2] on the keyboard, and supply your current ‘root’ logon password and press [ENTER]
Screen Shot 2013-10-21 at 13.44.10.png
3. Use the cursor keys to scroll down and select “Configure Management Network” and press [ENTER]
4. Scroll down and select “IP Configuration” and press [ENTER]
Screen Shot 2013-10-21 at 16.20.11.png
5. Complete the IP configuration as it befits your local network requirements:
Screen Shot 2013-10-21 at 16.20.11.png
6. The DNS settings can be modified by selecting “DNS Configuration” and press [ENTER]. The DNS Configuration allows for the setting of a primary and secondary DNS server, together with the short “hostname”. The fully-qualified domain name (FQDN) is completed by configuring the “DNS Suffix” options
Screen Shot 2013-10-21 at 16.34.22.png
Screen Shot 2013-10-21 at 16.35.09.png
7. The IP Configuration can be tested using the “Test Management Network” options. This allows the SysAdmin to test communication to the router (if present) and the DNS servers on the network – as well as confirming the hostname is resolvable to via DNS.
Screen Shot 2013-10-21 at 17.12.41.png
Screen Shot 2013-10-21 at 17.13.00.png
IMPORTANT: Although the test here passed on the hostname, the test merely checks to see if the hostname is present on the DNS server. It does not verify if the hostname (or ANAME record) is valid or pointing at the correct address. As such this means you could still have incorrect entries in the DNS database. It’s recommend to use a utility like nslookup to confirm that both forward and reverse DNS looks resolve to the correct name.
Screen Shot 2013-10-21 at 19.52.01.png

Restore Network Configuration

Restoring the network configuration is quite a dangerous option if not used correctly. It has the potential to reset the network to such a state that you will not be able to communicate to the VMware ESX host without resorting to the DCUI to resume communication. It also has the possibility of disconnecting virtual machines (VMs) that are running on the VMware ESX host. Additionally, it has the ability to remove standard and distributed virtual switches (vSwitch) from the host in event that these have become broken on the host beyond repair.
CAUTION: As such you should approach these options with extreme care.
1. Open a console window to the physical VMware ESX hosts
2. Press [F2] on the keyboard, and supply your current ‘root’ logon password and press [ENTER]
Screen Shot 2013-10-21 at 13.44.10.png
3. Use the cursor keys to scroll down and select “Network Restore Options” and press [ENTER]
4. Select the Restore option required, and press [ENTER]. In the following case the option “Restore Network Settings” was selected.
Screen Shot 2013-10-21 at 17.24.49.png

Configure Keyboard

Whilst the VMware ESX host keyboard settings can be configured during installation, it possible to modify this after the installation itself.
1. Open a console window to the physical VMware ESX host
2. Press [F2] on the keyboard, and supply your current ‘root’ logon password and press [ENTER]
Screen Shot 2013-10-21 at 13.44.10.png
3. Use the cursor keys to scroll down and select “Configure Keyboard” and press [ENTER]
4. Use the cursor keys to highlight the preferred language, and then spacebar to select the new keyboard type. Press [ENTER] to make the change.
Screen Shot 2013-10-21 at 19.02.41.png

Troubleshooting Options

Restart Management Agents

In the early days of VMware ESX occasionally the host would appear as being “disconnected” in the management system of vCenter. Although the host has a “WatchDog” service designed to restart the core management agent, this would be unsuccessful. In recent years these random disconnections have been resolved – and its now highly unusual for an VMware ESX host to enter a disconnected state. Nowadays, if this happens its is more normally another cause such as an IP conflict, or the host being rebooted in non-authorised manner or some type of hardware failure. Nonetheless, the option to restart management agents does exist in the DCUI. If you do use this option you will need to be patient as it can take time for other systems to “retry” the connection and reconnect to the host.
1. Open a console window to the physical VMware ESX host
2. Press [F2] on the keyboard, and supply your current ‘root’ logon password and press [ENTER]
Screen Shot 2013-10-21 at 13.44.10.png
3. Use the cursor keys to scroll down and select “Troubleshoot Options” and press [ENTER]
4. Use the cursor keys to scroll down to “Restart Management Agents” and press [ENTER]. In the following page not only do you have the option to simply restart the management agents, but also collect extra troubleshooting information. Notice the warning about this disconnects all existing remote management software.
Screen Shot 2013-10-21 at 17.42.29.png

Enabling ESXi Shell and SSH together with Timeout Values

It is possible to get true command-line access to the VMware ESX host. This can be either by the “ESXi Shell” normally access via the ILO/RAC/BMC card or using the Secure Shell protocol (SSH) commonly access on TCP port 22 using a SSH client like PuTTy. In addition to these options being enabled they can be enabled for a designated period as well, to allow temporary console access. This is prevents the need to have protocols like SSH enabled all the time, which could be regarded by some as a security weakness. If you do have a require to permanently enabled SSH access this can be done from the “Security Profile” on the VMware ESX host either with the vSphere Client or using vCenter with the Web-Client.
Important: If you intend to set timeout values you must set these before enabling the ESXi Shell and/or SSH.
1. Open a console window to the physical VMware ESX host
2. Press [F2] on the keyboard, and supply your current ‘root’ logon password and press [ENTER]
Screen Shot 2013-10-21 at 13.44.10.png
3. Use the cursor keys to scroll down and select “Troubleshoot Options” and press [ENTER]
4. Use the cursor keys to select “Modify ESXi Shell and SSH Timeouts”, and press [ENTER]. Configure the durations for the “Availability Timeout” and “Idle Timeout”. A zero value can be specified which indicates that sessions never expire.
Screen Shot 2013-10-21 at 18.34.07.png
5. Next we can Enable the ESXi Shell and SSH. These a toggle options where pressing [ENTER] switches the option from “Enable…” to “Disable…”
Screen Shot 2013-10-21 at 18.38.06.png
6. Accessing the ESXi Shell requires exiting the DCUI back to the main screen and then pressing [ALT+F1] on the keyboard. The keystroke [ALT+F2] will toggle the SysAdmin back to the DCUI. Typing the command ‘exit’ at the ESXi Shell prompt logs the SysAdmin out of the environment.
Screen Shot 2013-10-21 at 18.44.31.png
7. Accessing the ESXi SSH Service requires a SSH Client. For Windows systems the most popular is the free PuTTy tool. Linux and Apple support their own native SSH command-line utilities.
Screen Shot 2013-10-21 at 18.53.19.png
Unsupported Tip: The DCUI is a process like any other on the VMware ESXi host. It is possible to access the DCUI from a SSH session using PuTTy. This is not a support usage, and it runs the risk of disconnecting the very SSH session that allows it work. The DCUI is accessed from the SSH session by typing the command “dcui” and the SysAdmin can exit the shell using the keystroke [CTRL+C]
Screen Shot 2013-10-21 at 18.56.06.png

View System Logs

There many ways of viewing and gathering the system logs from a VMware ESX host. Viewing them via the DCUI is perhaps least friendly method but it is possible.
1. Open a console window to the physical VMware ESX host
2. Press [F2] on the keyboard, and supply your current ‘root’ logon password and press [ENTER]
Screen Shot 2013-10-21 at 13.44.10.png
3. Use the cursor keys to scroll down and select “View System Logs” and press [ENTER]
4. Pressing a number on the keyboard from 1-6 will allow you to view the system logs, and [Q] on the keyboard will quit the log view, and return the SysAdmin back to the DCUI screen.
Screen Shot 2013-10-21 at 19.18.40.png
Screen Shot 2013-10-21 at 19.19.13.png

Reset System Configuration (Factory Reset)

A “Reset System Configuration” (or more commonly referred to as a ‘factory reset’) reconfigures the ESX host back to its initial installation. This achieve by maintain various system states between reboots. Before issuing a “Reset System Configuration” its is recommended to carry out a manual backup of the VMware ESX host. This can be done using the command vicfg-cfgbackup or PowerCLI.
IMPORTANT: A reset of the VMware ESX host also resets the root password back to being blank. As consequence all previous passwords including the one configured at the installation are lost.
1. Open a console window to the physical VMware ESX host
2. Press [F2] on the keyboard, and supply your current ‘root’ logon password and press [ENTER]
Screen Shot 2013-10-21 at 13.44.10.png
3. Use the cursor keys to scroll down and select “Reset System Configuration” and press [ENTER]. Next press [F11] to confirm you wish to carry-out the reset, followed by [ENTER] to confirm a reboot of the system.
Screen Shot 2013-10-21 at 19.30.00.png
Screen Shot 2013-10-21 at 14.01.16.png
Get-VMHostFirmware -VMHost esx01nyc.corp.com -BackupConfiguration -DestinationPath C:\
Set-VMHostFirmware -ResetToDefaults
Note: This will back up the VMware ESX host called “esx01nyc.corp.com”. After the backup has completed a zip file in the .tgz format will be created called C:\configBundle-esx01nyc.corp.com.tgz. The cmdlet “Set-VMHostFirmware” has the capacity to send the reset process to the host as well.

Shutdown/Restart the VMware ESX Host

There are many ways to shutdown or reboot the VMware ESX host. By far the most appropriate method would be use vCenter “maintenance mode” which in conjunction with the VMotion and the Distributed Resource Schedule (DRS) feature successfully evacuate all the VMs from the host, before a shutdown or reboot instruction is given. You should exhaust all reasonable efforts to gain control over the the VMware ESX host to carry out a graceful outage of the host. Only use the power button or the shutdown/restart functionality of the DCUI if you have no other option.
1. Open a console window to the physical VMware ESX host
2. Press [F12] on the keyboard, and supply your current ‘root’ logon password and press [ENTER]
Screen Shot 2013-10-21 at 20.08.11.png
3. Pressing [F2] on the keyboard will trigger a shutdown, whereas pressing [F11] will trigger a reboot. Before using the [F2] ensure you have suitable access to trigger a power on of the physical server!
Screen Shot 2013-10-21 at 14.01.16.png
Set-VMHost esx01nyc.corp.com -State maintenance
Restart-VMHost -vmhost esx01nyc.corp.com



http://blogs.vmware.com/smb/2013/12/back-to-basics-managing-vmware-esxi-5-5-direct-user-interface-dcui.html
http://www.virtualizationadmin.com/articles-tutorials/vmware-esx-and-vsphere-articles/general/how-to-access-the-vmware-esxi-hidden-console.html
http://www.yellow-bricks.com/2009/04/15/the-basics-how-to-kill-a-vm-thats-stuck-during-shutdown/


    List all VMs registered to this host (This reveals the Vmid needed for other commands)
    vim-cmd /vmsvc/getallvms
    Unregister a VM
    vim-cmd /vmsvc/unregister <Vmid>
    Register a VM
    vim-cmd /solo/register /path/to/file.vmx
    Get power state of a VM
    vim-cmd /vmsvc/power.getstate <Vimid>
    Power off a VM
    vim-cmd /vmsvc/power.off <Vmid>
    Power on a VM
    vim-cmd /vmsvc/power.on <Vmid>





    vmware-cmd -l
    vmware-cmd <config> stop trysoft
    vm-support -x
    vm-support -X <vmid>
    vmware-vim-cmd vmsvc/getallvms
    vmware-vim-cmd vmsvc/poweroff <vm id>
    ps -auxwww | grep <vm name>
    kill <process id>
    if option three isn’t successful do the following:
    kill -9 <process id>
http://kb.vmware.com/kb/1004340
 http://www.yellow-bricks.com/2009/04/15/the-basics-how-to-kill-a-vm-thats-stuck-during-shutdown/
http://www.vladan.fr/esxi-5-unresponsive-vm-h/


To monitor esxi vm's health
https://mathias-kettner.de/checkmk_vsphere.html

For patching an installation
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2008939
http://blogs.vmware.com/vsphere/2011/09/patching-esxi-from-the-command-line.html
Backup the host configuration:
# vicfg-cfgbackup –server esx18a.vmworld.com –save –username root esx18a-09162011.tgz

List image profiles in the patch:
# esxcli -s 10.91.243.171 –username root software sources profile list –depot=<path-to-zip>/ESXi500-201109001.zip

Place host into maintenance mode:
# vicfg-hostops –server 10.91.243.171 –username root –operation enter

Install with dry-run option:
# esxcli -s 10.91.243.171 –username root software profile install –depot=<path-to-zip>/ESXi500-201109001.zip –dry-run –profile=ESXi-5.0.0-20110904001-standard

Update with dry-run option:
# esxcli -s 10.91.243.171 –username root  software profile update –depot=<path-to-zip>/ESXi500-201109001.zip –dry-run –profile=ESXi-5.0.0-20110904001-standard

Perform the update:
# esxcli -s 10.91.243.171 –username root  software profile update –depot=<path-to-zip>/ESXi500-201109001.zip –profile=ESXi-5.0.0-20110904001-standard

Reboot the host:
# vicfg-hostops –server 10.91.243.171 –operation reboot

Take host out of maintenance mode:
# vicfg-hostops –server 10.91.243.171 –operation exit


To shutdown the esxi host
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1013193
You can shut down or reboot ESXi/ESX 4.x or ESXi 5.x hosts using any of the following methods:

Warning: Although these methods will gracefully shut down or reboot an ESXi/ESX host, they will not safely stop running virtual machines on the host. You should always ensure that virtual machines are migrated off the host and that the host is in maintenance mode before attempting to reboot or shut down a host using any method.

ESX 4.x

Log in to the ESX service console and perform one of these steps from the service console to shut down or reboot ESX 4.x hosts:
  1. Run the shutdown –r now command to reboot the system.

    Note: This command shuts down the virtual machines running on the ESX 4.0 hosts.
  2. Run the reboot command to reboot the system.
  3. Run the poweroff command to shut down ESX. After the shutdown, a message indicates that it is safe to power off your system. Press the power button until the machine powers off. You can then manually reboot the system.

ESXi 4.x/5.x

  1. From the Direct Console User Interface (DCUI) screen, press F12 to view the shutdown-related options for the ESXi host.
    • Press F2 to shut down.
    • Press F11 to reboot.
  2. From Local or Remote Tech Support Mode, or from an SSH session, run one of these commands:
    • Run the reboot command to restart the host.
    • Run the poweroff command to shut down the host.

    Note: In ESXi 5.x, no console output will be displayed on the screen when using the reboot or poweroff commands. After a short period of time, the host will reboot or shut down.

ESXi/ESX 4.x or ESXi 5.0

From the vSphere Client

Before shutting down or rebooting the ESXi/ESX 4.x or ESXi 5.0 hosts, ensure that the hosts are put into maintenance mode. Powering off a managed host disconnects it from vCenter Server, but does not remove it from the inventory.
  1. Shut down or use vMotion to migrate all virtual machines running on the ESXi/ESX hosts.
  2. Put the ESXi/ESX hosts into maintenance mode.
  3. Right-click the ESXi/ESX host that you want to shut down, and click Reboot or Shut Down.

    • If you select Reboot, the ESXi/ESX host shuts down and reboots.
    • If you select Shut Down, the ESXi/ESX host shuts down. You must manually power the system back on.
  4. Provide a reason for the shutdown or reboot. This information is added to the log.

ESXi 5.1/5.5

From the vSphere Web Client

Before shutting down or rebooting the ESXi 5.1 hosts, ensure that the hosts are put into maintenance mode.

To enter maintenance mode from the vSphere Web Client:
  1. Browse to the host in the vSphere Web Client navigator.
  2. Right-click the host and click Enter Maintenance Mode.
  3. Click Yes to enter maintenance mode.
Note: The host remains in maintenance mode until you select Exit Maintenance Mode.

To reboot or shut down the host using the vSphere Web Client:
  1. From the vSphere Web client, navigate to the host you want to shut down.
  2. Right-click the host and click Reboot or Shutdown.

From vCLI or vMA (vCLI 4.x)

Note: By default, the hostops.pl file in VMware vSphere CLI 4.0 U1 installations is located at C:\Program Files\VMware\VMware vSphere CLI\Perl\apps\host.
  • To put ESXi/ESX 4.x or ESXi 5.0 hosts into maintenance mode, run this command from the vMA (vSphere Management Assistant) or vCLI (vSphere Command-Line Interface) console screen:

    /usr/lib/vmware-vcli/apps/host/hostops.pl --target_host ESX-Host-FQDN --operation enter_maintenance --url https://vCenter-Host/sdk/vimService.wsdl
  • To reboot ESXi/ESX 4.x or ESXi 5.0 hosts, run this command from the vMA or vCLI console screen:

    /usr/lib/vmware-vcli/apps/host/hostops.pl --target_host ESX-Host-FQDN --operation reboot --url https://vCenter-Host/sdk/vimService.wsdl
  • To shut down ESXi/ESX 4.x or ESXi 5.0 hosts, run this command from the vMA or vCLI console screen:

    /usr/lib/vmware-vcli/apps/host/hostops.pl --target_host ESX-Host-FQDN --operation shutdown --url https://vCenter-Host/sdk/vimService.wsdl

From vCLI or vMA (vCLI 5.x)

Note: For more information on the vicfg-hostops command, see the vSphere Command-Line Interface Reference documentation.
  • To put ESXi/ESX 4.x or ESXi 5.x hosts into maintenance mode, run this command from the vCLI (vSphere Command-Line Interface) console screen:

    vicfg-hostops.pl --server ip_address --username root --password password --operation enter
  • To reboot ESXi/ESX 4.x or ESXi 5.x hosts, run this command from the vCLI console screen:

    vicfg-hostops.pl --server ip_address --username root --password password --operation reboot
  • To take ESXi/ESX 4.x or ESXi 5.x hosts out of maintenance mode, run this command from the vCLI console screen:

    vicfg-hostops.pl --server ip_address --username root --password password --operation exit
  • To shut down ESXi/ESX 4.x or ESXi 5.0 hosts, run this command from the vCLI console screen:

    vicfg-hostops.pl --server ip_address --username root --password password --operation shutdown
Note: For more information, see Running VMware CLI 4.x commands on ESXi 5.0 hosts (2004291).



VMware CLI 4.x commands on ESXi 5.0 hosts
As ESXi 5.0 is a new architecture with new features, VMware strongly recommends that you use vSphere CLI 5.0 to manage ESXi 5.0 hosts.
 
If you have to use vSphere CLI 4.x, this table outlines support for the commands:
 
Command Support 
svmotion.pl Not Supported
vicfg-advcfg.pl  Supported
vicfg-cfgbackup.pl Supported
vicfg-dns.pl Supported
vicfg-dumppart.pl Supported
vicfg-hostops.pl Supported
vicfg-ipsec.pl Supported
vicfg-iscsi.pl
Not Supported
vicfg-module.pl Supported
vicfg-mpath.pl
Not Supported
vicfg-nas.pl Supported
vicfg-nics.pl Supported
vicfg-ntp.pl Supported
vicfg-rescan.pl Supported
vicfg-route.pl Supported
vicfg-scsidevs.pl
Not Supported
vicfg-snmp.pl Supported
vicfg-syslog.pl Supported
vicfg-user Supported
vicfg-vmknic.pl  Supported
vicfg-vswitch.pl Supported
vifs.pl  Supported
vicfg-volume
Not Supported
vihostupdate.pl
Not Supported
vihostupdate35.pl
Not Supported
vmkfstools Supported
vmware-cmd.pl Supported

 

No comments:

Post a Comment