ITCM has a set of web services methods to obtain information from Agents, Groups, Software, etc., but some information is not accessible using a single soap call.
How to obtain IP Address of an Agent using Web Services?
In order to get this information, there are 4 web service methods needed:
The steps to obtain this information are as follow:
1.- Obtain SessionID of an user with permission to see all Agent machines using the format winnt:\\hostname\user
2.- Get the "systemGroupUUID" of 'All Computer' group using the method GetSystemGroupUUID, which needs as an input the group identifier, which on this case is "CO-ALL-COMPUTERS"
3.- Using value obtained from previous call, fill the variable called "unitGroupId" on method OpenUnitGroupComputerMembersList2.
Additionally, this call lets search for any specific Agent in the environment that is part of 'All Computers' system group (based on step #2). To perform this search, the following values must be used:
filterCondition = 2
computerProperty = 1 (which is the COMPUTER_LABEL of the Agent machine)
searchString = <agent_name> (the actual name or label of Agent).
- "filterCondition" variable can have the following values:
COMPUTER FILTER WILDCARD EQUAL TO = 0,
COMPUTER FILTER WILDCARD NOT EQUAL TO = 1,
COMPUTER FILTER EQUAL TO= 2,
COMPUTER FILTER NOT EQUAL TO= 3,
COMPUTER FILTER GREATER THAN = 4,
COMPUTER FILTER GREATER THAN EQUAL TO= 5,
COMPUTER FILTER LESS THAN= 6,
COMPUTER FILTER LESS THAN EQUAL TO= 7
- "computerProperty" values can be any of the following:
UUID = 0
LABEL = 1
PRIMARY_NETWORK_ADDRESS = 2
HOST_NAME = 3
SERIAL_NUMBER = 4
DISC_SERIAL_NUMBER = 5
PRIMARY_MAC_ADDRESS = 6
ASSET_TAG = 7
CLASSID = 8
USAGE_LIST = 9
URI = 10
SYSTEM_ID = 11
VENDOR_NAME = 12
DOMAIN_LABEL = 13
CREATION_USER = 14
CREATION_DATE = 15
LAST_UPDATED_USER = 16
LAST_UPDATED_DATE = 17
VERSION_NUMBER = 18
CP_COMPUTER_AGENT_NAME = 19
Finally, under tag "computerPropertiesRequired" there are several fields that can be used, on this case, to obtain Ip Address the field "agentIPAddressRequired" must be set to "1" (and add any other field as required).
The result of this call should give you 2 results, 'OpenListHandle' and 'totalNoOfComputers'. The first is a mandatory field wihch will be used on the last call, and the second means how many Agents were found with the search made. If the result of this is "0", means that the filter made didn't find any Agent and must be done again changing the way the Agent is being searched.
4.- Run method GetUnitGroupComputerMembers2 using the values obtained in the previous call in "listHandle" and "noOfComputers". This last call will bring you the IP of the Agent and any other field you included in the call made on step #3.