Monitoring with AppDynamics

Samiksha Jadhav
5 min readMay 3, 2021

Introduction:

AppDynamics is a leading Application Performance Management (APM) product. It is a tool that monitors your Application Infrastructure and gives you code level visibility and server level visibility. It is supported for all major technologies (Java, . NET, PHP, NodeJs).

It also helps you to monitor your databases, AKS cluster, business transactions and sends alerts based on your configuration.

In this article we will cover :

  • Monitoring of on premise application containers
  • Monitoring of Kubernetes cluster
  • Configure email alerts

Note: This article does not cover installation of AppDynamics.

Features:

  • Code level visibility
  • Powerful alerting
  • Visibility and control
  • Browser Real-User Monitoring
  • Application performance management
  • Database agents
  • Server Visibility
  • Trend database performance over time
  • Monitor multiple platforms
  • Troubleshoot performance issues

Monitoring of on premise application containers:

This will help us to monitor the host VM including all the services running inside it and the containers.

Steps to configure server and container monitoring:

Configure Machine Agent:

We need the machine agent to send metrics to the AppD controller. Machine agent will read how many containers have java agent running inside them including all the information of your VM instance and send that to the controller.

Follow below guidelines to configure machine agent:

  • Download the files from github:

https://github.com/Appdynamics/Dynamic-Agent-MA

  • Open controller.env and edit the details:
CONTROLLER_HOST=my.domain.comCONTROLLER_PORT=8090CONTROLLER_SSL_ENABLED=falseACCOUNT_NAME=customer1GLOBAL_ACCOUNT_NAME=<global-account-name>ACCOUNT_ACCESS_KEY=”<access-key>”APPLICATION_NAME=”your-application-name”EVENT_SERVICE_URL=”my.domain.com:9080”USE_UNIQUE_HOST_ID=falseAPPDYNAMICS_SIM_ENABLED=trueMA_PROPERTIES=-Dappdynamics.docker.container.containerIdAsHostId.enabled=trueAPPDYNAMICS_DOCKER_ENABLED=true

NOTE: Update controller.env and then start container with ./run.sh only.

Configure Application Containers:

While writing the docker image definition, we need to configure java agent and AppD controller details inside the Dockerfile. That means we will be building our image with application jar as well as java agent jar which is for java applications.

We need to install java agent for java applications only. If you are working on other languages like python or nodeJs than you need pyagent and nodeagent while building your image.

A sample Dockerfile for java application is described below:

Dockerfile:

FROM openjdk:8-jdk-alpine AS buildRUN mkdir /home/appCOPY . /home/appWORKDIR /home/appRUN javac DockerConnectMySQL.javaFROM openjdk:11-jreUSER $USERRUN mkdir -p /opt/appdynamics && \cd /opt/appdynamics/ && \wget https://download.appdynamics.com/onpremise/public/archives/4.2.1.6/AppServerAgent.zip -O /opt/appdynamics/AppServerAgent-4.2.1.6.zip && \unzip /opt/appdynamics/AppServerAgent-4.2.1.6.zip && \rm /opt/appdynamics/AppServerAgent-4.2.1.6.zipCOPY — from=build /home/app/mysql-connector-java-5.1.49.jar mysql-connector-java-5.1.49.jarENV APPDYNAMICS_CONTROLLER_HOST_NAME “ my.domain.com “ENV APPDYNAMICS_CONTROLLER_PORT “8090”ENV APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY “my access key”ENV APPDYNAMICS_SIM_ENABLED “true”ENV APPDYNAMICS_AGENT_APPLICATION_NAME “your application name”ENV APPDYNAMICS_AGENT_TIER_NAME “INT”ENV APPDYNAMICS_AGENT_NODE_NAME “customer1”ENV APPDYNAMICS_DOCKER_ENABLED “true”ENTRYPOINT [“java”, “-XX:+UnlockExperimentalVMOptions”, “-XX:+UseZGC”, “-javaagent:/opt/appdynamics/javaagent.jar”, “-classpath”, “mysql-connector-java-5.1.49.jar:.”, “DockerConnectMySQL”]CMD [“java”, “-classpath”, “mysql-connector-java-5.1.49.jar:.”,”DockerConnectMySQL”]

After building your image, start the container.

Machine agent will be able to track the container, as java agent is running inside it and it will start sending metrics to the AppDynamics controller. Please find below screenshots :

Application Dashboard :

VM Details:

Container details:

Server visibility:

Business transactions:

Tiers and nodes:

App server agent status:

Apart from the above shown metrics, AppD provides a wide variety of other metrics as well for actively monitoring your application.

Monitoring of Kubernetes cluster:

Monitoring for Kubernetes cluster is comparatively easy to configure.

Configurations:

  • Login to the cluster for which you want to set up monitoring.
  • Create a namespace appdynamics
  • Create 2 files- cluster-agent-operator.yaml & cluster-agent.yaml
  • You can find files here:

https://github.com/Appdynamics/appdynamics-operator/tree/master/deploy

  • Update the cluster-agent.yaml configuaration as below:
appName: “your application name”controllerUrl: your.domain.com:8090account: “customer1”
  • Deploy cluster-agent-operator.yaml:
kubectl create -f cluster-agent-operator.yaml
  • Create a secret using below command:
kubectl -n appdynamics create secret generic cluster-agent-secret — from-literal=controller-key=’your-key’
  • Deploy the Cluster Agent:
kubectl create -f cluster-agent.yaml

Now give it 20–30 mins and then you will be able to see all the metrics like pods, containers, CPU details etc.

You can check pods and container metrics as well:

Email alerts:

We can create email alerts for server memory/CPU, application exceptions, errors, response time and loads more. To create email alerts based on our metrics, need to create health rules, Actions and policy.

Health rules: To view current health rules, and to create new health rule click on Alert & Respond > Health Rules. Here we will be defining the affected entities, time/wait time and criteria of email alerts.

Actions: Add multiple email ID’s or DL’s separated by comma. (There are other options like running script, http request, sms message etc, which can be selected based upon the requirements.)

Policy: Now define a policy on which email alerts will be triggered.

  1. Here you will need to first select event for which email alert will be triggered like Health rule violation started(critical/warning).
  2. Select health rule which was created in previous steps in the health rule scope.
  3. Select object (ex: Business Transaction, Errors, Servers etc.) in Object scope.
  4. In actions add email id’s which were created in previous steps. This steps will attach this policy to your actions.

That’s it, Wait for sometime and you will start getting alerts.

Conclusion:

You can configure appdynamics directly for your applications on bare metal servers. Just provide appd arg as java arg when triggering the JVM. Make sure that the java agent and machine agent are configured properly.

AppDynamics provides in depth visibility of your application in a single dashboard. It is easy to set up and helps to monitor and manage end to end performance of complex and distributed applications.

--

--