The Hunger Site

Friday, May 9, 2014

Leveraging Target Properties to Enhance Enterprise Manager Capabilities

By Courtney Llamas

Do you still maintain a spreadsheet with Database or Server contact or business unit ownership?  In Oracle Enterprise Manager 12c (EM) Target Properties allow you to store descriptive target information, such as Contact or Location, which can then be used in dynamic/administration group definition, reports, incident rules and notifications.   This blog will show you how you can better leverage the features of EM to store your configuration data and utilize it to the fullest extent. 
The out-of-the-box target properties include:
  • Contact
  • Cost Center
  • Customer Support Identifier
  • Department
  • Life Cycle Status (Development, Test, Staging, Mission Critical, Production)
  • Line of Business
  • Location
  • Operating System – populated by collected configuration data
  • Platform Target Type – populated by collected configuration data
  • Target Version – populated by collected configuration data
LifeCycle Status
The LifeCycle Status target property has a special role within EM 12c.   The values are restricted to one of the predefined options:  Development, Test, Staging, Production, Mission Critical.   The value of this property is used by EM when it is under heavy load in prioritizing incoming alerts and data.   Mission Critical and Production targets are given the highest priority so that alerts always get loaded.   Targets of Development or Test status may be asked to "back off" until the load returns to a manageable level.  You can not add to these values, but you can modify the display name with EM CLI.   For example, you could use the command below to rename the Test status to QA.   
$ emcli modify_lifecycle_stage_name  -name="Test"  -new_name="QA" 
Setting Target Properties
To set target properties on an individual target, you can select the target menu (i.e. Host, Oracle Database) then selectTarget Setup / Properties and click the Edit button. This will provide an input screen such as the following:
As you can see, the Operating System, Platform, Target Version and Customer Support Identifier are not editable.  These are inherited from settings elsewhere or through configuration data collected by EM.
The most efficient time to set target properties is when you’re discovering or promoting a new target.   You will see a button Set Global Target Properties which will set the target properties for all selected targets. 
This will open a dialog box where you can set the target properties for all selected targets.  
If you're unable to set the properties while discovering a large number of databases, your best bet is to bulk set target properties using EM’s Command Line Interface (EM CLI).  In the example below we set the group MyProdGroup to a LifeCycle Status of Production.  The flag –propagate_to_members can be used to cascade target properties to a targets members, such as a group, domain or cluster.  In this example, all members of MyProdGroup would have a LifeCycle Status of Production.
$ emcli set_target_property_value 
-property_records="MyProdGroup:composite:LifeCycle Status:Production" 
Using EM CLI can be very helpful when setting target properties on a large number of targets, or when you want to modify a large number of targets (e.g. changing Department of Support to Operations).  For a sample script that can be leveraged for setting target properties in bulk please see the previously published blog Using EM CLI for mass update of Lifecycle Status Property Value.
User Defined Target Properties
EM also allows you to create custom target properties, or User Defined Target Properties.  While you cannot use custom target properties in dynamic or administration group selection criteria, you can use them for reporting and notifications.  Creating custom target properties is accomplished by using EM CLI and providing the property name and the target type it applies to.  While it is possible to set a custom property for just one target type, it is recommended to standardize these custom properties across all target types as they are stored in a sequential fashion (udtp_1, udtp_2, etc).  If you set per target type, udtp_1 may be Owner on Host targets and Function on Oracle Database targets.  This can cause confusion in reporting and notifications as you will see later.   
To add a custom target property for Owner, we use the EM CLI command below:
$ emcli add_target_property –target_type=”*” –property=”Owner”
Next, we’re going to set the value of the Owner target property to Courtney for a particular target (emrep) of target type (oracle_database).
$ emcli set_target_property_value 
On the following screen you can see that we’ve got a new property “Owner” with a value set to Courtney.
Utilizing Target Properties
All target properties are stored in the MGMT_ALL_TARGET_PROPS table with corresponding internal names (udtp_1, udtp_2, etc.).   The following query will show you what the internal names are:

SQL>  select property_display_name, property_name      from mgmt$all_target_prop_defs;
PROPERTY_DISPLAY_NAME          PROPERTY_NAME------------------------------ -------------------------Comment                        orcl_gtp_commentContact                        orcl_gtp_contactCost Center                    orcl_gtp_cost_centerCustomer Service Identifier    orcl_gtp_csiDepartment                     orcl_gtp_departmentDeployment Type                orcl_gtp_deployment_typeLifeCycle Status               orcl_gtp_lifecycle_statusLine of Business               orcl_gtp_line_of_busLocation                       orcl_gtp_locationOperating System               orcl_gtp_osPlatform                       orcl_gtp_platformTarget Version                 orcl_gtp_target_versionOwner                          udtp_1
Now you can access the custom target properties through their internal names in custom notification scripts. For instance, OS Command notifications can call the environment variables such %UDTP_1%, %ORCL_GTP_LIFECYCLE_STATUS%, etc.    
Properties can also be accessed in reports against the MGMT$ view tables, which will allow you to build custom reports that show additional target information such as Owner or LifeCycle Status. 
SQL> select t.target_name, t.target_type,
       d.property_display_name, p.property_value
     from mgmt$target t,          mgmt$target_properties p,          mgmt$all_target_prop_defs d     where t.target_guid=p.target_guid       and p.property_name=d.property_name       and p.property_value is not null;
TARGET_NAME          TARGET_TYPE      PROPERTY_DISPLAY_NAME PROPERTY_VALUE-------------------- ---------------- --------------------- --------------emrep                oracle_database  Target Version                oracle_database  Owner                 Courtneyemrep                oracle_database  Operating System      Linuxemrep                oracle_database  Platform              x86_64
By leveraging the out-of-the-box Target Properties and the User Defined Target Properties, you can easily extend the flexibility of EM’s groups, incident rules, reports and notifications to suit your business needs. For additional information on Target Properties used in Administration Groups see the Oracle Enterprise Manager Cloud Control 12c Administrator's Guide.   

By Courtney Llamas

No comments:


Opinions expressed in this blog are entirely the opinions of the writers of this blog, and do not reflect the position of Oracle corporation. No responsiblity will be taken for any resulting effects if any of the instructions or notes in the blog are followed. It is at the reader's own risk and liability.

Blog Archive