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.
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 version 1.189+
To add or change host tags, run the following command:
./oneagentctl --set-host-tag=TestHost --set-host-tag=role=fallback --set-host-tag=Gdansk
.\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
OneAgent version 1.187 and earlier
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
After you configure them, the tags are displayed at the top of the Properties and tags section of the host overview page.
Tags created using oneagentctl
behave similarly to automated, rule-based tags and environment variable-based tags.
They are prefixed with the [Environment]
string and can't be removed manually from a host. They can only be removed through a oneagentctl
command. To remove a tag, run the following command:
./oneagentctl --remove-host-tag=TestHost
.\oneagentctl.exe --remove-host-tag=TestHost
For more information, see OneAgent configuration via command-line interface.
You can also set up automated tagging of the hosts in your environment using:
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 version 1.189+
To add or change host properties, run the following command:
./oneagentctl --set-host-property AppName=easyTravel --set-host-property Environment=Dev
.\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.To set a security context for your host, use the following command:
./oneagentctl --set-host-property=dt.security_context=easytrade_sec
.\oneagentctl.exe --set-host-property=dt.security_context=easytrade_sec
The dt.security_context
is utilized by multiple features within Dynatrace, such as Log security context and Business events security context.
Additionally, if you're an account administrator looking to grant access to monitored entities based on their security context, see Grant access to entities with security context.
To remove host properties, run the following command:
./oneagentctl --remove-host-property=AppName --remove-host-property=Environment=Dev
.\oneagentctl.exe --remove-host-property=AppName --remove-host-property=Environment=Dev
For more information, see OneAgent configuration via command-line interface.
OneAgent version 1.187 and earlier
The process of configuring properties is similar to the one for tags, but here they're configured through the hostcustomproperties.conf
file, which you need to create and add to your OneAgent configuration directories.
%PROGRAMDATA%\dynatrace\oneagent\agent\config
/var/lib/dynatrace/oneagent/agent/config
After you configure them, custom properties are displayed in the Environment custom meta data section of Properties and tags on the host overview page. You can then set up automatic tagging rules to enable tagging of these properties.