24 Feb 2011 by rayheffer
The vSphere Management Assistant (vMA) runs a 64 bit operating system (RedHat Enterprise Linux) and features the VMware vCLI in addition to vSphere SDK for Perl, Java JRE, CIM vSphere profiles, VMware tools and an SNMP agent. The vMA virtual machine requires a single vCPU with 512MB memory and a 5GB virtual disk. If you are studying for the VCAP-DCA exam then you will need to know how to install and use the vMA to manage a vSphere environment. The best way to learn how to use the vMA is to setup your own home lab. I’ve already posted an article on building a whitebox VMware vSphere server for your home lab (click here), otherwise you can always use VMware Workstation on your PC or laptop.
Installing the vMA is very easy and you can download the latest version from VMware where you will also find documentation. It will download in .zip format and contains the vMA as an OVF. This can be imported into vCenter ‘File > Deploy OVF Template…’. Once it has been deployed into your vSphere environment and powered on, you will be presented with a text based setup wizard where you can set the IP address, subnet mask, gateway, DNS, and so on. When you have completed the setup, you will need to connect to the vMA using an SSH client (PuTTY).
Log into a the vMA using vi-admin and the password you created during the initial setup. As I mentioned previously, vMA has all of the vCLI commands (E.g. vicfg-nics, vicfg-vswitch) which are located in /usr/bin.
With any command remember that you can use –help (E.g. vicfg-nics –help) to display a list of options, even seasoned command line junkie’s use this so don’t think of it as something just for us newbies!
Most commands will need a target server, so here is an example of a simple command you can try out on one of your hosts. Throughout this article I will be using my own home lab to run these commands.
$ vicfg-nics -l --server esx01.home.lab (Always use the FQDN of your host)
It will prompt you for a username and password that you can use to authenticate against this host, for our example we are using root. You will then see your NIC’s listed:
Name PCI Driver Link Speed Duplex MAC Address MTU Description vmnic0 02:00.0 e1000 Up 1000Mbps Full 00:50:56:a5:00:07 1500 Intel Corporation PRO/1000 MT Single Port Adapter vmnic1 02:02.0 e1000 Up 1000Mbps Full 00:50:56:a5:00:03 1500 Intel Corporation PRO/1000 MT Single Port Adapter
As you can see this is a really easy way of managing your ESX hosts, but another feature you should be aware of is the vi-fastpass which allows you to add your hosts and vcenter server with the associated passwords. With vi-fastpass you can run the vicfg commands without being prompted each time. Very slick.
To use vi-fastpass you need to add the hosts you wish to manage using the vifp addserver command:
$ vifp addserver
Next you need to set your target using the vifptarget command:
$ vifptarget -s esx01.home.lab
Note: The vifptarget command has replaced vifpinit. Watch out for this if you are studying for your VCAP-DCA exam.
You’ll notice that the shell prompt now has the hostname of your target host, very useful if you forget which target you last set!
[vi-admin@vma ~][esx01] $
If you run the vicfg-nics -l command again you won’t be prompted for the root password.
Another method of storing the host credentials is with session files. I personally don’t use this because I prefer vi-fastpass, but it is good to understand how it works. Firstly, change directory to /usr/share/doc/vmware-vcli/samples/session and you’ll see three Perl scripts:
$ cd /usr/share/doc/vmware-vcli/samples/session
-r-xr-xr-x 1 root root 782 Apr 8 2010 load_session.pl -r-xr-xr-x 1 root root 2624 Apr 8 2010 multisession.pl -r-xr-xr-x 1 root root 888 Apr 8 2010 save_session.pl
# ./save_session.pl --server esx01.home.lab --username root --password Password --savesessionfile /home/vi-admin/esx01.session
The above command will create a file in /home called esx1.session and stores the credentials for that host. It doesn’t store the password in plain text, and it only lasts for 30 minutes unlike vi-fastpass.
To test your session file, first make sure your vifptarget is clear then run the vicfg-nics command using the session file:
$ vifptarget -c
$ vicfg-nics -l --sessionfile /home/vi-admin/esx01.session
The command should run without prompting you for a password.
Now that you can see how easy it is to get started with vMA, I recommend that you download the documentation from VMware and experiment with different commands. In addition to adding ESX/ESXi hosts with vifp addserver, you can also add vCenter servers. To display a list of your servers use vifp listservers.
Comments are closed for this post.