VMware stand-alone inventory agent for FlexNet Manager Suite
Discovery and inventory information are necessary for FlexNet Manager Suite to perform license consumption calculations. For collecting inventory, we recommend that you deploy one or more inventory beacons on your network and use supported inventory collection methods. Each inventory beacon deployed collects discovery and inventory information from the devices within its assigned subnet and sends this information to FlexNet Manager Suite.
To collect VMware inventory, inventory beacons require a network connection to the target VMware vCenter or ESX servers within its assigned subnet. This may not be possible in secure environments (like VMware servers secured by firewalls) – you may not be able to establish a network connection between each installed inventory beacon and the VMware servers within its assigned subnet, or you may not be able to install inventory beacons at all. Flexera offers a stand-alone VMware inventory collection agent for such environments that can be installed on a Windows server.
How the stand-alone VMware inventory agent works
The stand-alone VMware inventory agent remotely collects VMware (ESX or vCenter) inventory when you cannot use the standard inventory collection methods recommended by Flexera. You can deploy the agent on any computer with Windows desktop (Windows 7 or higher) or server (2008 or 2012) edition.
The agent can collect inventory from individual VMware ESX servers but works more efficiently with VMware vCenter servers, where it collects inventory for all VMware ESX servers registered with the target VMware vCenter server. In a clustered environment, the agent can collect VMware inventory for the entire VMware cluster through the target VMware vCenter server. The stand-alone agent saves the collected VMware inventory information (as .ndi files) to a specified location. You can then export the collected data to FlexNet Manager Suite to perform license consumption calculations.
To collect VMware inventory, the agent needs credentials for an account with read access to the VMware SDK URL on each of the target VMware servers. After configuring the agent with the details of the target VMware servers, the agent collects VMware inventory using API calls (see the “API Calls for VMware Inventory Collection” section below for details). The collected information is saved to a configured location and can be uploaded to FlexNet Manager Suite for license consumption calculations.
How to collect VMware inventory through the stand-alone VMware inventory agent
To collect VMware inventory through the stand-alone VMware inventory agent, complete the following steps:
1. Verify the prerequisites
Prerequisites for inventory collection using the stand-alone VMware inventory agent:
- A VMware vSphere/vCenter/ESXi server, supporting versions from 5.0 to 6.7 inclusive.
Note: Inventory is not possible on the free license versions of ESXi.
- The following software products are required on the server where the agent is to be deployed:
- Windows desktop (Windows 7 or higher) or Server (2008 or 2012) edition
- Microsoft .NET Framework version 4.0 or later.
- Network access to the target VMware vCenter or ESX hosts.
- An account with read access to the VMware SDK URL is required on each target vCenter or ESX host.
2. Deploy the inventory agent
The stand-alone VMware inventory agent is shipped as a zip archive. To deploy the agent:
A. Create a folder (for example, VMwareInventory) on the Windows desktop or your preferred location.
B. Extract the contents of the Flexera-supplied stand-alone inventory agent file FNMS-VMware-Scanner.zip into this folder (see zip file attached).
C. Using Windows Explorer, create a folder to save the collected inventory information (for example, C:\Inventories\). You should add this path to the OutputDir parameter in the esxquery.ini file.
3. Configure the inventory agent
To enable the stand-alone VMware inventory agent to collect inventory from target VMware servers, register every target VMware server with the agent, and record the VMware server name in the esxquery.ini file. Follow these steps to configure the agent:
A. Launch the Windows command prompt with the "Run as administrator" option enabled on the computer where you deployed the agent. Locate the folder you created to house VMware inventory (VMwareInventory in this example).
B. Invoke the agent by using the command:
The agent should display a list of available options:
|server||Query specified server|
|-a||Query all configured servers|
|-l||List configured servers and credentials|
|-s||Set logon credentials for server|
|-d||Delete logon credentials for server|
|-c||Use existing logon session cookie|
|-f||Set VMware license flag for server|
C. After running the agent the first time, you can use the following command to list any previously-targeted VMware servers that are still registered with the agent:
D. If any undesired VMware servers are registered with the agent, use the following command with the name of the VMware server whose registration you want deleted, where <server name> is the VMware server name.
esxquery.exe -d <server name>
E. Use the following command to register a target VMware server with the stand-alone VMware inventory agent, where <server name> is the name of the target VMware server to be registered with the agent.
The agent will collect inventory only from the VMware servers registered with it.
esxquery.exe -s <server name>
The agent prompts you to enter the credentials for this server.
F. Enter the credentials for the account with read access to the VMware SDK URL <https://<server name>/sdk>> created on this VMware server.
G. Repeat step E for each of the target VMware servers. The agent records each server name with its username and encrypted password in the esxquery.ini file in the VMwareInventory folder.
H. Set the OutputDir parameter to the path where you want the agent to store the collected inventory files.
The following code example sets the output directory to the .\Inventories sub-folder under the VMwareInventory folder. The example shows how two VMware servers (server1 and server2) are recorded in the esxquery.ini file.
[server1] Username=<domain\user name> Password=CtCi3795PXgxC3W8W7gdSg==
[server2] Username=<domain\user name> Password=EEfoiY3pmz0xC3W8W7gdSg==
The esxquery.exe tool encrypts the password automatically, before saving it to the esxquery.ini file.
I. Use the following command to review the list of VMware servers registered with the stand-alone agent:
Your agent is now ready to collect inventory from the target VMware servers.
4. Collect VMware inventory
When you have registered all target VMware servers with the stand-alone VMware inventory agent, you can run the agent to collect VMware inventory from the registered VMware servers.
A. Use the following command to run the stand-alone VMware inventory agent:
- The agent executes, collects inventory from each of the servers listed in the esxquery.ini file, and saves the inventory files (.ndi) in the output folder specified in the esxquery.ini file.
- The agent runs and displays inventory success messages.
The following code shows an example output:
C:\Flexera\VCenter Query>esxquery.exe -a
servername: found VMware vCenter Server v4.1.0
servername: inventory generated successfully
B. Using Windows Explorer, navigate to the output folder (C:\VMwareInventory\Inventories). You should see a .ndi file for each of the target ESX servers. Each .ndi file contains inventory for a target ESX server and all the virtual machines registered with it.
|Note: The stand-alone VMware inventory agent also collects inventory for the virtual machines switched off during the inventory collection process.|
5. Export inventory to FlexNet Manager Suite
FlexNet Manager Suite’s license consumption calculation process requires the .ndi files collected to calculate your VMware license position.
- If you have installed FlexNet Beacon, you can manually transfer the collected inventory (.ndi) files to the Incoming\Inventories folder. The FlexNet Beacon uploads the inventory to FlexNet Manager Suite.
- If you have not installed any inventory beacons, you can use any third-party methods to export the imported inventory to the C:\ProgramData\Flexera Software\Incoming\Inventories folder on the FlexNet Manager Suite server.
Uninstalling the Agent
You can easily uninstall the stand-alone VMware inventory tool by deleting the following folders:
- Deployment folder (VMwareInventory)
- Output folder (Inventories)
API Calls for VMware Inventory Collection
The stand-alone VMware inventory agent connects to the VMware SDK URL (https://<servername>/sdk) on each target VMware server. This connection requires an account with read access to the SDK URL.
The agent makes the following API calls through the SDK once a connection is established with the target VMware server:
|GetServiceContent||A single call is made to this API to retrieve the ServiceInstance to enable further queries.|
|RetrieveProperties: Host Information||A single call is made against the root folder to return information about each host server with the following attributes:
|RetrieveProperties: VM Information||A call is made against each returned HostSystem to obtain the following attributes for each virtual machine that exists on the host: