[ARM64] Docker server monitoring with New Relic on Docker on RasPi4

Recently, I started up services one after another with Docker on Raspberry Pi 4B (4GB), and I wanted to monitor the server, so I made a note of how to do it.

--Server monitoring tool compatible with Docker --Supports ARM architecture --I want to monitor the server itself on Docker

It should be useful for greedy people.

things to do

Monitor the status (CPU, memory, process) of the server running on Raspberry Pi 4B (4GB).

environment

Requests to each server are distributed using nginx-proxy.

About New Relic

There are many server monitoring tools, but the ones that support Docker are limited. For the selection of services, I referred to this article and selected New Relic, which is a SaaS type and can be used easily and for free. The price of the server monitoring tool is high, and I felt that it was difficult to introduce it to a service that was only released for personal development, but with New Relic One, it is a free license up to 100 GB of data acquisition every month. You can use it. It's more than enough for personal use. New Relic has multiple services such as app performance monitoring (APM) and ping alive monitoring, but this time we will use Infrastructure, which allows you to see the amount of CPU and memory used.

Account creation / license key acquisition

Go to the New Relic site and press "Free sign up" in the upper right corner to create an account. Once you've created your account, select Account settings from the account dropdown in the upper right and click API keys from the left sidebar. Press Create key to create a key with Key type as Ingest --License and Name as any name.

Set up a Docker container

For x86-64, the Docker image is officially provided, so all you have to do is start the container according to the Official Document, but since it is arm64, you need to build it yourself.

Build Docker image

That said, all you have to do is replace the three binaries newrelic-infra, newrelic-infra-ctl, and newrelic-infra-service that are plunged into the image. The binaries are officially provided, so download them from the link below (as of January 2021, 1.9.7 is the latest). https://download.newrelic.com/infrastructure_agent/binaries/linux/

mkdir ~/newrelic-infra-setup
cd ~/newrelic-infra-setup
wget https://download.newrelic.com/infrastructure_agent/binaries/linux/arm64/newrelic-infra_linux_1.9.7_arm64.tar.gz
tar -zxvf newrelic-infra_linux_1.9.7_arm64.tar.gz

Next, clone the newrelic/infrastructure-agent GitHub repository.

git clone https://github.com/newrelic/infrastructure-agent.git

For how to build the Docker image, refer to This page. First, copy the downloaded binary to the specified folder. Putting the arm64 binary in linux_amd64 is also a thing, but that is through.

mkdir -p infrastructure-agent/target/bin/linux_amd64
cp newrelic-infra/usr/bin/* infrastructure-agent/target/bin/linux_amd64/
cd infrastructure-agent/build/container
export IMAGE_VERSION=1.0  #Appropriately. 0 if not specified.Become 0
make build/base

Set up a Docker container

Now that the Docker image is generated, set up the container in the same procedure as x86-64. Follow the steps on this page (https://docs.newrelic.com/docs/infrastructure/install-infrastructure-agent/linux-installation/docker-container-infrastructure-monitoring).

Put the first license key you got in newrelic-infra.yml.

cd ~/newrelic-infra-setup
echo "license_key: {YOUR_LICENSE_KEY}" > newrelic-infra.yml
touch newrelic-infra.dockerfile
vim newrelic-infra.dockerfile  #Any editor is fine

newrelic-infra.dockerfile


FROM newrelic/infrastructure:latest
ADD newrelic-infra.yml /etc/newrelic-infra.yml
touch docker-compose.yaml
vim docker-compose.yaml  #Any editor is fine

docker-compose.yaml


version: '3'

services:
  agent:
    container_name: newrelic-infra
    build:
      context: .
      dockerfile: newrelic-infra.dockerfile
    cap_add:
      - SYS_PTRACE
    network_mode: host
    pid: host
    privileged: true
    volumes:
      - "/:/host:ro"
      - "/var/run/docker.sock:/var/run/docker.sock"
    restart: unless-stopped
docker-compose build
docker-compose up -d

Now that server monitoring has already started, select Infrastructure from the top bar on the New Relic website and you'll see a graph of CPU usage and free memory percentage.

Screenshot_2021-01-12 Infrastructure New Relic One.png

Also, if you open Entity explorer from the top bar, there are various other graphs and tables, so you can add whatever you like to the dashboard.

Screenshot_2021-01-12 Docker New Relic One.png

newrelic-infra uses the most CPU, grass.

Bug

--Infrastructure> Hosts> Docker Containers does not get information for each container --docker-compose logs is throwing an error (" integration exited with error state ")

I chose New Relic because it supports Docker, but I can't use it because it's overwhelming, so I'd like to fix it somehow.

References

New Relic Pricing (Japanese) New Relic license key Docker container for infrastructure monitoring Docker instrumentation for infrastructure monitoring newrelic/infrastructure-agent newrelic/infrastructure-agent - Containerized Agent newrelic/infrastructure-agent - ARM64 (aarch64) support #107 Service that monitors Docker container New Relic, which advocates the "digital new normal concept," has renewed its products and pricing system

Recommended Posts

[ARM64] Docker server monitoring with New Relic on Docker on RasPi4
Run SQL Server with Docker ToolBox
WordPress with Docker Compose on CentOS 8
Gats by new with yarn (Docker)
I tried running Docker on Windows Server 2019
Scraping with puppeteer in Nuxt on Docker.
Proxy server with squid using docker image
Build an environment with Docker on AWS
Create external (URL) monitoring with Docker + Prometheus
Launched Redmine with Docker on Raspberry Pi 3
Run Ubuntu + ROS with Docker on Mac
Try running MPLS-VPN with FR Routing on Docker
Start SQL Server with Docker & register initial data
Introducing Rspec with Ruby on Rails x Docker
Environment construction command memo with Docker on AWS
Radiko recording server on Raspberry Pi 4 (Docker unused)
Introducing New Relic to Rails apps on Heroku
Try running OSPF with FR Routing on Docker
Run JSP Hello World with Tomcat on Docker
Notes on building Rails6 / PostgreSQL with Docker Compose
Update container image with KUSANAGI Runs on Docker