Unsupported content


This version of the product is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.


discovery.runCommand(target, command)

Returns a DiscoveredCommandResult node containing the result of running the specified command.

Where command is the command to run, and the target node can be one of the following:

  • 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

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;

Possible post-processing required on UNIX/Linux hosts

When a pattern executes a command on a UNIX/Linux host, the result returned can contain control characters used to display colors and other formatting. The pattern should not rely on being able to use the result without some additional processing such as regular expression matching and extraction.

Was this page helpful? Yes No Submitting... Thank you