Set custom host names in dynamic environments

Dynatrace automatically identifies and monitors the infrastructure on which it’s deployed, including all detected hosts. It detects hosts, technologies, locations, services, applications, and dependencies between those entities.

Within large environments, defined host names can be unintuitive or confusing. Dynatrace provides basic host naming rules that can override FQN names. You can define host naming rules that enable you to customize and enhance the default names of your AWS hosts.

Add a host naming rule in Dynatrace settings

To programmatically control how OneAgent reports host names, or to monitor particularly dynamic deployments that include frequently changing host instances and names (for example, AWS or MS Azure), you can define a host naming rule in Dynatrace settings, use oneagentctl commandline tool, or a configuration file to override the auto-detected host names.

If you're monitoring a relatively static environment in which host instances are stable, you can simply enter a custom host name via Host settings.

Use Dynatrace settings

To define a host naming rule:

Go to Settings > Monitoring > Host naming.

Select Add a new rule. Add host name rule

Define a new host naming rule.

  • Enter a Rule name.

  • Define the Host name format, including any static text string to be included to describe the named host.
    Optional placeholders are available to make it easy to dynamically include specific hosts in automated host naming.

  • You can restrict this naming rule to a specific host group or technology. While this setting is optional, it provides a quick way to reduce the number of hosts that this rule applies to. To reduce the list of applicable hosts even further, you can add conditions to the new rule. Conditions can be based on host, account, or group properties. Select the property to test the condition and value to test for. Host name rule template

Applies to already detected hosts

Keep in mind that any new naming rules will apply to already detected hosts that are active and online.

OneAgent commandline parameters for host hostnames

OneAgent version 1.189 Use the --set-host-name parameter to override an automatically detected host name. The host name must not contain the <, >, &, CR (carriage return), and LF (line feed) characters and the maximum length is 256 characters.

To change the host name:

  • Linux or AIX:
    ./oneagentctl --set-host-name myhostname
  • Windows:
    .\oneagentctl.exe --set-host-name myhostname

Using --set-host-name requires restart of OneAgent. Add --restart-service to the command to restart OneAgent automatically (version 1.189+) or stop and start OneAgent process manually. For OS-specific instructions, see Linux, Windows, or AIX.

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

Use host name configuration file

To override an automatically detected host name using a configuration file:

Create a simple hostname.conf file on the monitored host.

  • For Windows:
    Create the file in C:\ProgramData\dynatrace\oneagent\agent\config.
    Note that Unicode encoding is not available on Windows.

  • For Linux:
    Create the file in /var/lib/dynatrace/oneagent/agent/config.

Create a host naming rule in the hostname.conf file:


My App Server

After you restart the Dynatrace OneAgent service, Dynatrace will pick up the new host name and apply it to the host. Note that the host name entered on the Host settings page takes precedence over the name stored in the hostname.conf configuration file.