Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Hostname in datadog.yaml file #802

Open
vpilania opened this issue Jun 11, 2021 · 4 comments
Open

Incorrect Hostname in datadog.yaml file #802

vpilania opened this issue Jun 11, 2021 · 4 comments

Comments

@vpilania
Copy link

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?

@vpilania vpilania changed the title Incoreect Hostname in datadog.yaml file Incorrect Hostname in datadog.yaml file Jun 11, 2021
@olivielpeau
Copy link
Member

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!

@vpilania
Copy link
Author

hostname: field is not empty when I run but captures Name of the instance and not for example 'i-abcw123eqe' which I expect!

@olivielpeau
Copy link
Member

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.

@vpilania
Copy link
Author

vpilania commented Jun 23, 2021

image

I'm getting this problem in which hostname is getting registered with two different instance-id out of which one is correct....not sure where it is picking up this - i-00aa96d1c9d27da57 which is incorrect......why would that happen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants