Skip to content

Using Agent tags

Overview

Agent tags can be used in Distribution, Consolidation, and Script Jobs to automate part of the setup and make it more flexible.

By default, agents have two tags already set up, AGENT_NAME and AGENT_ID. These tags can be viewed and edited in the Agents tab -> Edit tags. Tag names are allowed only in upper case - when creating and using them, tag values can be any case. No spaces are allowed, use underscore (_) instead.

There are several places in Resilio Connect to use agent tags.

Using tags in commands and scripts

Using tags in scripts is similar to using variables. Tags can be used in expressions and output. The default sample of using tags in commands is echoing Job results into the log file. When specifying the command, tag prefix TAG_ must be used. On Windows, the correct syntax for using a tag is %TAG_AGENT_NAME%, on Unix that will be $TAG_AGENT_NAME. The correct syntax of the command itself depends on the system.

In this example script will remove the directory after the Job's completion from the Source agent on Windows. Before creating this Job, create a new tag AGENT_ROLE with value SRC for the relevant agents.

For more information on scripting, see Scripts.

Mc Use Agents Tags Script

Using tags in paths

One of the use cases is to distribute/consolidate files and organize them into the relevant subfolders. Tags in paths are not supported for synchronization Jobs.

Create a new tag on Agents tab, give it a name and value. Value can be either absolute or relative path (just a subfolder). When using tags in path, tag prefix SRC or DST are required for distribution and consolidation Jobs, not required for script Jobs. When specifying the path upon Job creation use the created tag as %SRC:TAG_NAME% or %DST:TAG_NAME%. These prefixes will resolve the tag into the path for source or destination agents accordingly.

Default sample is using %SRC:AGENT_NAME% tag in destination group path for Consolidation Job. That tag means that destination agents will be arranging the files into subfolder per source agent name.

Another example is using tags in Distribution Jobs. For example, on source server there is a directory with subfolders (A, B, C) each of which is destined for a specific agent. We can add a tag CLIENT with values A, B, C for the corresponding agent. When creating a Job, at Path step, pick the path and use the CLIENT tag with DST prefix, which basically means that destination agent with tag CLIENT = A will receive content of C:\Document\Files\A directory:

Mc Use Agents Tags

Automatically group agents

Agent tags can be used to create sorting rules for groups. A tag and its value acts as a condition for an Agent to join a group automatically. For example, agents from different geographical locations shall be added to a specific groups. It makes sense to add a tag LOCATION to agents and create a rule in groups' settings to accept agents only from a given location. For more information on assigning Agents to groups, see Automatically sorting new agents into groups

Mc Use Tags Autoassign

Pausing a Job on a condition

The change of tag's value may trigger pausing or unpausing a Job run. Configure a Job to follow a specific tag and check it for a specified value. For more information, see Conditional pausing Job run on an Agent.