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

Add docs for APM agent setup with ECS env. #18916

Merged
merged 7 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,8 @@
## Check the source code [#source-code]

This integration is open source software. This means you can [browse its source code](https://github.com/newrelic/nri-ecs) and send improvements, or create your own fork and build it.


## Monitor with APM language agents [#monitor-with-apm]

Check warning on line 67 in src/content/docs/infrastructure/elastic-container-service-integration/introduction-amazon-ecs-integration.mdx

View workflow job for this annotation

GitHub Actions / vale-linter

[vale] reported by reviewdog 🐶 [new-relic.ComplexWords] Consider using 'check' or 'watch' instead of 'Monitor'. Raw Output: {"message": "[new-relic.ComplexWords] Consider using 'check' or 'watch' instead of 'Monitor'.", "location": {"path": "src/content/docs/infrastructure/elastic-container-service-integration/introduction-amazon-ecs-integration.mdx", "range": {"start": {"line": 67, "column": 4}}}, "severity": "INFO"}

Check warning on line 67 in src/content/docs/infrastructure/elastic-container-service-integration/introduction-amazon-ecs-integration.mdx

View workflow job for this annotation

GitHub Actions / vale-linter

[vale] reported by reviewdog 🐶 [new-relic.ComplexWords] Consider using 'check' or 'watch' instead of 'monitor'. Raw Output: {"message": "[new-relic.ComplexWords] Consider using 'check' or 'watch' instead of 'monitor'.", "location": {"path": "src/content/docs/infrastructure/elastic-container-service-integration/introduction-amazon-ecs-integration.mdx", "range": {"start": {"line": 67, "column": 39}}}, "severity": "INFO"}

You can also set up the APM language agents to run in your ECS Fargate environment. For more details, please see the [APM Agent in ECS Setup Guide](/docs/infrastructure/elastic-container-service-integration/monitor-ecs-with-apm-agents).
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
---
title: Monitor Amazon ECS environments with APM language agents
umaannamalai marked this conversation as resolved.
Show resolved Hide resolved
tags:
- APM Agents
- Elastic Container Service
- Fargate
metaDescription: New Relic's APM agents can be setup to monitor your Amazon ECS environment.
redirects:
- /docs/integrations/elastic-container-service-integration/installation/monitor-ecs-with-apm-agents
- /docs/monitor-ecs-with-apm-agents
- /docs/infrastructure/monitor-ecs-with-apm-agents

freshnessValidatedDate: never
---

You can install New Relic application monitoring (APM) agents on your [Amazon ECS](https://docs.aws.amazon.com/ecs/index.html) environment. When you instrument your environment with Docker, you can collect and send APM data and metrics to the New Relic platform.

## Install the agent into your Docker container [#install-the-agent]

To add the agent into your Docker container, follow the installation steps specific to the language agent you are using:

* [Java](https://docs.newrelic.com/docs/apm/agents/java-agent/additional-installation/install-new-relic-java-agent-docker/)
* [.NET](https://docs.newrelic.com/install/dotnet/?deployment=linux&docker=yesDocker)
* [Node.js](https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/install-nodejs-agent-docker/)
* [Python](https://docs.newrelic.com/install/python/)


## Set up the agent in your ECS task definition [#agent-task-def]

In order to get the agent running in your ECS environment, you need to modify your [task defintion file](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). This file lets you specify parameters you want your app to run with. For agent set-up, you need to define the following environment variables:

Check warning on line 30 in src/content/docs/infrastructure/elastic-container-service-integration/monitor-ecs-with-apm-agents.mdx

View workflow job for this annotation

GitHub Actions / vale-linter

[vale] reported by reviewdog 🐶 [Microsoft.Wordiness] Consider using 'to' instead of 'In order to'. Raw Output: {"message": "[Microsoft.Wordiness] Consider using 'to' instead of 'In order to'.", "location": {"path": "src/content/docs/infrastructure/elastic-container-service-integration/monitor-ecs-with-apm-agents.mdx", "range": {"start": {"line": 30, "column": 1}}}, "severity": "INFO"}

Check warning on line 30 in src/content/docs/infrastructure/elastic-container-service-integration/monitor-ecs-with-apm-agents.mdx

View workflow job for this annotation

GitHub Actions / vale-linter

[vale] reported by reviewdog 🐶 [new-relic.ComplexWords] Consider using 'change' instead of 'modify'. Raw Output: {"message": "[new-relic.ComplexWords] Consider using 'change' instead of 'modify'.", "location": {"path": "src/content/docs/infrastructure/elastic-container-service-integration/monitor-ecs-with-apm-agents.mdx", "range": {"start": {"line": 30, "column": 72}}}, "severity": "INFO"}

<CollapserGroup>
<Collapser
id="java-setup"
title="Java"
>

```json
"environment": [
# Specify your region-aware host here
{
"name": "NEW_RELIC_HOST",
"value": "collector.newrelic.com"
},
# App name is required
{
"name": "NEW_RELIC_APP_NAME",
"value": "Fargate Demo (AWS)"
},
# License key is required
{
"name": "NEW_RELIC_LICENSE_KEY",
"value": "your-license-key"
}
],
```
</Collapser>
<Collapser
id="dotnet-setup"
title=".NET"
>

```json
"environment": [
# Specify your region-aware host here
{
"name": "NEW_RELIC_HOST",
"value": "collector.newrelic.com"
},
# Setting an app name is highly recommended but not required
{
"name": "NEW_RELIC_APP_NAME",
"value": "Fargate Demo (AWS)"
},
# License key is required
{
"name": "NEW_RELIC_LICENSE_KEY",
"value": "your-license-key"
}
],
```

</Collapser>
<Collapser
id="nodejs-setup"
title="Node.js"
>

```json
"environment": [
# Specify your region-aware host here
{
"name": "NEW_RELIC_HOST",
"value": "collector.newrelic.com"
},
# App name is required
{
"name": "NEW_RELIC_APP_NAME",
"value": "Fargate Demo (AWS)"
},
# License key is required
{
"name": "NEW_RELIC_LICENSE_KEY",
"value": "your-license-key"
}
],
```
</Collapser>
<Collapser
id="python-setup"
title="Python"
>

```json
"environment": [
# Specify your region-aware host here
{
"name": "NEW_RELIC_HOST",
"value": "collector.newrelic.com"
},
# Setting an app name is highly recommended but not required
{
"name": "NEW_RELIC_APP_NAME",
"value": "Fargate Demo (AWS)"
},
# License key is required
{
"name": "NEW_RELIC_LICENSE_KEY",
"value": "your-license-key"
}
],
```
</Collapser>
</CollapserGroup>

## Set up the infra agent as a sidecar [#infra-agent-side-car]

You can set up the infrastructure agent as a [sidecar container](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-security-considerations.html) to your APM agents, giving you more visibility into your environment. When you set up a sidecar to your APM agent, you establish relationship between application and infrastructure monitoring so the data is correlated. This surfaces data to various New Relic mapping features, like [service maps](/docs/new-relic-solutions/new-relic-one/ui-data/service-maps/service-maps).

Check warning on line 138 in src/content/docs/infrastructure/elastic-container-service-integration/monitor-ecs-with-apm-agents.mdx

View workflow job for this annotation

GitHub Actions / vale-linter

[vale] reported by reviewdog 🐶 [Microsoft.Passive] 'is correlated' looks like passive voice. Raw Output: {"message": "[Microsoft.Passive] 'is correlated' looks like passive voice.", "location": {"path": "src/content/docs/infrastructure/elastic-container-service-integration/monitor-ecs-with-apm-agents.mdx", "range": {"start": {"line": 138, "column": 368}}}, "severity": "INFO"}

<img
title="Screenshot showing service map when running language agent and infra agent together in Fargate environment"
alt="Service map screenshot running language agent and infra agent together in Fargate environment"
src="/images/service-map-screenshot-showing-language-and-infra-agent-in-fargate-env.png"
/>
<figcaption>
This service map includes data surfaced from an APM agent with an infra agent sidecar in a Fargate environment.
</figcaption>

## Example Task Definition File [#example-task-definition]

To set up the language agent and infrastructure agent sidecar, update your full task definition file. For example:

```json
{
"family": "nrExampleFargateDef",
"containerDefinitions": [
{
"name": "fargate-test",
"image": "nrExample/fargate-test:latest",
"cpu": 256,
"memoryReservation": 1024,
"portMappings": [
{
"name": "fargate-test-80-tcp",
"containerPort": 80,
"hostPort": 80,
"protocol": "tcp",
"appProtocol": "http"
}
],
"essential": true,
"environment": [
{
"name": "NEW_RELIC_HOST",
"value": "collector.newrelic.com"
},
{
"name": "NEW_RELIC_APP_NAME",
"value": "Fargate Demo (AWS)"
},
{
"name": "NEW_RELIC_LICENSE_KEY",
"value": "your-license-key"
}
],
"mountPoints": [],
"volumesFrom": [],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/nrExampleFargateDef",
"awslogs-create-group": "true",
"awslogs-region": "us-east-1",
"awslogs-stream-prefix": "ecs"
}
},
"systemControls": []
},
{
"name": "newrelic-infra",
"image": "newrelic/nri-ecs:1.11.10",
"cpu": 256,
"memoryReservation": 512,
"portMappings": [],
"essential": true,
"environment": [
{
"name": "NRIA_IS_FORWARD_ONLY",
"value": "true"
},
{
"name": "NRIA_LICENSE_KEY",
"value": "your-license-key"
},
{
"name": "NRIA_VERBOSE",
"value": "1"
},
{
"name": "NRIA_PASSTHROUGH_ENVIRONMENT",
"value": "ECS_CONTAINER_METADATA_URI,ECS_CONTAINER_METADATA_URI_V4,FARGATE"
},
{
"name": "FARGATE",
"value": "true"
},
{
"name": "NRIA_CUSTOM_ATTRIBUTES",
"value": "{\"nrDeployMethod\":\"downloadPage\"}"
},
],
"mountPoints": [],
"volumesFrom": [],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/newrelic-infra/ecs",
"awslogs-region": "us-east-1",
"awslogs-stream-prefix": "verbose"
}
},
"systemControls": []
}
],
"taskRoleArn": "arn:aws:iam::111111111111:role/ecsTaskExecutionRole",
"executionRoleArn": "arn:aws:iam::111111111111:role/ecsTaskExecutionRole",
"networkMode": "awsvpc",
"requiresCompatibilities": [
"FARGATE"
],
"cpu": "1024",
"memory": "3072",
"runtimePlatform": {
"cpuArchitecture": "X86_64",
"operatingSystemFamily": "LINUX"
}
}
```

Once you've modified your task file, trigger some data in your environment, wait a few minutes, then [look for your data in the UI](/docs/ecs-integration-understand-use-data).

## What's next? [#next-steps]

After you've setup your agents:

* We recommend installing our [ECS cloud integration](/docs/integrations/amazon-integrations/aws-integrations-list/aws-ecsecr-monitoring-integration), which surfaces other ECS data, like data about clusters and services.
* Review our doc on [alert conditions](/docs/ecs-integration-recommended-alert-conditions).
* If you want to make additional configurations to your APM agents, check out their configuration docs:

Check warning on line 268 in src/content/docs/infrastructure/elastic-container-service-integration/monitor-ecs-with-apm-agents.mdx

View workflow job for this annotation

GitHub Actions / vale-linter

[vale] reported by reviewdog 🐶 [new-relic.ComplexWords] Consider using 'more' or 'extra' instead of 'additional'. Raw Output: {"message": "[new-relic.ComplexWords] Consider using 'more' or 'extra' instead of 'additional'.", "location": {"path": "src/content/docs/infrastructure/elastic-container-service-integration/monitor-ecs-with-apm-agents.mdx", "range": {"start": {"line": 268, "column": 23}}}, "severity": "INFO"}
* [Java](https://docs.newrelic.com/docs/apm/agents/java-agent/configuration/java-agent-configuration-config-file/)
* [.NET](https://docs.newrelic.com/docs/apm/agents/net-agent/configuration/net-agent-configuration/)
* [Node.js](https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration/)
* [Python](https://docs.newrelic.com/docs/apm/agents/python-agent/configuration/python-agent-configuration/)
2 changes: 2 additions & 0 deletions src/nav/infrastructure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,8 @@ pages:
path: /docs/infrastructure/elastic-container-service-integration/understand-use-ecs-data
- title: Recommended ECS alerts
path: /docs/infrastructure/elastic-container-service-integration/ecs-integration-recommended-alert-conditions
- title: Monitor Amazon ECS environments with APM language agents
path: /docs/infrastructure/elastic-container-service-integration/monitor-ecs-with-apm-agents
- title: Uninstall the ECS integration
path: /docs/infrastructure/elastic-container-service-integration/uninstall-ecs-integration
- title: "Troubleshoot: No data appears"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading