Jenkins building docker container images with AppInternals agent

This is an example for building a Docker container with monitoring in place.

This was based on the excellent work of Kevin Godin and using "including Linux Agents in Docker Images" in appInternals documentation

In this case, it is a CentOS image that is built on a CentOS server.

 

To summarise the process, what we were doing is

- Start from CentOS image.

- Install needed packages

- Install Java

- Install supervisor

- Install Tomcat

- Install appinternals agent. (note that you can point to a URL and get the agent file or just put it in the build directory, which was the option I chose).

 

Explaining the files that I used.

This is a full example, there is a minimal number of files needed but I wanted to show more of the available options.

docker files.jpg

1. appinternals_agent_latest_linux.gz - I chose actually to put the agent installer in the build directory, but you can change the Dockerfile just to get the file from our download site. Note that the attached .tar.gz does not have the agent installed as I wanted to keep it small.

2. config.json - your preferred configuration settings (the documentation explains how to get the file).

3. Dockerfile - note that you can remark the local agent installer and unremark the download of the agent installer.

     The attached Dokerfile has a Tomcat download URL that changes with new releases, please replace it with the current link from the      Apache Tomcat page Apache Tomcat® - Apache Tomcat 8 Software Downloads

4. Initial-mapping - making sure Tomcat processes are instrumented when they start.

5. Install.properties - for the silent installer, it needs to be changed to reflect your environment (analysis server location, SaaS/on-premises,).

6. panorama.conf - you can play/set the starting time to accept agents.

7. supervisor.conf - the supervisor config file starting tomcat and apinternals agent.

8. supervisor wrapper -  following common supervisor and tomcat examples.

9. tags.yaml - has some generic tags, so the best is to give tags that reflect your environment.

 

Test the build is working correctly and that the containers are reporting to AppInternals when you run them.

docker in gui.jpg

 

 

 

You can see the process in the following video

 

 

You can also use Jenkins to automate the build and run this on a schedule, in this case, I just took the very simple approach of running a shell script that has this

cd /home/riverbed/Downloads/tomcatwaiagent

docker build -t tomcatwaiagent .


jenkins.jpg



I hope you find this useful


Golan