NAME

hostinfo.pl - lists the hosts and their attributes


SYNOPSIS

 hostinfo.pl --url <web service URL> --username <server login name>
        --password <server login password> --datacenter <name of the datacenter>
          [--fields <attributes to be displayed>]
          [--fileoutput <name of the file to print the results to>]
          [--hostipaddress <ipaddresss of the host>]
          [--maintenancemode <boolean value to filter hosts in and not in maintenance mode>]
          [--vmotion <boolean value to filter hosts with vmotion enabled or disabled>]


DESCRIPTION

This VI Perl command-line utility provides a query tool that lists various hosts and attributes for a host or set of hosts.


OPTIONS

GENERAL OPTIONS

datacenter

Optional. Name of the datacenter. When datacenter is specified, only hosts in this datacenter will be listed.

fileoutput

Optional. An xml filename or path of an xml filename to which the output will be written to. If fileoutput not used, the output will be displayed.

folder

Optional. Name of the Folder. When Folder is specified, only hosts in this Folder will be listed.

hostipaddress

Optional. Filters host based on hostipaddress. When hostipaddress is specified, only host having this ip address will be listed.

maintenancemode

Optional. Filters host based on maintenancemode. When maintenancemode is specified, only host having this maintenancemode will be listed.

vmotion

Optional. Filters host based on vmotion enabled or disabled. When vmotion is specified, only hosts having this vmotion property will be listed.

FIELDS OPTIONS

hostname

Optional. Display property hostname, when specified.

portnumber

Optional. Display property portnumber when specified. It lists the port number.

boottime

Optional. Display property bootTime when specified. bootTime displays the time when the host was booted in dateTime format.

cpumodel

Optional Display property cpumodel when specified. It provides the cpu model identification.

cpuspeed

Optional. Display property cpuspeed when specified. The product of the speed of cpu cores and number of processors contained by a CPU package is approximately equal to the sum of the MHz for all the individual cores on the host. This product forms the cpuspeed.

cpuusage

Optional. Display property cpuusage when specified. It specifies the aggregated CPU usage across all cores on the host in MHz.

filesystem

Optional. Display property filesystem when specified. It describes the file system volume information for the host, listing the supported file system volume types.

host_status

Optional. Display property host_status when specified. It gives the overall alarm status of the host.

maintenancemode

Optional. Display property maintenancemode when specified. It indicates whether or not the host is in maintenance mode. It is set when the host has entered the maintenance mode.

memorysize

Optional. Display property memorysize when specified. It provides the physical memory size in bytes.

memoryusage

Optional. Display property memoryusage when specified. It gives the Physical memory usage on the host in MB.

networkadapters

Optional. Display property networkadapters when specified. It gives the number of network adapters.

rebootrequired

Optional. Display property reebootrequired when specified. Indicates whether or not the host requires a reboot due to a configuration change.

software

Optional. Display property software when specified. It gives the complete product name, including the version information

vmotion

Optional. Display property vmotion when specified. It indicates whether vmotion is enabled or disabled for the host.


EXAMPLES

List all hosts and all properties of the hosts that are part of ha datacenter.

 hostinfo.pl --username administrator --password mypassword
            --url https://192.168.111.52/sdk/vimService
            --datacenter ha

List all hosts that are part of ha datacenter and selected properties of the hosts, as specified in the fields

 hostinfo.pl --username administrator --password mypassword
            --url https://192.168.111.52/sdk/vimService
            --fields hostname, portnumber ,boottime,cpumodel,cpuspeed,
                 cpuusage,filesystem,host_status, maintenancemode,
                 memorysize,memoryusage,networkadapters,portnumber,
                 rebootrequired,        software,vmotion
            --datacenter ha

List all hosts and all the properties of the hosts. The results are displayed in the file mentioned in fileoutput.

 hostinfo.pl --username administrator --password mypassword
            --url https://192.168.111.52/sdk/vimService
            --fileoutput D:\Output\result.xml

Lists the properties of only one host having the ip address specified in the hostipaddress

 hostinfo.pl --username administrator --password mypassword
            --url https://192.168.111.52/sdk/vimService
            --hostipaddress 192.168.111.2

Lists the properties of all the hosts having their maintenance mode and vmotion property as specified in maintenancemode and vmotion respectively.

 hostinfo.pl --username administrator --password mypassword
            --url https://192.168.111.52/sdk/vimService --maintenancemode 0
            --vmotion 1

Lists the properties of all the hosts part of the folder as specified in folder.

 hostinfo.pl --username administrator --password mypassword
          --url https://192.168.111.52/sdk/vimService
          --folder myfolder


SUPPORTED PLATFORMS

This script works with VMware VirtualCenter 2.0 or later.

This script works with VMware ESX Server 3.0 or later.