This documentation supports releases of BMC Helix Continuous Optimization up to December 31, 2021. To view the latest version, select the version from the Product version menu.

Examples for adding tags by using custom tagging rules

This topic provides examples that help you to add tags to the required entities by creating the required custom tagging rules using the required Rule Type. The following examples show different ways of creating a custom tagging rule:


Example 1: By copying the value of a configuration metric

You can create a tagging rule to apply tag to the entities that enables you to quickly filter the entities that belong to an operating system family. This can be performed by creating a custom tagging rule using the Copy the value of a configuration metric. In this example, we have used OS Family as the tag type.

  1. On the Add tagging rule page, enter the following details.

    • Name: Type the required name for the new tagging rule.
    • Description: Type the required description for the new tagging rule type.
    • Rule status: Select Active.
    • Rule type: Select Copy the value of a configuration metric.
    • Configuration Metric: Select [OS_FAMILY] Operating System Family.
    • Tag Type: Select OS Family.

  2. Click Save.
    The tagging rule for filtering entities that belong to an operating system family is created. 

After the Tagging Rule Manager task (System tasks) is executed, tags are added to the entities that match tagging rule condition. The following image shows a sample system with OS tag added to it after the execution of the Tagging Rule Manager task.

Example 2: By using a regular expression based on a configuration metric

You can create a tagging rule to apply a tag to the entities that have used a configuration metric with the matching regular expression. This can be performed by creating a custom tagging rule using the Use a regular expression based on a configuration metric option. In this example, we have used Clustername as the tag type for adding tag to the systems that have BMC-CLM value as the pattern for the CLUSTER_NAME configuration metric.

  1. In the Adding tagging rule page, enter the following details:

    • Name: Enter the required name for the new tagging rule.
    • Description: Enter the required description for the new tagging rule type.
    • Rule status: Select Active.
    • Rule type: Select Use a regular expression based on a configuration metric.
    • Configuration Metric: Select [CLUSTER_NAME] Cluster Name.
    • Regexp: Enter \w{3}- CLM.
    • Tag: Enter CLM.
    • Tag Type: Select Clustername.

  2. Click Save.
    The tagging rule for filtering entities that use a pattern for the CLUSTER_NAME configuration metric is created.

After the Tagging Rule Manager task (System tasks) is executed, tags are added to the systems that match tagging rule condition. The following image shows a sample system with CLM tag added to it after the execution of the Tagging Rule Manager task.


Example 3: By using a regular expression based on the name of a system or business driver

You can create a tagging rule to apply tag to the systems that use a naming convention. This can be performed by creating a custom tagging rule using the Use a regular expression based on the name of a system or business driver. In this example, we have used Generic as the tag type for the systems that use the following naming convention vl-bmc-loc-sys.

  1. On the Adding tagging rule page, enter the following details.

    • Name: Enter the required name for the new tagging rule.
    • Description: Enter the required description for the new tagging rule type.
    • Rule status: Select Active.
    • Rule type: Select Use a regular expression based on the name of a system or business driver.
    • Apply to: Select System.
    • Regexp: Enter vl-\w{3}-\w{3}-.*
    • Tag: Enter Regsys.
    • Tag Type: Select Generic.
  2. Click Save.
    The tagging rule to apply tag to the systems that use a naming convention is created.

 After the Tagging Rule Manager task (System tasks) is executed, tags are added to the systems that match tagging rule condition. 

Example 4: By using a custom script based on configuration metric

You can create a tagging rule to apply a tag to the systems that use the Timezone configuration metric. This can be performed by creating a custom tagging rule using the Use a custom script based on a configuration metric. In this example, we have used Timezone as the tag type that allows multiple values for the systems that use the Timezone configuration metric to identify the continent and country of the system from the timezone.

  1. On the Adding tagging rule page, enter the following details.
    • Name: Enter the required name for the new tagging rule.
    • Description: Enter the required description for the new tagging rule type.
    • Rule status: Select Active.
    • Rule type: Select Use a custom script based on a configuration metric .
    • Configuration Metric: Select [TIMEZONE] Timezone for the System.
    • Custom script: Enter the following code:

      var values = TIMEZONE.split ("/");
      for (var i=0; i<values.length; i++)
      {
      out.add(values[i]); 
      }
    • Tag Type: Select Timezone (allows multiple values).
  2. Click Save.
    The tagging rule to apply tag to the systems that use a naming convention is created.

 After the Tagging Rule Manager task (System tasks) is executed, tags are added to the systems that match tagging rule condition. 

Example 5: By using a custom script based on the name of a system or business driver

You can create a tagging rule to apply tag to the xen or VMware systems that single or multiple CPU cores. This can be performed by creating a custom tagging rule using the  Use a custom script based on the name of a system or business driver. In this example, we have used Virtualization Technology as the tag type to add tag to the Xen or VMware systems.

  1. On the Adding tagging rule page, enter the following details:
    • Name: Enter the required name for the new tagging rule.
    • Description: Enter the required description for the new tagging rule type.
    • Rule status: Select Active.
    • Rule type: Select Use a custom script based on the name of a system or business driver .
    • Apply to: Select System.
    • Custom script: Enter the following code:

      if (!enttypenm) {return;} else if (enttypenm.match(/:vmw/)) { out.add('VMware') } else if (enttypenm.match(/:xen/)) { out.add('Xen') }


    • Tag Type: Select Virtualization Technology.
  2. Click Save.
    The tagging rule to apply tag to the systems that use a naming convention is created.

After the Tagging Rule Manager task (System tasks) is executed, tags are added to the systems that match tagging rule condition. 

 

Was this page helpful? Yes No Submitting... Thank you

Comments