You can use the Tier Naming Rule functionality to customize the tier name of any managed Java process. Each tier rule maps to a specific server type. Tier Naming Rules allows you to create Rego policies so that the Agent Installer can discover tier names. To do that, the tier naming format or rule condition must have a valid Rego expression. AppDynamics recommends recreating Rego Policies using Tier Naming Rules. See Rego Policy Language

For information on the Agent Installer API, see Agent Installer Platform Service API

Tier Naming Format 

FormatDescription Example
tier-name-formatThe format contains only literals and the tier name appears the same as the format. 

tier-name-format

tier-<AppServerType>-formatThe mix of literals and attributes. The tier name is evaluated after passing the attribute and replaces the value of the attribute. Attributes are defined within the angular bracket <AppServerType>
  • tier-tomcat-format for tomcat application server
  • tier-jboss-format for jboss application server
  • tier-glassfish-format for glassfish application server
  • tier-java-format for plain java application

`input.CmdlineArray[count(input.CmdlineArray) - 1]`

The expression is made inside the ` `. This does not have an attribute, and there is no change in the expression. 
"CmdlineArray": [ "/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64/jre/bin/java", "-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager", "-classpath", "/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64/lib/tools.jar:/home/Ecommerce.jar", "EcommerceApplication" ]
CODE

Assuming the command line is the value above, the tier name format is EcommerceApplication.

`<CmdlineArray>[count(<CmdlineArray>) - 1]`The expression is made inside the ` `. The attributes are parsed. 
"CmdlineArray": [ "/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64/jre/bin/java", "-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager", "-classpath", "/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64/lib/tools.jar:/home/Ecommerce.jar", "EcommerceApplication" ]
CODE

Assuming the command line is the value above, the tier name format is EcommerceApplication.

Filter Tier Naming Rules

  1. Go to the Tier Naming Rules tab. 
  2. Click Filter Panel.

  3. Select how you want to filter out a tier naming rule. Options: Status, EnabledDisabled
  4. Select or type the Application Scope.

  5. Select the Application Server Type.

  6. Click Apply.  

Format: 

POST /customNaming/rules/query

Request Example:

curl --location --request POST 'https://demo.saas.appdynamics.com/zero/v1beta/customNaming/rules/query' --header 'Authorization: Bearer {AuthToken}'
--header 'Content-Type: application/json' \
--data-raw
{
   "enabled": true,
   "appServerTypes": [
       "TOMCAT"
    ],
    "applicationNames": [
        "EcommerceApplication"
    ]
}
CODE

Response Example: 

{
    "total": 2,
    "customConfigFocusedDtoList": [
        {
            "id": "56112e75-6308-4d04-b9fa-e336b967bc59",
            "ruleName": "TomcatRule1",
            "priority": 1,
            "version": 1,
            "enabled": true,
            "appServerTypes": [
                "TOMCAT"
            ],
            "applicationNames": [
                "EcommerceApplication"
            ]
        },
        {
            "id": "6b8701db-b7d3-4017-8001-ba9de952cd82",
            "ruleName": "TomcatRule2",
            "priority": 2,
            "version": 1,
            "enabled": true,
            "appServerTypes": [
                "TOMCAT"
            ],
            "applicationNames": [
                "EcommerceApplication"
            ]
        }
     ]
}
JSON

Add New Tier Naming Rules 

  1. Go to the Tier Naming Rules tab. 
  2. Click + Add New Rule

  3. Enter the following:

    1. Rule Name

    2. Tier Naming Format: Use any characters, words, and variables to define your naming format.

    3. Application Server Types: Select the application server type that the naming rule will apply to.

    4. Conditions: Select values that match the conditions that will be added to the tier. 

      All string comparisons are case sensitive.

    5. Application Scope: Only tiers in the selected applications will be evaluated against the conditions.

  4. Click Create rule

    Scenario 1: If an existing tier name (Tier 1) is disabled, and a new tier name (New Tier 1) is discovered by the tier rule, the new tier (New Tier 1) will be disabled by default.

    Scenario 2: If an existing tier name (Tier 1) is disabled, and it is modified to an existing tier name (Tier 2), by the change of tier rules the status of the tier name (Tier 2) will be not change. 

Format:

POST /customNaming/rules

Request Example:

curl --location --request POST 'https://demo.saas.appdynamics.com/zero/v1beta/customNaming/rules' --header 'Authorization: Bearer {AuthToken}' \
--header 'Content-Type: application/json' \
--data-raw
{
  "ruleName": "TomcatRule",
  "tierNamingFormat": "tomcat-tier-prod",
  "processType": "JAVA",
  "appServerTypes": [
      "tomcat"
  ],
  "priority": 1,
  "ruleConditions": [
    {
      "keyName": "<cmdlineArray[_]>",
      "conditionType": "contains",
      "value": "-Dcatalina.home=/staging/apache-tomcat-9.0.6"
    }
  ],
  "applicationNames": [
    "ALL"
  ]
}
CODE

Response Example: 

{
    "id": "9a7dfb82-480f-4beb-b72c-a3692b54fdec",
    "ruleName": "TomcatRule",
    "tierNamingFormat": "tomcat-tier-prod",
    "processType": "JAVA",
    "version": 1,
    "appServerTypes": [
        "tomcat"
    ],
    "priority": 1,
    "enabled": true,
    "ruleConditions": [
        {
            "keyName": "<cmdlineArray[_]>",
            "conditionType": "CONTAINS",
            "value": "-Dcatalina.home=/staging/apache-tomcat-9.0.6",
            "sequence": 0
        }
    ],
    "applicationNames": [
        "ALL"
    ]
}
JSON

Obtain Tier Naming Rule Details 

Format:

GET /customNaming/rules/{Id}/details

Request Example:

curl --location --request GET 'https://demo.saas.appdynamics.com/zero/v1beta/customNaming/rules/0c328c2e-d6ab-4343-bcff-792a77c45413/details' \
--header 'Authorization: Bearer {AuthToken}'
CODE

Response Example: 

{
    "id": "56112e75-6308-4d04-b9fa-e336b967bc59",
    "ruleName": "TomcatRule1",
    "tierNamingFormat": "tomcat-tier-prod",
    "processType": "JAVA",
    "version": 1,
    "appServerTypes": [
        "TOMCAT"
    ],
    "priority": 1,
    "enabled": true,
    "ruleConditions": [
        {
            "keyName": "<CmdlineArrya[_]>",
            "conditionType": "CONTAINS",
            "value": "-Dcatalina.home",
            "sequence": 1
        },
        {
            "keyName": "<envVarMap.HOSTNAME>",
            "conditionType": "EQUAL",
            "value": "localhost",
            "sequence": 2
        }
    ],
    "applicationNames": [
        "EcommerceApplication"
    ]
}
CODE

Edit Tier Naming Rules

  1. Go to the Tier Naming Rules tab. 
  2. Select the Rule Name that you want to edit. 

  3. Click Edit rule
  4. Edit the following:
    1. Tier Naming Format
    2. Application Server Types

    3. Conditions

      All string comparisons are case sensitive.

    4. Application Scope

  5. Click Update rule

Format:

PUT /customNaming/rules/{Id}

Request Example:

curl --location --request PUT 'https://demo.saas.appdynamics.com/zero/v1beta/customNaming/rules/9a7dfb82-480f-4beb-b72c-a3692b54fdec' --header 'Authorization: Bearer {AuthToken}' \
--header 'Content-Type: application/json' \
--data-raw
{
    "id": "9a7dfb82-480f-4beb-b72c-a3692b54fdec",
    "ruleName": "TomcatRule",
    "tierNamingFormat": "tomcat-tier-prod",
    "processType": "JAVA",
    "version": 1,
    "appServerTypes": [
        "tomcat"
    ],
    "priority": 1,
    "enabled": true,
    "ruleConditions": [
        {
            "keyName": "<cmdlineArray[_]>",
            "conditionType": "CONTAINS",
            "value": "-Dcatalina.home=/staging/apache-tomcat-9.0.6",
            "sequence": 0
        },
        {
            "keyName": "<envVarMap.HOSTNAME>",
            "conditionType": "EQUAL",
            "value": "localhost",
            "sequence": 0
        }
    ],
    "applicationNames": [
        "ALL"
    ]
}
CODE

Response Example: 

{
    "id": "9a7dfb82-480f-4beb-b72c-a3692b54fdec",
    "ruleName": "TomcatRule",
    "tierNamingFormat": "tomcat-tier-prod",
    "processType": "JAVA",
    "version": 2,
    "appServerTypes": [
        "tomcat"
    ],
    "priority": 1,
    "enabled": true,
    "ruleConditions": [
        {
            "keyName": "<cmdlineArray[_]>",
            "conditionType": "CONTAINS",
            "value": "-Dcatalina.home=/staging/apache-tomcat-9.0.6",
            "sequence": 0
        },
        {
            "keyName": "<envVarMap.HOSTNAME>",
            "conditionType": "EQUAL",
            "value": "localhost",
            "sequence": 0
        }
    ],
    "applicationNames": [
        "ALL"
    ]
}
JSON

Delete Tier Naming Rules

  1. Go to the Tier Naming Rules tab. 
  2. Select the Rule Name that you want to delete. 
  3. Click Delete Confirmation

Format:

DELETE /customNaming/rules/{Id}

Request Example:

curl --location --request DELETE 'https://demo.saas.appdynamics.com/zero/v1beta/customNaming/rules/9a7dfb82-480f-4beb-b72c-a3692b54fdec' --header 'Authorization: Bearer {AuthToken}'
CODE

Response Example: 

No response
CODE

Enable Tier Naming Rules

  1. Go to the Tier Naming Rules tab. 
  2. Select the Rule Name that you want to enable. 
  3. Click Enable rule

Format:

POST /customNaming/rules/{Id}/enable

Request Example:

curl --location --request POST 'https://demo.saas.appdynamics.com/zero/v1beta/customNaming/rules/9a7dfb82-480f-4beb-b72c-a3692b54fdec/enable' --header 'Authorization: Bearer {AuthToken}'
CODE

Response Example: 

No response
CODE

Disable Tier Naming Rules

  1. Go to the Tier Naming Rules tab. 
  2. Select the Rule Name that you want to disable. 
  3. Click Disable rule

Format: 

POST /customNaming/rules/{Id}/disable

Request Example:

curl --location --request POST 'https://demo.saas.appdynamics.com/zero/v1beta/customNaming/rules/9a7dfb82-480f-4beb-b72c-a3692b54fdec/disable' --header 'Authorization: Bearer {AuthToken}'
CODE

Response Example: 

No response
CODE

Edit Priorities for Tier Naming Rules

  1. Go to the Tier Naming Rules tab. 
  2. Click Priority
  3. Drag and drop rows to rearrange the tier naming rules priority.
  4. Click Save priority order

    The evaluation of a tier name follows the priority order of the configuration rule defined. If none of the rules match, then the default tier name is set by the Agent Installer. 

Format:

PATCH /customNaming/rules/bulk

Request Example:

curl --location --request PATCH 'https://demo.saas.appdynamics.com/zero/v1beta/customNaming/rules/bulk' --header 'Authorization: Bearer {AuthToken}'
--header 'Content-Type: application/json' \
--data-raw
{
    "total": 1,
    "items": [
        {
            "id": "79962b2d-9afb-40e8-9529-428c5077e702",
            "priority": 1,
            "version": 1
        },
        {
            "id": "9a7dfb82-480f-4beb-b72c-a3692b54fdec",
            "priority": 2,
            "version": 1
        }
    ]
}
CODE

Response Example: 

{
    "total": 2,
    "items": [
        {
            "ruleName": "TomcatRule1",
            "status": "SUCCESS",
            "description": null
        },
        {
            "ruleName": "TomcatRule2",
            "status": "SUCCESS",
            "description": null
        }
    ]
}
JSON

Import Tier Naming Rules

  1. Go to the Tier Naming Rules tab. 
  2. Click Import

  3. Select the JSON file you want to import. 

  4. Click Upload

  5. Click Done once the file has been successfully uploaded. 

Format:

POST /customNaming/templates/import

Request Example:

curl --location --request POST 'https://demo.saas.appdynamics.com/zero/v1beta/customNaming/templates/import' --header 'Authorization: Bearer {AuthToken}' --header 'Content-Type: application/json' --form 'file=@"<filePath>"
CODE

Response Example: 

{
    "total": 2,
    "items": [
        {
            "ruleName": "TomcatRule3",
            "status": "SUCCESS",
            "description": null
        },
        {
            "ruleName": "TomcatRule4",
            "status": "SUCCESS",
            "description": null
        }
    ]
}
JSON

Export Tier Naming Rules

  1. Go to the Tier Naming Rules tab.
  2. Click Export
  3. Click Allow to download the file to local system. 

Format:

POST /customNaming/rules/export

Request Example:

curl --location --request POST 'https://demo.saas.appdynamics.com/zero/v1beta/customNaming/rules/export' --header 'Authorization: Bearer {AuthToken}' --header 'Content-Type: application/json'
CODE

Response Example: 

The response is a file in JSON format
CODE

Preview the Status of a Tier Naming Rule

  1. Go to the Tier Naming Rules tab.
  2. Click Naming Rules Preview
  3. Preview the status of each rule: Impacted processes, In progress, and No changes

  4. Click Done

Format:

POST /customNaming/preview

Request Example:

curl --location --request POST 'https://demo.saas.appdynamics.com/zero/v1beta/customNaming/preview' --header 'Authorization: Bearer {AuthToken}'
--header 'Content-Type: application/json' \
--data-raw
{
  "applicationNames" : [
      "ECommerceApp"
  ],
  "curTierInformation": [
      {
      "tierName": "tier1",
      "ruleName": "rul1e1"
      }
  ],
  "expectedTierInformation": [
      {
      "tierName": "tier1",
      "ruleName": "rul1e1"
      }
  ],
  "previewStatus" : false
}
CODE

Response Example 1: 

{
    "total": 1,
    "items": [
        {
            "nodeName": "Node1",
            "applicationName": "EcommerceApp",
            "curTierInformation": {
                "tierName": "Tier1",
                "ruleName": "Rule1"
            },
            "expectedTierInformation": {
                "tierName": "NewTier1",
                "ruleName": "NewRule1"
            },
            "previewStatus": true,
            "previewMessage": "Restart to Apply"  
        }
    ]
}
JSON

Response Example 2: 

{
    “total”: 2,
    “items”: [
        {
            “nodeName”: “Node1",
            “applicationName”: “EcommerceApp”,
            “curTierInformation”: {
                “tierName”: “Tier1”,
                “ruleName”: “Rule1”
            },
            “expectedTierInformation”: {
                “tierName”: “NewTier1",
                “ruleName”: “NewRule1"
            },
            “previewStatus”: true,
            “previewMessage”: “Restart to Apply”
        },
        {
            “nodeName”: “Node2”,
            “applicationName”: “EcommerceApp”,
            “curTierInformation”: {
                “tierName”: “Tier1",
                “ruleName”: “Rule1"
            },
            “previewStatus”: true,
            “previewMessage”: “No Change”
        }
    ]
}
JSON

Once a configuration changes, you can use the Preview API to identify the affect of an existing tier name, before restarting the Java process. 

The Preview status is only supported in versions >=22.4. Older versions of the agent display in the Failure status, as not supported. 

Default Rules 

The table below shows default values for tier naming rules. 

AppServerTypeSub CategoryDefault NameExample
tomcat

tomcat

tomcat,<JavaUniquePath>tomcat,/staging/apache*.*

tomEE

tomee,<JavaUniquePath>

tomee,/staging/apache*.*

jboss

standalone

jboss,standalone,<JavaUniquePath>jboss,standalone,/staging/jboss*.*

domain

jboss,domain,<JBossServerGroupName>,<JavaUniquePath>jboss,domain,defaultServer,/staging/jboss*.*
glassfish


glassfish,<GlassfishDomainName>,<GlassfishInstanceName>,<JavaUniquePath>glassfish,domain1,domain1,/staging/glassfish*.*
weblogic
weblogic,<WeblogicDomainName>,<WeblogicInstanceName>,<JavaUniquePath>weblogic,domain,weblogic1,/staging/weblogic*.*
websphere

WebSphereWAS

webspherewas,<WebSphereCellName>, <WebSphereServerName>,<JavaUniquePath>webspherewas,wascell,wasServer,/staging/websphere*.*

Liberty

websphereliberty,<WebSphereLibertyServerName>, <JavaUniquePath>websphereliberty,liberty,/staging/websphere*.*
java

using jar file

java,<JavaMainJar>java,ECommerceApp.jar

using java class name

java,<JavaMainClass>,<JavaUniquePath>java,EcommerceApplicaton,/staging/EcommerceApplicaton/**