Populating the CUSTOMER property in TrueSight Server Automation
To use multi-tenancy in TrueSight Server Automation - Data Warehouse, you must populate the CUSTOMER property for servers in TrueSight Server Automation. If you are adding new servers, set the default value of this property for those servers. For existing servers, either populate this property for each server manually, or use a script to update multiple servers simultaneously. When you use a script, you can populate this property for a set of servers which are named in a particular pattern or belong to a range of IP addresses.
- To populate the CUSTOMER property for each server manually
- To populate the CUSTOMER property for multiple servers by running a script
- Where to go from here
To populate the CUSTOMER property for each server manually
- Open the TrueSight Server Automation console.
- Expand the Servers folder.
- Select the required server.
- Update the CUSTOMER property as shown in the following figure:
To populate the CUSTOMER property for multiple servers by running a script
- Group the servers by creating a server smart group.
Copy the following script to a text file and save that file as fileName.nsh:
PROFILE=$1
USER=$2
PASSWORD=$3
ROLENAME=$4
GROUP=$5
PROPERTY=$6
TENANT=$7
echo "Running command: setTenantProperty.nsh $PROFILE $USER $PASSWORD $ROLENAME $GROUP $PROPERTY $TENANT"
CONNECT=`blcred cred -acquire -profile $PROFILE -username $USER -password $PASSWORD`
if [ $? -eq 0 ]; then
echo "Connect output: $CONNECT"
echo "Successfully connected to the app server"
blcli_init
blcli_setoption serviceProfileName $PROFILE
blcli_setoption roleName $ROLENAME
blcli_connect
blcli_execute PropertyClass isPropertyDefined Class://SystemObject/Server $PROPERTY
blcli_storeenv PROPERTY_EXISTS
if [ "$PROPERTY_EXISTS" = "true" ]; then
blcli_execute SmartServerGroup findGroupByQualifiedName $GROUP
GROUP_EXISTS_RETURN_CODE=`echo $?`
blcli_storeenv GROUP_EXISTS
if [ $GROUP_EXISTS_RETURN_CODE = 0 ]; then
blcli_execute Server listServersInGroup $GROUP
blcli_storeenv SERVER_LIST
for serverName in $SERVER_LIST
do
echo "Setting Property value for $PROPERTY on $serverName as $TENANT"
blcli_execute Server setPropertyValueByName $serverName $PROPERTY $TENANT
done
else
echo "ERROR: The server smart group could not be found"
fi
else
echo "ERROR: The tenant property is not defined"
fi
blcli_destroy
else
echo "Connect output: $CONNECT"
echo "ERROR: Authentication failed"
fi- Add the fileName.nsh script to the Depot folder.
- Create and execute an NSH Script Job.
To create a server smart group
- Open the TrueSight Server Automation Console.
- Right-click the Servers folder and select New > Server Smart Group.
- In the New Server Smart Group wizard, enter the name and description for the smart group.
- Enter the condition to group the servers.
The following figure shows a group, ServerSmartTenant1, which contains all the servers that have names ending with clbro.com. - Click Next, and then Finish.
The server smart group is added to the Servers folder.
To add the script to the Depot folder on TrueSight Server Automation
- Right-click the Depot folder and select New Depot Folder.
- In the New Depot Folder wizard, enter a name for the folder, such as TenantFolder, and then click Finish.
- Right-click the TenantFolder folder and click New > NSHScript.
- In the Add NSH Script to Depot wizard, enter a name for the script.
- In the File Location field, browse to the location of the fileName.nsh script that you created earlier.
- In the Script Type field, select the Execute script once, passing the host list as a parameter to the script option.
- Click Next.
Add the following parameters:
Parameter
Value
PROFILEName of an existing TrueSight Server Automation Authentication Service profile
USERTrueSight Server Automation user who has all the required access to the server smart group
PASSWORDPassword for the TrueSight Server Automation user
ROLENAMERole of the TrueSight Server Automation user
GROUPFull path of the server smart group starting with ‘/’
For example, if you have created the ServerSmartTenant1 server smart group directly in the Servers folder, enter /ServerSmartTenant1.PROPERTYName of the server property
In this case, enter CUSTOMER.TENANTValue for the CUSTOMER property
SERVER%h
- Click Next, and then click Finish.
To create and run the NSH Script Job
- Right-click the Jobs folder and click New > Job Folder.
- In the New Job Folder dialog box, enter a name for the folder.
- Click Next, and then click Finish.
- Right-click the new job folder and click New > NSH Script Job.
- In the New NSH Script Job wizard, enter a name for the job.
- In the NSH Script field, browse to the location of NSH Script you created in To add the script to the Depot folder on TrueSight Server Automation.
- Click Next.
- Select the ServerSmartTenant1 server smart group and move it to the Selected Server list.
- Click Next.
- Verify the values of the script parameters, and click Next.
- In Job Run Notifications, select the required option, and click Next.
- Select the Execute job now option, and click Finish.
When the job is complete, the Status column in the right pane displays the following message:
Completed successfully
The CUSTOMER property for the servers in the smart group is updated with the value that you provided while creating the NSH Script.
Where to go from here