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. For this example we have used OS Family as the tag type.

  1. On the Adding 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.
      Sample image with the required details.
  2. Click Save.
    The tagging rule for filtering entities that belong to an operating system family is created. The following image displays the sample

After the Tagging Rule Manager task (System tasks) is executed, tags are added to the entities that match tagging rule condition. 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 tag to the entities that have use 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 . For 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. On the Adding 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 Use a regular expression based on a configuration metric .
    • Configuration Metric: Select [CLUSTER_NAME] Cluster Name.
    • Regexp: Type \w{3}- CLM.
    • Tag: Type CLM.
    • Tag Type: Select Clustername.
      Sample image with the required details.
  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. 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 . For 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: 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 Use a regular expression based on the name of a system or business driver.
    • Apply to: Select System.
    • Regexp: Type vl-\w{3}-\w{3}-.*
    • Tag: Type Regsys.
    • Tag Type: Select Generic.
      Sample image with the required details.
  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. Following image shows a sample system with Regsys tag added to it after the execution of the Tagging Rule Manager task.

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

You can create a tagging rule to apply 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 . For 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: 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 Use a custom script based on a configuration metric .
    • Configuration Metric: Select [TIMEZONE] Timezone for the System.
    • Custom script: Type 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).
      Sample image with the required details.


  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. Following image shows a sample system with Asia and Kolkata tags added to it after the execution of the Tagging Rule Manager task.

 

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 . For 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: 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 Use a custom script based on the name of a system or business driver .
    • Apply to: Select System.
    • Custom script: Type 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 .
       Sample image with the required details.
  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. Following image shows a sample system with VMware tag added to it after the execution of the Tagging Rule Manager task.

 

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

Comments