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, use OneAgent command-line parameters.
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
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=TestHostFor more information, see OneAgent configuration via command-line interface.
Tags configured with --set-host-tag are reported to Dynatrace as part of the active monitoring data stream. If host monitoring is disabled, OneAgent stops sending entity data and [Environment] tags eventually disappear from the Properties and tags section. OneAgent preserves the tag configuration locally and automatically restores tags in Dynatrace when monitoring is re-enabled.
You can also set up automated tagging of the hosts in your environment using:
To automate the addition of metadata to your hosts, use command-line parameters.
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.When custom host metadata is used to enrich metrics and other telemetry, the keys and values might be adjusted to meet normalization requirements: keys are converted to lowercase, unsupported characters are replaced with an underscore (_), and keys or values that exceed the maximum length are truncated. As a result, an enriched value can differ from what you set here.
OneAgent reserves the dt. prefix for host tags and properties. Don't use it for tags or properties you set via these commands or the Remote Configuration Management API.
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=DevFor more information, see OneAgent configuration via command-line interface.
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.
Hosts Classic