Tip

IT toolbox: Scripts for streamlining VMware ESX

Hannah Drake, Associate Editor

Managing a VMware infrastructure becomes more complicated as the number of virtual servers on your network increases. Customize your VMware configurations with our select command scripts in this chapter of our ESX runbook.

    Requires Free Membership to View

CHAPTER 1: Networking configurations and considerations
CHAPTER 2: ESX Server management
CHAPTER 3: Managing storage in an ESX Server environment
CHAPTER 4: Scripts for streamlining VMware ESX

System visibility and settings
Navigating between management consoles can get complicated when multiple systems are running. VirtualCenter helps VMware administrators keep tabs on their environments, but as useful as it is, it creates yet another log in addition to common logs such as Windows Event Log or Linux Syslog Server.

Fortunately, contributor and VMware expert Andrew Kutz wrote Monet, a script to further help you monitor ESX and VirtualCenter. Monet monitors events and tasks and exports them to either Windows Event Log or Linux Syslog Server, enabling you to monitor activity across your entire architecture from one vantage point.

Once visibility is established, VMware administrators should consider service console partitioning in order to avoid overloading root partitions. The service console partitioning scheme reallocates space among the /tmp, /var, /home and /vmimages directories. The scheme can be customized based on your organization's needs.

VMware also recognized possible root partition issues and released their own scheme recommendations. A comparison of VMware's and Scott Lowe's schemes can be viewed at Lowe's blog.

Scripting backup and recovery
There are a few scripts available that make the backup process easier. For example, during a cold backup, you would need to execute a command to stop a running virtual machine. But this command can't be mass-executed because trying to suspend a virtual machine that isn't actually running will cause errors. Kutz wrote another script that helps distinguish the suspend/resume commands among running and non-running servers.

Another piece of the backup and recovery puzzle is making sure you have a failover mechanism in place to avoid downtime. One way to fill this need is to set up a redundant VM file server, which can be accomplished by using VMware Converter 3.0.1 Enterprise. This tool can be set to schedule a "conversion" of the target virtual machine to a new location on another ESX server while the target virtual machine is still running.

Write your own ESX scripts
According to some virtualization pros, the VMware SDK is the preferred mechanism for programming VMware ESX. This is in contrast to the commands available via the ESX system console. The VI3 SDK language, however, varies from usual SDKs and requires some work before mastery. For example, the VI3 SDK reference material uses the terminology "managed objects" and "data objects" as opposed to "managed classes" and "data classes."

Although Microsoft Visual Studio .NET will automatically create C# class files when a Web reference is added, you may choose to create the files from the VI3 Web Services Description Language files. From there, system administrators can query the VI3 SDK for information in order to leverage the SDK with .NET using C#.

A final word on networking
Layer-2 security, commonly implemented by networking engineers, can potentially cause problems in a network with virtual machines. One of the characteristics of Layer-2 security is that a system will shut off a port to a virtual machine if a virtual machine is acting up. But in a virtual network, this automation could potentially shut off a port to several virtual machines, causing more problems than you started with. A script is available that shuts down the network interface of a specific virtual machine instead of shutting off the port.

These scripts will make your administration tasks easier, but if you have questions on any of Andrew's scripts, email us at editor@searchvmware.com and we'll forward your questions to him. If you've written another useful configuration script for VMware and would like to share it with your peers, email me directly at hdrake@techtarget.com, and I'll write it up and add it to this IT toolbox.

This was first published in April 2008

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.