vMA

25 Aug 2010 by Simon Greaves

vMA or virtual management assistant provides a way to manage a ESX(i) host or vCenter server through the command line.

Remote commands are vicfg rather than esxcfg like on a local ESX host. Using vicfg allows you to manage ESXi hosts through the command line as direct console access is not available like on ESX. vMA includes:

  • vCLI
  • vSphere SDK for Perl & for Java (although last time I checked this was still experimental)
  • vSphere API

When logging into the vMA use vi-admin user account.

Each command you run needs a command name (i.e. vicfg-nics), authentication parameters (i.e. ESX host username), which ESX(i) (vihost) to run the command and any other options for the command.

You can create a session file for secure password hashing. Using this creates access tokens.

Example:
Save_session.pl –sessionfile <sessionfile> --username <username> --server <vcenter_server> password:<password>

For access for up to half an hour, use
Vicfg-nics –sessionfile <sessionfile> --vihost <hostname> --list

Commands & Examples

vicfg-nics | Manage physical NICs
vicfg-vswitch | Manage virtual switches
vicfg-vmknic | VMkernel NIC
vicfg-dns | Specify DNS configuration
vicfg-route | Manage default IP gateway
Vicfg-ntp | Specify NTP server

Options

-a Set the NIC to auto negotiate
-d half¦full Duplex options
-s <val> Speed for NIC (val is 10,100,1000,10000)
-l Lists the NICS
-L Link
-A Add
-D Delete a port group
-d Delete a virtual switch
-U Remove an uplink from a vSwitch (unlink)
-Q Remove an uplink from a dvSwitch
-IP Assign IP address
-m Set MTU
-n Set netmask

Create a virtual switch
vicfg-vswitch <comm-params> -a <vswitch name>
Add a port group to a virtual switch
vicfg-vswitch <comm-params> -A <portgroup> <vSwitch_name>
Link an uplink to a virtual switch
vicfg-vswitch –L <vmnic> <vswitch_name>
Link an uplink to a distributed vSwitch
vicfg-vswitch –P <vmnic> -v <dvport> <dvswitch_name>
Set Max MTU size
vicfg-vswitch <comm-params> -m 9000 <vSwitch_name>
VLANS
vicfg-vswitch –v <VLAN_ID> -P <portgroup> <vSwitch_name>
Remove a VLAN ID
vicfg-vswitch <comm-params> -v 0 –P <portgroup> <vSwitch_name>

Comments are closed for this post.