Docs » Integrations Guide » Integrations Reference » Amazon ECS

../../_images/integration_awsecs.png Amazon ECS πŸ”—

OVERVIEW πŸ”—

You can use SignalFx to monitor the Amazon EC2 Container Service (ECS) through Amazon Web Services (AWS). For greater insight into your Amazon ECS environment, the SignalFx Smart Agent can autodiscover services and provide more in-depth metrics about your containers running in ECS. See the installation procedure for more information.

SETUP πŸ”—

Prerequisites πŸ”—

None

Installation procedure πŸ”—

Step 1: Connect to Amazon CloudWatch πŸ”—

To access this integration, connect to Amazon CloudWatch.

By default, SignalFx imports all Amazon CloudWatch metrics that are available in your account. To retrieve metrics for a subset of available services or regions, modify the connection on the Integrations page.

Step 2: Deploy the SignalFx Smart Agent πŸ”—

Based on the type of container to monitor, there are two ways to deploy the SignalFx Smart Agent to autodiscover services and collect additional detailed metrics.

Option 1: Monitor Amazon ECS containers πŸ”—

Step 1: Create the task definition πŸ”—

To deploy the SignalFx Smart Agent on Amazon ECS, create the task definition from the web admin console:

  1. Select Task Definitions.
  2. Click Create new Task Definition.
  3. Select EC2 and click Next step. The SignalFx Smart Agent only supports EC2 mode and not Fargate at this time.
  4. Scroll to the bottom of the page and click Configure via JSON.
  5. Paste in the contents of the signalfx-agent-task.json.
  6. Click Save.
  7. Click the signalfx-agent container definition under Container Definitions and find the section on environment variables.
  8. Change the value of the ACCESS_TOKEN, INGEST_URL, API_URL, and TRACE_ENDPOINT_URL environment variables to the access token for your SignalFx organization and endpoints you want to send metrics to.
  9. Click Update.
  10. Click Create at the bottom of the task definition input form.

You can also do this using the AWS CLI tool by issuing the following command:

aws ecs register-task-definition --cli-input-json file:///path/to/signalfx-agent-task.json
Step 2: Launch the SignalFx Smart Agent πŸ”—

Note: The SignalFx Smart Agent is designed to be run as a daemon service in an Amazon ECS cluster.

To create an agent service from the Amazon ECS web admin console:

  1. Go to your cluster in the web admin console.
  2. Click Services.
  3. Click Create.
  4. Make the following selections:
    • Launch Type: EC2
    • Task Definition (Family): signalfx-agent
    • Task Definition (Revision): 1 (or whatever the latest is in your case)
    • Service Name: signalfx-agent
    • Service type: DAEMON
  5. Choose the default setting for the remaining options.
  6. Click Next step.
  7. Choose the default setting for the remaining options.
  8. Click Next step.
  9. Choose the default setting for the remaining options.
  10. Click Next step.
  11. Click Create Service. The agent is deployed onto each node in the Amazon ECS cluster, and the infrastructure and Docker metrics start flowing soon.
Step 3: Configuration πŸ”—

The main technique for configuring the SignalFx Smart Agent is to have a configuration file downloaded from the network using curl in the agent container’s initialization script. By default, the SignalFx Smart Agent pulls from the configuration file in the GitHub repository that provides a basic configuration that might suffice for basic monitoring cases. If you want to provide a more complex configuration file, you can set the CONFIG_URL environment variables in the task definition to the URL of the configuration file. This location must be accessible from the Amazon ECS cluster.

The default configuration supports various environment variable overrides, which you can set in the environment variable section of the task definition. See agent.yaml for more information. Note that the configuration values are of the form {"#from": "env:VARNAME"...}).

Option 2: Monitor AWS Fargate containers πŸ”—

Step 1: Create the task definition πŸ”—

The SignalFx Smart Agent is designed to be run as a sidecar in a task with AWS Fargate containers to be monitored. This means you must add a Smart Agent container into each task definition for applications that you want to monitor with the SignalFx Smart Agent.

If you want to use a common configuration of the SignalFx Smart Agent and have the service autodiscovered, make sure that all of the AWS Fargate containers that you want to monitor have Docker labels to specify ports to be monitored in your task definition, as shown in the following example:

"containerDefinitions": [
    {
        "name": "my-container",
        ...
        "dockerLabels": {
           "agent.signalfx.com.port.6379": "true",
           "agent.signalfx.com.monitorType.6379": "collectd/redis",
           "agent.signalfx.com.config.6379.intervalSeconds": "1"
        }
    },
    ...
]

The agent.signalfx.com.port.<port>: "true" label specifies the port number to be autodiscovered on the AWS Fargate container. There is no other way for the SignalFx Smart Agent to know about these ports than by using the autodiscovery process.

The agent.signalfx.com.monitorType.<port>: "<monitor type>" label specifies the monitor type to use for monitoring this endpoint. You can specify other configurations for that monitor using labels similar to the agent.signalfx.com.config.6379.intervalSeconds": "1" label shown in the previous example. The format is agent.signalfx.com.config.<port>.<config key>: "<value as string">. The value string is interpreted as YAML, so you can use compact YAML notation to specify non-scalar values.

See example task definition to view an AWS Fargate task definition. This example shows how to launch the SignalFx Smart Agent alongside a Redis cache instance. The example uses autodiscovery, but you could also hardcode the monitor configuration in the agent.yaml (or reference the configuration from envvars using remote configuration, as shown in agent.yaml).

Step 2: Configuration πŸ”—

The main technique for configuring the SignalFx Smart Agent is to have a configuration file downloaded from the network using curl in the agent container’s initialization script. By default, the SignalFx Smart Agent pulls from the configuration file in the GitHub repository that provides a basic configuration that might suffice for basic monitoring cases. If you want to provide a more complex configuration file, you can set the CONFIG_URL environment variable in the task definition to the URL of the configuration file. This location must be accessible from the Amazon ECS cluster.

The default configuration supports various environment variable overrides, which you can set in the environment variable section of the task definition. See agent.yaml for more information. Note that the configuration values are of the form {"#from": "env:VARNAME"...}).

The SignalFx Smart Agent does not send any metrics about itself by default, although it is also a running container. If you want to see the metrics about the SignalFx Smart Agent, you can remove signalfx-agent from the excludedImages configuration in agent.yaml.

USAGE πŸ”—

The SignalFx Smart Agent can autodiscover services and provide more in-depth metrics about the containers running in your Amazon ECS environment. The SignalFx Smart Agent can also be deployed in an Amazon ECS task to monitor AWS Fargate containers. See the installation procedure for more information.

METRICS πŸ”—

For more information about the metrics emitted by Amazon EC2, visit the service’s homepage at https://aws.amazon.com/ecs/.