Convox Community

Installing Newrelic Infrastructure Agent

We would like to install the Newrelic Infrastructure agent on our EC2 instances to collect infrastructure metrics-- I’ve seen some docs for Datadog suggesting deploying as a service, but wondered at the best practice for deploying. Is it just deployed as a service in a container?

Thanks!

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

Hello,

This can be achieved by setting the InstanceRunCommand to execute a script that will setup the agent when the EC2 instance boots:

convox rack params set InstanceRunCommand="curl https://user:pass@some-private-server/instance-run-command.sh | sh"

The instance-run-command.sh script being as follows:

#!/bin/bash -ex

echo "license_key: KEY" | tee -a /etc/newrelic-infra.yml
curl -o /etc/yum.repos.d/newrelic-infra.repo \
  https://download.newrelic.com/infrastructure_agent/linux/yum/el/6/x86_64/newrelic-infra.repo
yum -q makecache -y --disablerepo='*' --enablerepo='newrelic-infra'
yum install newrelic-infra -y

You could also pass the whole thing as the value for the InstanceRunCommand param, but it’s easier to manage as a separate script. If you assign an InstancePolicy in the rack params, you could also probably fetch it from S3 without the need to authenticate.