Skip to content

Manage Agent Tags

Tagging enables you to group agents together by using a meaningful name, typically based on common functionality. For example, you can use tags to identify locations and purposes of each agent: Database Servers, Staging, and so forth. Additionally, you can apply multiple tags in any combination to each agent.

By applying multiple tags, you can bind actions to an agent even before the agent has been launched, and you can apply actions to servers across sections. Once an action is bound to a tag, it is implicitly added to all of the agents that have that tag.

Example

Label a tag called Integration. Add that tag to relevant agents where you're running your application for integration testing. Now, set integration tests to execute with the Integration tag in order to debug an integration test failure. To view details, list actions by tag from the CLI with java -jar lightrunc.jar list-actions tag:Integration. The output lists all actions you inserted for integration testing across all of your agents.

Permissions

Only users with ROLE_MANAGER can perform these actions.

Out-of-the-box, agents have a single Production tag. Users with the Manager role can:

Managing tags

Managers can label and apply tags.

To label and apply a tag to an agent
  1. From the relevant server where the agent is installed, go to the agent.metadata.json file and open it.

  2. Insert tag names within the tags object (which should be nested in the registration object):

    {
        "registration": {
          "tags": [
            {
              "name": "Tag1"
            },
            {
              "name": "Tag2"
            },
            {
              "name": "Tag3"
            }
          ]
        }
    }
    

    For example, the following JSON applies the tags ProductionsAgents, JDK1.8 and Ubuntu16 to the relevant agent:

    {
        "registration": {
          "displayName": "Production"
          "tags": [
            {
              "name": "Productions"
            },
            {
              "name": "Staging"
            },
            {
              "name": "Dev"
            }
          ]
        }
    }
    

    Alternatively, tags can be applied using a command line argument as part of the command you use to run the agent with your application.

    The command line arguments should be inserted after the path of the agent and they should be separated by a comma.

    java -Dlightrun.registration.tags=myTag -agentpath:/path/to/agent/lightrun_agent.so RestOfTheArgumentsHere
    
  3. Save the changes and close the file.

  4. Restart the agent.

    Important

    Changes to this file aren't detected until the agent is restarted.

To view all tag details from the Management Portal

Log in to your Lightrun account and navigate to Entities->Tags.

The Tags screen loads and appears similar to the following:

Manage tags

The details displayed for tags are as follows:

Column Description
Name The name of the tag.
Actions The list of actions currently attached to this tag.
Agents The list of agents to which this tag has been associated.
To view tags from the CLI
  1. Install the CLI
  2. Run java -jar lightrunc.jar list-tags:

    List agents

Note

See the CLI reference for more information.


Last update: September 27, 2021