Prod2-monitoring
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.
COPY docker/newrelic /opt/jboss/wildfly/newrelic
Add the java arguments in the docker-compose.yml in order to make the new relic agent work.
JAVA_OPTS: "-javaagent:/opt/jboss/wildfly/standalone/newrelic/newrelic.jar"
Then build the by using the docker-compose up app (for more info on building image refer : prod2 documentation)
Once the image is built and tested push it to ECR and restart the ECS service based on prod2 documentation.
Create a revision of the task-definition and add the java argument in the environment section of the app container.
For setting up in Solr:
Download the java agent for solr with
curl -O https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip
Extract the zip file and configure the newrelic.yml with the license key and application name.
Set the java argument for solr based on the version of solr.
(Reference : https://docs.newrelic.com/docs/agents/java-agent/installation/include-java-agent-jvm-argument#Installing_on_solr)
Once it is setup restart the solr application to get data into newrelic APM.
For setting up in Batch server:
Download the new relic java agent inside the batch server with
Extract the zip file and configure the newrelic.yml with the license key and application name.
Set the java argument for batch server in the batchstarter.sh
AWS Cloudwatch agent setup for infrastructure monitoring:
For setting up cloudwatch agent:
SSH into the instance.
Download the cloudwatch agent from the link below
Download and install the perl modules.
Download and Install the monitoring script.
Create a cronjob to make the script run for every 5 minutes
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.