Building Scope Sets from Discovered Systems - TADDM/taddm-wiki GitHub Wiki
Occasionally there is a need to build scope sets from existing, discovered systems in TADDM. For instance, you may want to build a scope set of all discovered AIX systems so that you can quickly rediscover them. The following Jython script was built to make this easier.
Installation
Download buildscope.jy and place it under $COLLATION_HOME/custom.
Usage
buildscope.jy [options]
This script must be run from a discovery server.
Options:
-u userid User required to login to TADDM Server
Defaults to 'administrator'
-p password Password for TADDM Server user
Defaults to 'collation'
-H host Hostname for connection
Defaults to 'localhost'
-P Include private IP addresses in scope
Default is to exclude all private IP addresses
-q query [REQUIRED] MQL query where the result is ComputerSystem instances
Recommended that name, fqdn and ipInterfaces attributes queried
-h print this message
How it Works
After executing the ComputerSystem query, the IpInterface components are inspected. If an IP address is found that matches the system contextIp then that IP is used. By default, any private IP addresses are removed from consideration. Next, an IP address that matches the contextIp of a child fileSystem component is used. The strategy here is to find a contextIp that most likely was not set by a hypervisor sensor, but rather the computer system sensor. Then the fqdn is used to get a hostname. A reverse DNS lookup is done against that hostname to find an IP address. Then the name attribute is used to do a reverse DNS lookup to find an IP address.
All scopes are written to standard output, so you need to redirect output to a file to capture the scopes. Standard error is used liberally for logging.
Examples
The following example builds a scope set from all of the System P LPARs.
buildscope.jy -q "select ComputerSystem.fqdn, ComputerSystem.name, ComputerSystem.ipInterfaces from ComputerSystem, SystemPComputerSystem where ComputerSystem.hostSystem.guid == SystemPComputerSystem.guid AND ComputerSystem.virtualMachineState != '3' AND ComputerSystem.type != 'VIOS' AND ComputerSystem.type != 'HMC'"
The following example builds a scope set from all of the Linux VMs running on VMware, leaving out the VMs that are stopped (virtualMachineState is 3).
buildscope.jy -q "SELECT LinuxUnitaryComputerSystem.fqdn, LinuxUnitaryComputerSystem.name, LinuxUnitaryComputerSystem.ipInterfaces FROM LinuxUnitaryComputerSystem, VmwareUnitaryComputerSystem WHERE LinuxUnitaryComputerSystem.hostSystem.guid == VmwareUnitaryComputerSystem.guid AND LinuxUnitaryComputerSystem.virtualMachineState != '3'"
Troubleshooting
If no scopes are being generated, it might be because your target environment uses private IP addresses. Try adding the -P option.
There are some cases where the script just can't find a good IP address to use. Make sure that you are feeding in all the proper select attributes to increase the chance that a hit will occur.