Skip to content
Leif Eric Hintzsche edited this page Aug 27, 2020 · 16 revisions

Introduction

The playbooks and the roles provide a sample application that can be instrumented using AppDynamics. The instrumentation can be done manually or via playbooks. For a manual instrumentation, you deploy the supercars application without AppDynamics.

alt text

For the instrumentation, you can use an AppDynamics trial account:

This Wiki assumes that you are using CentOS7 as operating system.

Installation of needed packages

sudo yum install unzip vim nmap
sudo yum update -y nss curl libcurl

Creation of user and group for appd

sudo useradd appd
sudo groupadd appd
sudo usermod -a -G appd appd
sudo usermod -a -G appd tomcat
sudo usermod -a -G appd root

Create directory for AppDynamics

sudo mkdir -p /opt/appd/machine_agent
sudo mkdir -p /opt/appd/java_agent
sudo mkdir -p /opt/appd/db_agent

Download the appdynamics agent via terminal or on the webpage

You will need and appdynamics account in order to access the webpage

Further, you might need to adjust the agent version in the statements below. Just go on the download portal, select the respective agent and copy the link. The link can be used in the following curl statements

TOKEN=\`curl -X POST -d '{"username": "USER","password": "PWD","scopes": ["download"]}' https://identity.msrv.saas.appdynamics.com/v2.0/oauth/token | sed s/\\"/\\|/g | awk 'BEGIN{FS="|"}{print $10}'\`
curl -L -O -H "Authorization: Bearer $TOKEN" "https://download.appdynamics.com/download/prox/download-file/machine-bundle/4.5.16.2357/machineagent-bundle-64bit-linux-4.5.16.2357.zip"
curl -L -O -H "Authorization: Bearer $TOKEN" "https://download.appdynamics.com/download/prox/download-file/sun-jvm/4.5.16.28759/AppServerAgent-4.5.16.28759.zip"
curl -L -O -H "Authorization: Bearer $TOKEN" "https://download.appdynamics.com/download/prox/download-file/db-agent/4.5.5.985/db-agent-4.5.5.985.zip"

Unzip Agents to AppDynamics directory

sudo unzip machineagent-bundle-64bit-linux-4.5.16.2357.zip -d /opt/appd/machine_agent
sudo unzip AppServerAgent-4.5.16.28759.zip -d /opt/appd/java_agent
sudo unzip db-agent-4.5.5.985.zip -d /opt/appd/db_agent
sudo chown -R appd:appd /opt/appd/
sudo chmod -R u=rwx,g=rwx,o=rx /opt/appd/

Login as Tomcat user and start server

sudo su - tomcat
cd /opt/tomcat/apache-tomcat-8.0.30/bin/
./catalina.sh start

Configure java agent

sudo su -
touch /opt/tomcat/apache-tomcat-8.0.30/bin/setenv.sh
chmod +x /opt/tomcat/apache-tomcat-8.0.30/bin/setenv.sh
chown tomcat /opt/tomcat/apache-tomcat-8.0.30/bin/setenv.sh
chgrp tomcat /opt/tomcat/apache-tomcat-8.0.30/bin/setenv.sh
echo 'export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/opt/appd/java_agent/javaagent.jar -Dappdynamics.agent.uniqueHostId=RAVELLO_VM"' \> /opt/tomcat/apache-tomcat-8.0.30/bin/setenv.sh
sudo vim /opt/appd/java_agent/conf/controller-info.xml
  • set <controller-host>ACCOUNT.saas.appdynamics.com</controller-host> (see controller DNS)
  • set <controller-port>443</controller-port>
  • set <controller-ssl-enabled>true</controller-ssl-enabled>
  • set <application-name>APPNAME</application-name>
  • set <tier-name>TOMCAT</tier-name>
  • set <node-name>RAVELLO</node-name>
  • set <account-name>ACCOUNT</account-name> (see Settings->License->Top-Tab: Account -> Name)
  • set <account-access-key>KEY</account-access-key> (see Settings->License->Top-Tab: Account -> Access Key)

Restart Tomcat

sudo su - tomcat
cd /opt/tomcat/apache-tomcat-8.0.30/bin/
./catalina.sh stop
./catalina.sh run (to see if the agent starts correctly, if not check setenv.sh)
./catalina.sh stop
./catalina.sh start

Check if the agent started successfully

grep AppDynamics /opt/tomcat/apache-tomcat-8.0.30/logs/catalina.out (output: Started AppDynamics Java Agent Successfully)
vi /opt/appd/java_agent/ver4.5.16.28759/logs/RAVELLO/agent.*.log

Check Java Agent in Controller

  • Check Top-Tab: Applications, Side-Tab: Tiers and Nodes (agent must pop-up even w/o traffic)
  • Check Setting: AppDynamics Agents, App Server Agent (find your unique host-id)
  • Generate traffic by clicking around in the application http://IP:8080/Cars_Sample_App/angular/index.html#/
  • Check Top-Tab: applications, Side-Tab Application Dashboard (compare Flow-Map)

Configure Server Agent

sudo vim /opt/appd/machine_agent/conf/controller-info.xml
  • set <controller-host>ACCOUNT.saas.appdynamics.com</controller-host> (see controller DNS)
  • set <controller-port>443</controller-port>
  • set <controller-ssl-enabled>true</controller-ssl-enabled>
  • set <unique-host-id>RAVELLO_VM</unique-host-id>
  • set <account-access-key>KEY</account-access-key> (see Settings->License->Top-Tab: Account -> Access Key)
  • set <account-name>ACCOUNT</account-name> (see Settings->License->Top-Tab: Account -> Name)
  • set <application-name>APPNAME</application-name>
  • set <account-name>ACCOUNT</account-name> (see Settings->License->Top-Tab: Account -> Name)
  • set <sim-enabled>true (enable for server visibility)
  • set <machine-path>RAVELLO|TOMCAT_VM</machine-path>

Configure Machine Agent as a service

sudo su -
cp /opt/appd/machine_agent/etc/sysconfig/appdynamics-machine-agent /opt/appd/machine_agent/etc/sysconfig/appdynamics-machine-agent.cp
cat /opt/appd/machine_agent/etc/sysconfig/appdynamics-machine-agent.cp | sed  's|/appdynamics/|/appd/|g' | sed  's|/machine-agent|/machine_agent|g' | sed 's|appdynamics-machine-agent|appd|g' > /opt/appd/machine_agent/etc/sysconfig/appdynamics-machine-agent
ln -s /opt/appd/machine_agent/etc/sysconfig/appdynamics-machine-agent /etc/sysconfig/appdynamics-machine-agent
cp /opt/appd/machine_agent/etc/init.d/appdynamics-machine-agent /etc/init.d/appdynamics-machine-agent
chkconfig --add appdynamics-machine-agent

Start Machine Agent

service appdynamics-machine-agent start
check machine agent under Top-Tab: Applications, Side-Tab Server
check Setting: AppDynamics Agents, Machine Agents (find your unique host-id)
check Server Visibility is set to yes
check running processes ps -aux | grep appd | vi -

Install Network Visibility

cd /opt/appd/machine_agent/extensions/NetVizExtension/agent/conf
sudo vim agent_config.lua
  • change to UNIQUE_HOST_ID = "RAVELLO_VM"
cd /opt/appd/machine_agent/extensions/NetVizExtension/
sudo ./install-extension.sh
service appdynamics-machine-agent restart

Install Analytics Agent

sudo vi /opt/appd/machine_agent/monitors/analytics-agent/monitor.xml
  • set <enabled>true</enabled>
sudo vi /opt/appd/machine_agent/monitors/analytics-agent/conf/analytics-agent.properties
service appdynamics-machine-agent restart
debug service appdynamics-machine-agent restart
  • activate analytics Analytics -> Configuration -> select App -> select transactions -> save
  • check that the analtyics agent is running
curl http://localhost:9091/healthcheck?pretty=true

Install DB Agent

cd /opt/appd/db_agent/
sudo vim  /opt/appd/db_agent/conf/controller-info.xml
  • set <controller-host>ACCOUNT.saas.appdynamics.com</controller-host> (see controller DNS)
  • set <controller-port>443</controller-port>
  • set <controller-ssl-enabled>true</controller-ssl-enabled>
  • set <account-name>ACCOUNT</account-name> (see Settings->License->Top-Tab: Account -> Name)
  • set <account-access-key>KEY</account-access-key> (see Settings->License->Top-Tab: Account -> Access Key)
sudo ./start-dbagent -Dappdynamics.agent.uniqueHostId=RAVELLO_VM &

Create DB user to collect SQL metrics

mysql -u root -p (password=AppDynamics)
CREATE USER 'DBUSER'@'localhost' IDENTIFIED BY 'DBUSER'; (access from localhost)
CREATE USER 'DBUSER'@'%' IDENTIFIED BY 'DBUSER'; (access from all remote IPs)
GRANT SELECT,PROCESS,SHOW DATABASES on \*.\* to 'DBUSER'@'localhost' identified by 'DBUSER';
GRANT SELECT,PROCESS,SHOW DATABASES on \*.\* to 'DBUSER'@'%' identified by 'DBUSER';
GRANT REPLICATION CLIENT ON \*.\* to 'DBUSER'@'localhost';
GRANT REPLICATION CLIENT ON \*.\* to 'DBUSER'@'%';
FLUSH PRIVILEGES;
EXIT;
sudo service iptables stop (stop firewall on VM or open specific port 3306)
  • test connection with SQL client (e.g. DBeaver, SQuirreL) and nmap -p 3306 IP

Create DB user to collect HW metrics

sudo useradd dbuser
sudo passwd dbuser
sudo vim /etc/ssh/sshd_config
set PasswordAuthentication yes
unset PasswordAuthentication no (e.g. use comment)
sudo vim /etc/ssh/ssh_config
  • set PasswordAuthentication yes
service sshd restart

Setup DB and HW collector in GUI

  • Top-Tab: Databases, Side-Tab: Configuration -> add
  • Set Database Type = MySQL
  • Set Hostname = localhost or IP
  • Set Name = Supercars
  • Set Listener Port= 3306
  • Set Username = DBUSER (user on SQL server)
  • Set Password = DBUSER (password for SQL server)
  • Check Logging
  • Check Monitor Operating System
  • Set Operating System = LINUX
  • Set SSH Port = 22
  • Set Username = dbuser (user on linux machine)
  • Set Password = dbuser (user on linux machine)
sudo vim /opt/appd/db_agent/logs/agent.log (check the logs)