Future.runCommand

Future.runCommand(target, command, path_to_command)


Returns a DiscoveredCommandResult node containing the result of running the specified command. Enables command paths to be restricted.

The Future.runCommand function is similar to discovery.runCommand but has an additional parameter specifying the path to the command. The new parameter is intended to be merged with discovery.runCommand in a future release, and the Future.runCommand function deprecated.


Where command is the command to run.

The path_to_command parameter is the path to the command including the command itself, without arguments.

Where the function encounters short 8.3 format paths on Windows, it expands them to the full path. To determine the full path, it will run additional commands. 

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 table compares existing discovery.runCommand function call with their Future.runCommand equivalents:

Existing discovery.runCommandEquivalent Future.runCommandSource of example (TKU pattern module)

discovery.runCommand(
process, "%process.cmd% -v");

Future.runCommand(process, "%process.cmd% -v", process.cmd);

Acresso.FLEXnetPublisher
discovery.runCommand(
host,
'%install_root%%sep%bin%sep%activemq --version');

Future.runCommand(
    host,
    '%install_root%%sep%bin%sep%activemq --version',
    "%install_root%%sep%bin%sep%activemq");

Apache.ActiveMQ
discovery.runCommand(
host,
'(. %install_dir%/sqllib/db2profile && db2 list node directory)');

Future.runCommand(
    host,
    '(. %install_dir%/sqllib/db2profile && db2 list node directory)',
    '%install_dir%/sqllib/db2profile');

 IBM.DB2.RDBMS

jenkins_cmd := '%process.cmd% -jar %jenkins_war_file% --version';
jenkins_version := discovery.runCommand(host, jenkins_cmd);

jenkins_cmd := '%process.cmd% -jar %jenkins_war_file% --version';
jenkins_version := Future.runCommand(
    host,
    jenkins_cmd,
    [process.cmd, jenkins_war_file]);

OpenSource.Jenkins

version_command := "cmd /c %install_root%\\etc\\iw.tssearch -v";
version_output := discovery.runCommand(host, version_command);

version_command := "%install_root%\\etc\\iw.tssearch";
version_output := Future.runCommand(
    host,
    "%version_command% -v",
    version_command);

Autonomy.InterwovenUniversalSearch


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 colours 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

Comments