Skip to content

Instantly share code, notes, and snippets.

@olivielpeau
Created November 12, 2015 22:34
Show Gist options
  • Save olivielpeau/71b1cb117800512bdb9b to your computer and use it in GitHub Desktop.
Save olivielpeau/71b1cb117800512bdb9b to your computer and use it in GitHub Desktop.
Updating the Datadog agent hostname (on Elastic Beanstalk, Windows)
files:
"c:\\datadog\\ddagent-cli.msi":
source: https://s3.amazonaws.com/volusion-vnext-api-environment/ddagent-cli.msi
"c:\\init_scripts\\update_agent_hostname.ps1":
content: |
#stop DatadogAgent service
Stop-Service -Name DatadogAgent;
$hostname = Invoke-RestMethod -uri http://169.254.169.254/latest/meta-data/hostname
Add-Content C:\ProgramData\Datadog\datadog.conf "`rhostname: $hostname"
#start DatadogAgent service
Start-Service -Name DatadogAgent;
commands:
01_install_datadog_agent:
command: msiexec /qn /i c:\\datadog\\ddagent-cli.msi APIKEY=""{1}""
waitAfterCompletion: 0
02_update_agent_hostname:
command: powershell -ExecutionPolicy RemoteSigned -File .\\update_agent_hostname.ps1
cwd: c:\\init_scripts
waitAfterCompletion: 0
@ShadySQL
Copy link

where is this powershell script? update_agent_hostname.ps1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment