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
You can override the auto-detected host names and programmatically control how OneAgent reports host names. This is particularly useful for naming hosts within dynamic deployments that include frequently changing host instances and names (for example, within AWS, Azure, or GCP).
To override auto-detected host names, do one of the following:
- Define a host naming rule in Dynatrace settings.
- Use the
oneagentctl
command-line tool OneAgent version 1.189+. - Use a configuration file OneAgent version 1.187 and earlier .
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.
Host naming rules
To define a host naming rule:
Go to Settings > Monitoring > Host naming.
Select Add a new 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.
Keep in mind that any new naming rules will apply to already detected hosts that are active and online.
OneAgent command-line tool
OneAgent version 1.189+
Use the oneagentctl
command-line tool with the --set-host-name
parameter to override an automatically detected host name. A host name must not contain the <
, >
, &
, CR
(carriage return), or LF
(line feed) characters. 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
To revert to the auto-detected host name, set the --set-host-name
parameter to an empty value, as in --set-host-name=""
. For example:
- Linux or AIX:
./oneagentctl --set-host-name=""
- Windows:
.\oneagentctl.exe --set-host-name=""
The change might not be reflected in the Dynatrace web UI for up to 6 minutes.
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 the OneAgent process manually. For OS-specific instructions, see Linux, Windows, or AIX.
To show the host name:
- Linux or AIX:
./oneagentctl --get-host-name
- Windows:
.\oneagentctl.exe --get-host-name
For more information on oneagentctl
, see OneAgent configuration via command-line interface
Host name configuration file
OneAgent version 1.187 and earlier
Use the configuration file only for OneAgent version 1.187 and earlier. For later versions, use the oneagentctl
command-line tool as explained above.
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%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:
Example:
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.