The new beta release of the New Relic Linux Server Monitor (LSM) version 220.127.116.11 contains improved support for running LSM in a container on CoreOS. This support comes in three parts:
- A script for running LSM in a container from the command line.
- A sample script for building your own image file for uploading to Dockerhub or whatever other repository you use.
fleetctl service file for running LSM on a number of CoreOS cluster nodes.
Running from the Command Line
If you simply want to start LSM in a new container from the command line you can simply use the
run-docker-image script found in the
docker sub-directory where you extracted the beta tar file. You will need to edit this file and insert your New Relic license key.
If you use
fleetctl to manage a number of CoreOS nodes, you can use the sample service file
nrsysmond.service which is also located in the
docker sub-directory of the extracted tar file. This too will need to be edited to insert your New Relic license key. How to set up and manage Fleet is beyond the scope of this document.
Building your own image
Both of the aforementioned mechanisms for running LSM inside Docker on CoreOS use the image called
newrelic/nrsysmond:latest. This image is stored on Dockerhub for your convenience and you can simply run it as you would any other Docker container, albeit with a few required command line options (which is what the
run-docker-image script does). However, if you want to build and use your own image you are more than welcome to do so. A sample
Dockerfile is provided in the root of the extracted tar directory, and the file
docker/build-docker-image can be used to build a new image. You may want to edit both the
Dockerfile and this script. If you build your own image you will need to edit the
nrsysmond.service files to use whatever you call your new image.
Using environment variables
New with this beta release is the
-E option for
nrsysmond. This tells LSM to look for all of its configuration information in the environment, rather than in a config file. If you use the
-E flag then no config file is obeyed, even if you specify one on the command line. To use the environment variables, simply ensure they are set before running
nrsysmond. You can pass environment variables to a Docker container using the
docker run command's
-e flag. The environment variable is the same keyword as would be found in the configuration file, but with the prefix
NRSYSMOND_. So for example the configuration file variable called
loglevel would use the environment variable
To specify the license key and log level to use, you can do the following: