Incorrect Hostname in datadog.yaml file
Opened this issue · 4 comments
Hi I'm using chef-client 12.22.1 on Amazon Linux AMI release 2018.03 to install datadog-linux-agent v7 via latest chef-cookbook. I'm seeing that in the datadog.yaml, the hostname when I leave it to autodetect it's not picking up the instance-id but "Name" of the AWS instance
How to fix that?
Hi @vpilania,
Can you confirm that, in datadog.yaml
, the hostname:
field is not specified or has an empty value?
If so, then the cookbook works as expected to make the Agent autodetect its hostname, so please open a case with our support team and send them a flare so that our support team has all the necessary information to look into your issue.
Thanks!
hostname: field is not empty when I run but captures Name of the instance and not for example 'i-abcw123eqe' which I expect!
The default behavior of this cookbook is to set the agent hostname to the Chef node name (node['datadog']['hostname'] = node.name
, see default attribute). To set the agent hostname to the AWS instance ID, you can override this default to node.ec2.instance_id
, for example with:
default_attributes(
'datadog' => {
'hostname' => node.ec2.instance_id,
'use_ec2_instance_id' => true
}
)
('use_ec2_instance_id' => true
is also set here so that the Chef Datadog Handler, if enabled, reports tags, metrics and events using the instance ID as the hostname as well).
Let me know if this solves your issue, thanks.