This document explains the steps taken to implement New relic and AWS infra monitoring on prod2 resources.
New relic instructions
For setting up in ECS:
Download the new relic java agent zip file and extract it from the new relic docs : https://docs.newrelic.com/docs/agents/java-agent/installation/install-java-agent
configure the agent with newrelic.yml file and add the add the license key and app name as per the instructions in the above link.
Place the new relic folder inside the docker folder.
Copy the new relic in to the app.Dockerfile by adding the following lines.
...
Code Block |
---|
-javaagent:/full/path/to/newrelic.jar |
AWS Cloudwatch agent setup for infrastructure monitoring:
For setting up cloudwatch agent:
SSH into the instance.
Download the cloudwatch agent according to the platform from the link below link
AmazonCloudWatchmonitoringdownload-cloudwatch-agent-commandlineDownload and install the perl modules.
Download and Install the packagemonitoring script.
Code Block |
---|
#If#To itsdownload anthe RPMcloudwatch packagescript sudo rpm -U ./amazon-cloudwatch-agent.rpm |
Code Block |
---|
#If its an DEB package
sudo dpkg -i -E ./amazon-cloudwatch-agent.deb |
...
Once the agent is downloaded we can create and modify the configuration file.
...
curl https://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.2.zip -O |
Code Block |
---|
#Install the scripts
unzip CloudWatchMonitoringScripts-1.2.2.zip && \
rm CloudWatchMonitoringScripts-1.2.2.zip && \
cd aws-scripts-mon |
Create a cronjob to make the script run for every 5 minutes
Code Block |
---|
crontab -e
#Add the line to the crontab
*/5 * * * * ~/aws-scripts-mon/mon-put-instance-data.pl --mem-used-incl-cache-buff --mem-util --disk-space-util --disk-path=/ --from-cron |
This should install the cronjob and the agent will begin reporting data.
To enable the CloudWatch agent to send data from the instance, we must attach an IAM role to the instance. The role to attach isĀ CloudWatchAgentServerRole.
Related articles
...
hidden | true |
---|
...