Skip to content
Leif Eric Hintzsche edited this page May 24, 2020 · 16 revisions

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 would deploy the supercars application without AppDynamics. Afterwards, you can follow the manual instrumentation steps described in this Wiki article.

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

Install packages and update certificates

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

Create AppD user and group

  • 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 Agents from https://download.appdynamics.com/download/ (adjust the agent version in case needed)

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 root:appd /opt/appd/
  • sudo chmod -R u=rwx,g=rwx,o=rx /opt/appd/

Login as Tomcat server user and start server

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)
  • exit

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
  • 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/Cars_Sample_App/home.jsp
  • 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
  • appdynamics.agent.uniqueHostId=RAVELLO_VM
  • ad.controller.url='https://ACCOUNT.saas.appdynamics.com'
  • http.event.endpoint='https://fra-ana-api.saas.appdynamics.com:443'
  • http.event.name=ACCOUNT
  • http.event.accountName=ACCOUNT_5a9b9754-9f17-4528-af7f-5c99b05af7e9
  • http.event.accessKey=6gxy3yi7pg0l
  • service appdynamics-machine-agent restart
  • debug service appdynamics-machine-agent restart
  • enable with a user that has the necessary access rights in Analytics -> Configuration -> select App -> select transactions -> save
  • 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 logs)
Clone this wiki locally