Executing BLCLI commands
The following table describes the adapter request elements to execute BLCLI commands. To override the configuration properties in the adapter configuration, include the <user-role> element in the request.
Adapter request elements to execute BLCLI commands
Element | Definition | Required |
|---|---|---|
<user-role> | Specifies the user role for executing commands on the server hosting BMC Server Automation | No |
<command> | Contains the elements required to execute a BLCLI command | Yes |
<namespace> | Specifies the BladeLogic namespace in which to execute the command | Yes |
<command-name> | Contains the BLCLI command | Yes |
<arguments> | Contains the argument elements | No |
<argument> | Contains the arguments for the BLCLI command | No |
The following code snippet illustrates a sample adapter request for the BLCLI method with the printAllProperties command:
<bladelogic-request>
<request-data>
<user-role>BLAdmins</user-role>
<command executable-type="cli" timeout-secs="30">
<namespace>Server</namespace>
<command-name>printAllProperties</command-name>
<arguments>
<argument>192.168.0.10</argument>
</arguments>
</command>
</request-data>
</bladelogic-request>
Each adapter request returns a response with the results of the command execution. The contents of the output element contain the information returned by BMC Server Automation. The following code snippet shows the adapter response for the sample adapter request for the BLCLI:
<bladelogic-response>
<metadata>
<status>success</status>
</metadata>
<targets-output>
<target-output>
<metadata>
<os-id>Windows 2003</os-id>
<os-version>5.2</os-version>
<os-arch>x86</os-arch>
<status>success</status>
</metadata>
<commands-output>
<command-output>
<metadata>
<command>blcli_execute Server printAllProperties 192.168.0.10</command>
<line-count>52</line-count>
<execution-milliseconds>7734</execution-milliseconds>
<exit-code>0</exit-code>
<status>success</status>
</metadata>
<output>
<line index="1">STATE = Enrolled</line>
<line index="2">ON_EDGE = false</line>
<line index="3">REPEATER_STAGING_DIR = /tmp/stage</line>
<line index="4">ROLE_CREATED = BLAdmins</line>
<line index="5">HOSTIP_BITS = 00001010100000000111000010101010</line>
<line index="6">OS_VERSION = 2003</line>
<line index="7">USER_CREATED = bladeuser</line>
<line index="8">OS_VENDOR = Microsoft</line>
<line index="9">IP_ADDRESS = 8.128.112.170</line>
<line index="10">STAGING_DIR = /temp/stage</line>
<line index="11">SYSTEMROOT = /C/WINDOWS</line>
<line index="12">DATE_MODIFIED = 2009-10-30 13:14:54</line>
<line index="13">OS_PLATFORM = x86</line>
<line index="14">IS_ONLINE = true</line>
<line index="15">AGENT_STATUS = agent is alive</line>
<line index="21">FQ_HOST = RnD-QA1.rndlabs.qa.com</line>
<line index="16">MS_OFFICE_INSTALL_USERNAME = </line>
<line index="17">HOST = vm1</line>
<line index="18">REPEATER_MAX_CACHE_SIZE = 0</line>
<line index="20">OS_RELEASE = 5.2</line>
<line index="21">ROLE_MODIFIED = BLAdmins</line>
<line index="22">AUTO_GENERATED = false</line>
<line index="23">SUBNET_MASK = 255.255.240.0</line>
<line index="24">NETWORK_ADDRESS = 10.128.112.0</line>
<line index="25">OS_PATCHLEVEL = SP2</line>
<line index="26">IS_REPEATER = true</line>
<line index="27">RSCD_DIR = /C/Program Files/BMC BladeLogic/RSC</line>
<line index="28">RSCD_VERSION = 7.5.0.264</line>
<line index="29">OS = Windows</line>
<line index="30">VM_WS_USERNAME = </line>
<line index="31">BROKEN_OBJECT = false</line>
<line index="32">USER_MODIFIED = bladeuser</line>
<line index="33">BUILD_ENVIRONMENT = Windows2003-x86</line>
<line index="34">DEPLOYPATH = </line>
<line index="35">DATE_CREATED = 2009-10-30 13:14:54</line>
<line index="36">VM_VIRTUAL_MACHINE = false</line>
<line index="37">NAME = 192.168.0.10</line>
<line index="38">IS_DEPLOYABLE = true</line>
<line index="39">WINDIR = /C/WINDOWS</line>
<line index="40">PUSH_ACL_NO_USERS_FLAG = true</line>
</output>
</command-output>
</commands-output>
</target-output>
</targets-output>
</bladelogic-response>
The following code snippet illustrates a sample adapter request for executing the listAllServers BLCLI command without any arguments:
<bladelogic-request>
<request-data>
<command executable-type = "cli" timeout-secs = "30">
<namespace>Server</namespace>
<command-name>listAllServers</command-name>
</command>
</request-data>
</bladelogic-request>
The following code snippet shows the adapter response for the sample adapter request with the listAllServers command:
<bladelogic-response>
<metadata>
<status>success</status>
</metadata>
<targets-output>
<target-output>
<metadata>
<os-id>Linux</os-id>
<os-version>2.6.9-67.ELsmp</os-version>
<os-arch>i386</os-arch>
<status>success</status>
</metadata>
<commands-output>
<command-output>
<metadata>
<command>blcli_execute Server listAllServers</command>
<line-count>22</line-count>
<execution-milliseconds>10982</execution-milliseconds>
<exit-code>0</exit-code>
<status>success</status>
</metadata>
<output>
<line index="1">vm-w23-abc1022</line>
<line index="2">10.118.29.145</line>
<line index="3">Sanity10</line>
<line index="4">Sanity11</line>
<line index="5">vm-w28-abc456</line>
</output>
</command-output>
</commands-output>
</target-output>
</targets-output>
</bladelogic-response>
The following code snippet illustrates a sample adapter request for executing the groupNameToID BLCLI command:
<bladelogic-request>
<request-data>
<command executable-type="cli" timeout-secs="300">
<namespace>JobGroup</namespace>
<command-name>groupNameToId</command-name>
<arguments>
<argument>"/AOTest"</argument>
</arguments>
</command>
</request-data>
</bladelogic-request>
The following code snippet shows the adapter response for the groupNametoId command:
<bladelogic-response>
<metadata>
<status>success</status>
</metadata>
<targets-output>
<target-output>
<metadata>
<os-id>Linux</os-id>
<os-version>2.6.9-67.ELsmp</os-version>
<os-arch>i386</os-arch>
<status>success</status>
</metadata>
<commands-output>
<command-output>
<metadata>
<command>blcli_execute JobGroup groupNameToId "/AOTest" </command>
<line-count>1</line-count>
<execution-milliseconds>8741</execution-milliseconds>
<exit-code>0</exit-code>
<status>success</status>
</metadata>
<output>
<line index="1">2000004</line>
</output>
</command-output>
</commands-output>
</target-output>
</targets-output>
</bladelogic-response>