discovery.runCommand
discovery.runCommand(target, command)
Returns a DiscoveredCommandResult node containing the result of running the specified command.
The function takes the following parameters:
- target, where target is:
- a node used to identify the discovery target; one of the following nodes:
- Host
- DiscoveryAccess
- DiscoveredDirectoryEntry
- DiscoveredFQDN
- DiscoveredHBA
- DiscoveredListeningPort
- DiscoveredNetworkConnection
- DiscoveredNetworkInterface
- DiscoveredProcess
- DiscoveredSNMPRow
- DiscoveredWMI
- SQLResultRow
- DirectoryListing
- DiscoveredPackages
- DiscoveredSNMPTable
- DiscoveredWMIQuery
- FQDNList
- HBAInfoList
- IntegrationResult
- InterfaceList
- NetworkConnectionList
- ProcessList
- DeviceInfo
- DiscoveredCommandResult
- DiscoveredFile
- DiscoveredPatches
- DiscoveredRegistryValue
- DiscoveredSNMP
- HostInfo
- Or a data source against which the request is performed. See also, discovery-dataSource.
- a node used to identify the discovery target; one of the following nodes:
The following code examples shows discovery.runCommand being used to determine the publisher of a Java virtual machine. This comes from the TKU Java VM pattern.
publisher_command := '%javacmd_path% -version';
// Run java -version and extract the publisher
ran_pub_cmd := discovery.runCommand(host, publisher_command);
...
...
if ran_pub_cmd then
log.debug("Publisher command output: %ran_pub_cmd.result%");
cmd_publisher := regex.extract(ran_pub_cmd.result,
regex'(?i)(hotspot|gnu|ibm|bea|sun)', raw'\1');
end if;
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*