Walkthrough: Obtaining the hardware information for a specific server using RESTful web services
This topic walks you through the process of using the TrueSight Server Automation Command Line Interface (BLCLI) Get command in a REST query to pull hardware or server data from a server.
This topic includes the following sections:
This topic is intended for system administrators who want to use a script to query the servers in their environment and obtain specific model information.
What does this walkthrough show?
In this walkthrough, a system administrator wants to use a script to obtain hardware information from servers in the TrueSight Server Automation managed environment. The administrator wants to use this information to create Smart Groups based on the hardware model of a server.
This walkthrough shows an example of how you can obtain the hardware information of a specific server using the BLCLI GET command within a script.
How to obtain hardware information for a server using RESTful web services
Within the Servers folder, create a Smart Server Group.
Repeat the process for any other model types you want to identify.
The first thing you need to do is to create the script that contains the BLCLi commands.
You can use Notepad, vi editor,I or a similar editor in NSH on either the local desktop computer or on a server managed by TrueSight Server Automation.
The first part of the script obtains the DB key for the server, and then uses the DB key to create a list of the data you can get from the server.
This example uses
The second query lists all the assets for the server, but not the properties and other information that the first query listed.
Next, we go down another level using the SystemInfo uri from resp2.
Note: The SystemInfo provides the same information as the Hardware Information item when you Live Browse the server.
|5||The next step is to obtain the model information. In this example, examining the output of resp3 displays the URI component for the model information.|
Next, use the GET command to obtain just the model information.
As an alternative, you could just process the output from the SystemInfo hardware component.
The output from
|8||Save the script.|
The next step is to add the script to the Depot.
Next, create an NSH Script Job based on the script that you added in the previous step.
Execute the NSH Script Job.
Browse to the Server folder. The servers are included in the Smart Groups you created, grouped by model type.
Wrapping it up
Congratulations! You have used the BLCLI and REST web services to obtain the hardware information for a specific server, and have categorized the servers in smart groups based on the hardware information you obtained.