O'Reilly logo

VMware Cookbook by Matthew Helmke, Ryan Troy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Useful Command-Line Tools

Many important VMware-related tips will take you from vCenter to the console. Along with other things in this chapter, we’ll examine some important command-line utilities that will aid you in monitoring and configuring your ESX Server, and we’ll take a look at general best practices for setting up services that will be crucial to your ESX Server.

5.1. Entering Maintenance Mode via the Command Line

Problem

You are unable to access your vCenter GUI and you want to put your ESX Server into maintenance mode.

Solution

Log into your ESX host via SSH or directly from the console.

Discussion

To enter maintenance mode, use this command:

vimsh -n -e /hostsvc/maintenance_mode_enter

To exit maintenance mode, enter:

vimsh -n -e /hostsvc/maintenance_mode_exit

These commands are undocumented and unsupported by VMware. However, they work correctly in ESX 3.x. Alternatively, you can use the VI Perl ToolKit to initiate maintenance mode via the API provided by VMware.

5.2. Displaying Server Information

Problem

You want to display current information about your ESX Server.

Solution

Run the esxcfg-info command on the ESX Server.

Discussion

This command-line tool is a powerful yet simple way to find out about your ESX Server and its environment. By using the esxcfg-info command, you can get detailed information about your configuration and server hardware:

$ esxcfg-info -h Usage: esxcfg-info mode -a, --all Print all information -w, --hardware Print hardware information -r, --resource ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required