Tips on Deploying ECS Support for Server Monitoring
Deploying ECS for server monitoring? Here are some sweet tips to make sure you've got your metrics covered.
Join the DZone community and get the full member experience.
Join For FreeDocker monitoring with New Relic is designed to add an app-centric view of Docker containers to the existing New Relic Servers interface. To use it, customers need to deploy the New Relic Linux Server Monitor (LSM) on the Amazon Elastic Compute Cloud (EC2) instances used by the Amazon EC2 Container Service (ECS), which provides Amazon customers with an easy way to manage and deploy Docker-based containers. This post is intended to show you how to do that.
Support for ECS and Docker can add significant value to your monitoring. Our LSM Docker support provides a view of Docker containers that is very similar to the New Relic Servers process view. When Docker is running on a host and the feature is enabled (as it is by default), LSM will list all of the containers in use on the host and give you a quick overview of which Docker images are consuming the most CPU time and memory. The sample screenshot below, for example, shows two Docker images sorted by CPU:
LSM Basics
Before diving into the installation process, let’s take a moment to look at the basic conditions that LSM requires in order to execute. (We’ll concentrate on the system-level requirements as opposed to installation-specific requirements such as the configuration file and license key.)
In order for LSM to gather all of the system metrics to populate the graphs in the Servers page, it needs access to information stored by the kernel specifically for programs like LSM to query. This is done by accessing a number of special files in system directories such as /proc and /dev. On most Linux distributions the files required by LSM do not require special access privileges. There is no requirement for LSM to be run as the superuser.
As most developers are now aware, Docker is a virtualization technology that sits on top of Linux. It provides a mechanism for controlling the runtime environment for your applications. Although it is possible to run LSM from within a Docker/ECS container, we discourage this because it requires you to jump through several hoops when constructing the image that is to contain LSM. The preferred way of running LSM is at the operating system (EC2) level, so that it can report on overall system usage as well as individual Docker images.
Using LSM on ECS/EC2
How you install LSM on the EC2 instance depends on how it is set up. By default, ECS instances are hosted on a special Amazon Linux AMI.
LSM officially supports a number of popular Linux distributions, and we provide tar distributions for other versions of Linux. If your EC2 server is running Red Hat Enterprise Linux (RHEL) or one of its many derivatives (such as CentOS), then you would install LSM on that instance using the standard RHEL instructions. You would use a similar approach for Debian-based systems.
If you are using a different version of Linux, you will need to do a manual installation using the tar distribution. Please check the New Relic documentation for full details on how to install LSM.
Since EC2 servers are no different (from an LSM perspective) than bare metal servers, you don’t have to do anything “extra” or “special” to have LSM monitor your EC2 hosts. If those hosts are running ECS instances, LSM will automatically monitor those too.
In a nutshell, LSM should “just work” as long as you install it on the bare EC2 instance, not inside an ECS container.
Kean Johnston is a senior software engineer for New Relic.
Published at DZone with permission of Fredric Paul, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments