APM Agent 9.x with Elasticsearch Kibana

Published on 2025-10-05

« See All Lectures Contact Us
APM Agent 9.x with Elasticsearch Kibana

Introduction

We will set up Elasticsearch and Kibana as our Application Performance Monitoring (APM) server. This tutorial will summarize the steps from our more [indepth tutorial on Elasticsearch and Kibana version 9]. see here.

Download Code: Available on Github

Requirements

We use two different linux server:

Steps

Step 1 - Install Elasticsearch Kibana

Place this install.sh script on to the server you wish to use as your Elasticsearch Kibana APM logging server.

Update the variable baseip at the top of the file with the IP address of your Elasticsearch Kibana APM server.

Run chmod +x install.sh && ./install.sh

When things are complete, reset the elastic super user password by running /usr/share/elasticsearch/bin/elasticsearch-reset-password -i -u elastic.

Create an enrollment token with this command /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana. Copy the enrollment token, you will need it later.

Type systemctl status kibana to get the url you are supposed to visit. It should look something like https://0.0.0.0/?code=129302. Visit this url in your web browser (You may need to replace the 0.0.0.0 with the actual IP address of your elasticsearch server. Paste in your enrollment token and submit it.

Now you can login to the Elasticsearch and Kibana with the password you created for the elastic user.

Step 2 - Install APM Agent

Update Ubuntu

Make sure your ubuntu machine is up to date and has some of the common tools. Run this command:

apt-get update && apt dist-upgrade -y && apt-get install -y vim curl zip jq gnupg gpg

Install APM Agent

You will need a copy of the CA used by elasticsearch. From the application server, do something like this:

mkdir /etc/certs scp root@ip.of.apm-logging.server:/etc/elasticsearch/certs/http_ca.crt /etc/certs/http_ca.crt

Now run the code below to isntall the agent, but replace ip.of.apm-logging.server and the password you chose with the appropriate values.

curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-9.1.4-linux-x86_64.tar.gz
tar xzvf apm-server-9.1.4-linux-x86_64.tar.gz
cat > ~/apm-server-9.1.4-linux-x86_64/apm-server.yml <<'EOL'
apm-server:
  host: '0.0.0.0:8200'
  secret_token: 'abcd1234'
output.elasticsearch:
  hosts: ['ip.of.apm-logging.server:9200']
  enabled: true
  protocol: 'https'
  username: 'elastic'
  password: 'the password you chose'
  ssl.enabled: true
  ssl.verification_mode: full
  ssl.certificate_authorities: ['/etc/certs/http_ca.crt']
logging.level: error
EOL
cd ~/apm-server-9.1.4-linux-x86_64
chown -R root:root .
./apm-server

For the apm-server.host, the 0.0.0.0 is very permissive. Consider using the actual ip address of the server or 127.0.0.1 if it is just localhost.

Step 3 - Install Application

See the Testing Applications of the Beginner's Guide to install and test APM.