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.
|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.
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 email@example.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 firstname.lastname@example.org, and I'll write it up and add it to this IT toolbox.
This was first published in April 2008