Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
0 Remote CLI
Product Support Engineering
VMware Confidential
You can use an installable package to run vSphere CLI and vSphere SDK Perl Toolkit commands
4
After you have installed the package, you can run vSphere CLI commands or invoke scripts from the operating system command line. Each time you run a command, you specify the connection options directly or indirectly.
prepackaged software that developers and administrators can use to run agents and scripts to manage ESX/ESXi systems. vMA includes the vSphere SDK for Perl and vSphere CLI in a Linux environment.
When you execute commands, you must specify the ESX/ESXi host on which you want to run the command and the user name and password
If you are running vMA, you can set up target servers and execute vSphere CLI commands against target servers without additional authentication.
VI4 - Mod 1-5 - Slide 7
Management Agents
Hardware Agents
VI API
VMware ESX/ESXi
A number of prerequisite libraries are included in the default installation of each supported Linux distribution.
The vSphere CLI package installer installs the vSphere CLI scripts and the vSphere SDK for Perl
11
The vSphere CLI package is supported on the following Windows operating systems:
Windows Vista SP 1 Windows XP SP 2
The system uninstalls both the vSphere SDK for Perl and the vSphere CLI package.
This order of precedence always applies. You cannot override an environment variable setting in a configuration file.
Call save_session.pl You must specify the server to connect to and the name of a session file in which the script saves an authentication cookie. For example:
Windows: save_session.pl --savesessionfile C:\Temp\my_session -server my_vc_server --vihost my_esx1 Linux: save_session.pl --savesessionfile /tmp/vimsession server <servername_or_address> --username <username> --password <password>
If you specify a server but no user name or password, the script prompts you.
Example:
sudo vifp addserver cs-tse-f113.csl.vmware.com
Result :
Creates users vi-admin and vi-user on the added server
For example:
Windows: Linux: vicfg-mpath.pl --sessionfile C:\Temp\my_session --list vicfg-mpath --sessionfile /tmp/vimsession --list
set VI_SERVER=<your_server_name_or_address>
To administer multiple vCenter Server or ESX/ESXi systems create multiple configuration files with different names.
To execute a command or a set of commands on a server, you pass in the --config option with the appropriate filename at the command line. If you specify --config, the system ignores the settings in the .visdkrc file.
If you have set up your system to run this file, you can execute scripts on the specified server afterwards.
NOTE The password is in plain text, so you must limit access to this file.
Linux vicfg-mpath --server <server> --user snow\-white --password dwarf\$ vicfg-mpath --server <server> --user snow-white --password dwarf$ Windows vicfg-mpath.pl --server <server> --user snow-white --password dwarf$
VI4 - Mod 1-5 - Slide 27
Using --passthroughauth passes the credentials of the user who runs the command to the server
If the executing user is known by the Source and Destination no additional authentication is required.
The script itself adds the NAS datastore by calling the different configuration files.
#!bin/sh for i in {"esxi_server_a","esxi_server_b","esxi_server_c"} do echo "Adding NAS datastore for $i... vicfg-nas --config /home/admin/.visdkrc.$i -a -o mainnas.x.com -s /shared nas_ds vicfg-nas --config /home/admin/.visdkrc.$i l done