Walkthrough: Setting a property value on a server using a component template
This topic walks you through the process of creating server smart groups based on the values set from a Compliance Job. You can accomplish this by using a TrueSight Server Automation component template to set a property value on a server. This topic walks you through the process.
The topic includes the following sections:
The problem we have w/ server properties is beyond the default/intrinsic ones it’s really painful to set them. right not it involves running nsh scripts, then blcli to set them, which is slow and can hoze your env (parallel type 1 nsh + blcli = bad). so this seems a bit of a back-door way to accomplish the same in a less taxing way.
How to correctly use in a compliance job and via the persist operator – I want to ultimately use server smart groups based on the values set from compliance jobs. Does this set a server property? I need some help with property classes / instances.
persisting the value into a server property that can be used later for server smart group membership
run a compliance job that does some kind of check like “is this thing there”, and as part of the check, setting a property value if it’s there or not. then to create a server smart group based on the value of that property.
When we run compliance against server/component persist will create an instance of those custom property. If we had created a smart group using this property than servers are populated accordingly.
When we run against target it will create instance of that property class and set that property accordingly, later used in remediation.
You could have multiple commands/persists. The persist bit should handle the creation of a property instance for the server and setting it as the value for the property in the server class (i think, we’ll see).
the server class links to the custom class (eg remediation properties) and the value on the server is set to the instance we are modifying in the persist then it should all work
What do I need to do before I get started?
For this walkthrough, you log on as BLAdmin, the default superuser for TrueSight Server Automation. Note that in live deployments, BMC recommends that you grant access based on roles with a narrower set of permissions.
Using the TrueSight Server Automation console, set up a component template with some compliance rules, according to the instructions in Walkthrough: Creating a compliance template.
How to set a property value on a server
Using the TrueSight Server Automation console, set up a custom class with the property values you want.
Next, set a property in the server class.
|Fill in the Add Property window as follows. Be sure to call the new property |
Link the server property to the custom class.
Modify the compliance rules you set up so that the rules use the ‘persist’ operator to run some command on the server and set the value of a property in the custom class to the output of the command.
Persist Command.xyz = ??PROPERTY??
TARGET.OS = XXX
To use that in a smart group you’d make a condition in the smart group like SERVER_CLASS_PROPERTY.YOURPROPERTY equals XXX or whatever.
Wrapping it up
In this walkthrough, you created a component template that runs a command, gets the output and sets a property value on the server. You can then use that value as a condition in a server smart group.