1 of 1 people found this helpful
There are a bunch of different ways of doing this - some are more complex than others, but "slicker"!
As a simple solution, you could do something like the following:
- Create a new config file which expects something like "DB_PLATFORM=Oracle"
- Create a version of this config file for each alternative (i.e. one for Oracle, one for SQL, etc)
- Create a BLPackage for each of these to simply deploy the file to a predefined location (as defined ba the config object)
- Create a compliance job which has the DB as the signature, then as a compliance check, expects to see the config object with the correct value, then auto-remediates with the relevant BLPackage if it's missing.
- Create a new server property - something like DB_PLATFORM
- Write an NSH script which reads the config file and uses it to set the server property (e.g. blcli Server setPropertyValueByName targetServer DB_PLATFORM Oracle)
- Run this as part of a batch job which does a Component Discover, Compiance, NSH Script Job for the target servers.
- NOW you can use that new property to create a Server Smart Group
As I said, there are maybe cooler ways to do this, but this method is simple to implement, simple to troubleshoot, and involves the least scripting.
Hope that helps!
Create component templates that contains a discovery condition that identifies the server types.
Run a discovery job for the templates
Create a server smart group w/ the condition like ‘TEMPLATES*’ = one of the templates
Wot Bill said - it's even easier than what I suggested!
This is awesome! Thanks Bill
FYI the operands are 'assign', 'persist' and 'contains'
no equals so obviously easiest to use contains
I'm finally able to spend some time to implement this, I currently have "Windows Service:SQL Server (MSSQLSERVER)" exists, however the service will have a different name if the SQL instance has been renamed e.g. "Windows Service:SQL Server (INSTANCE1)", "Windows Service:SQL Server (INSTANCE2)" etc..
Can I wildcard the service name? I want to discover servers where , "Windows Service:SQL Server" exists
Instead of "exists" do you have the ability to choose "starts with" (or something similar) instead? And leave off the () part.
You may also want to give the registry keys a try too:
There is one for instance name, but cant recall of top of my head.
Bill - We have a compliance job that runs daily, I would like to set a server property based on the compliance job rule results. How would I do this?
you can use the 'persist' operator to set a property in the 'remediation properties' class for the server. there will be a property instance in that class for each server and the server class should point to the remediation properties class. afaik there's no way to directly set a server property in a compliance job.
John - I am trying to do something similar, how are you pulling results from the compliance rule, and how are you identify the targetServer name to write the property value to?
It's mentioned in this thread that it can be done with a batch job and an NSH script as part of the batch job (discovery, compliance, nsh script). How would I pull the compliance rule results, and write it to the server property using NSH script?
why do you need to use compliance to do this ?
john's method is a bit convoluted:
Create a new config file which expects something like "DB_PLATFORM=Oracle"
Create a version of this config file for each alternative (i.e. one for Oracle, one for SQL, etc)
Create a BLPackage for each of these to simply deploy the file to a predefined location (as defined ba the config object)
Create a compliance job which has the DB as the signature, then as a compliance check, expects to see the config object with the correct value, then auto-remediates with the relevant BLPackage if it's missing.
-> 'remediation' here deploys something that puts a file on the file system. then a script to read was was written to the targets and set the value. that's a lot of extra steps imo.
Create a new server property - something like DB_PLATFORM
Write an NSH script which reads the config file and uses it to set the server property (e.g. blcli Server setPropertyValueByName targetServerDB_PLATFORM Oracle)
-> why not just have the nsh script do the check directly instead and then set the property value ?
Bill - I'm new to Bladelogic and NSH scripting, could you send me a sample script that would do this?
setting a server property value is a simple command:
blcli_execute Server setPropertyValueByName serverName propertyName propertyValue
so what are you trying to do here ?