apply_template

Applies a monitoring template to a list of specified targets. The options to the verb can be supplied in any order.

Format

emcli apply_template
        -name="template_name"
        -targets="tname1: ttype1;tname2: ttype2;..."
        [-copy_flags="0" or "1" or "2"]
        [-replace_metrics="0" or "1"]

[ ]  indicates that the parameter is optional

Options

  • name

    Template name as it exists in the database. Names cannot contain colons ( : ), semi-colons ( ; ), or any leading or trailing blanks.

  • targets

    The targets should be specified in the following sequence:

    TargetName1:TargetType1;TargetName2:TargetType2

    For example:

    db1:oracle_database;my db group:composite

    A semi-colon is the target separator. Ideally, non-composite targets should be of the target type applicable to the template. If not, the template is not applied to the indicated target. For composite targets, the template is applied only to the member targets that belong to the target type for which the template is applicable.

  • copy_flags

    This applies only for metrics with multiple thresholds.

    '0' indicates: Apply threshold settings for key values common to the template and target.

    '1' indicates: Remove key value threshold settings in the target and replace them with key value threshold settings from the template.

    '2' indicates: Apply threshold settings for all key values defined in the template. The default is '0'.

  • replace_metrics

    0 indicates that the thresholds of the metrics not included in the template but available in the target will not be changed. This is the default value. 1 indicates that the thresholds of the metrics present in the target, but not in the template, will be set to NULL. That is, such metrics in the target will not be monitored and therefore, no alert will be raised for them.

Examples

Example 1

This example applies a monitoring template named my_db_template. This template applies to targets of type oracle_database, and it is being applied to db1 , which is of type oracle_database, and my_db_group, which is of type composite.

For composite targets, the template is only applied to member targets that belong to the target type for which the template is applicable. Since the copy_flags is not specified, the default ("Apply threshold settings for monitored objects common to both template and target") is meant.

emcli apply_template 
      -name="my_db_template"
      -targets="db1:oracle_database;my_db_group:composite"

Example 2

This example applies the monitoring template named my_db_template. This template is applicable to targets of type oracle_database. This command applies this template to two targets: target db1 of type oracle_database and target my_db_group of type composite.

For composite targets, the template is applied only to the member targets that belong to the target type for which the template is applicable. In this case, since the copy_flags option is specified as "1", the template is superimposed on the target. All keys in the template are copied to the target, and any extra keys present in the target are deleted.

The replace_metrics flag set to 1 denotes that the thresholds of the metrics present in the target, but not in the template, are set to NULL. That is, these metrics in the target are not monitored, and therefore, no alert is raised for them.

emcli apply_template -name="my_db_template"
          -targets="db1:oracle_database;my_db_group:composite"
          -copy_flags="1" -replace_metrics="1"