Define tags and metadata for hosts

Within dynamic or large environments, manual host tagging can be impractical. For dynamic deployments that include frequently changing host instances and names (for example, AWS or MS Azure), you should automate adding tags and metadata to your hosts.

Tags

To automate the addition of tags to your hosts using OneAgent versions 1.189+, use OneAgent command-line parameters. For earlier versions, use the host tag configuration file.

OneAgent command-line parameters for tags

Recommended since OneAgent version 1.189

To add or change host tags, run the following command:

  • Linux and AIX
    ./oneagentctl --set-host-tag TestHost --set-host-tag role=fallback --set-host-tag Gdansk
  • Windows
    .\oneagentctl.exe --set-host-tag TestHost --set-host-tag role=fallback --set-host-tag Gdansk You can add or change more than one tag in the same command. You can also define tags with the same key but different values.

For more information on oneagentctl, see OneAgent configuration via command-line interface

Edit the host tag configuration file

UTF-8 encoded

Any hostautotag.conf or hostcustomproperties.conf files created should be encoded in UTF-8.

During OneAgent installation, the installer creates a simple hostautotag.conf configuration file on the monitored host. On Windows, the file is located in %PROGRAMDATA%\dynatrace\oneagent\agent\config, and on Linux in /var/lib/dynatrace/oneagent/agent/config.

The file should contain a list of strings or key/value pairs that will be reported to the server with every file change. New lines or spaces are used to separate tag values. For example:

TestHost Gdansk role=fallback

Result

The tags defined in these examples result in the following host tagging:

The result of tagging a host via hostautotag.conf configuration file

Configuration file-based tags behave similarly to automated, rule-based tags and environment variable-based tags.

Configuration file-based tags can't be removed manually from a host. They can only be removed through a hostautotag.conf file change.

Once configured, the tags will be displayed at the top of the Properties and tags section of the host overview page.

Other options for automated tagging

You can also set up automated tagging of the hosts in your environment using:

Host metadata

To automate the addition of metadata to your hosts using OneAgent versions 1.189+, use command-line parameters. For earlier versions, use the host metadata configuration file.

OneAgent command-line parameters for host metadata

Recommended since OneAgent version 1.189

To add or change host properties, run the following command:

  • Linux and AIX
    ./oneagentctl --set-host-property AppName=easyTravel --set-host-property Environment=Dev
  • Windows
    .\oneagentctl.exe --set-host-property AppName=easyTravel --set-host-property Environment=Dev You can add or change more than one property in the same command.

For more information on using oneagentctl, see OneAgent configuration via command-line interface

Edit the host metadata configuration file

The process of configuring properties is similar to the one for tags, but here they'reconfigured through the hostcustomproperties.conf file, which you need to create and add to your OneAgent configuration directories:

  • Windows: %PROGRAMDATA%\dynatrace\oneagent\agent\config
  • all UNIX-like systems /var/lib/dynatrace/oneagent/agent/config

Result

Once configured, custom properties will be displayed at the bottom of the Properties and tags section of the host overview page. You can then set up automatic tagging rules to enable tagging of these properties.

Remove delay

If you remove a property, allow 5-15 minutes for the property to clear from the Properties and tags section.

For example:

AppName=easyTravel
Environment=Dev
Organization=D1P
Owner=john.doe@dynatrace.com
Support=https://www.dynatrace.com/support

host tags