Carlos Aguni

Highly motivated self-taught IT analyst. Always learning and ready to explore new skills. An eternal apprentice.


Appdynamics Study

02 Sep 2021 »
  • https://docs.appdynamics.com/21.8/en/application-monitoring/install-app-server-agents/python-agent/python-agent-settings

  • app: APPDYNAMICS_AGENT_APPLICATION_NAME
  • tier: APPDYNAMICS_AGENT_TIER_NAME
  • node: APPDYNAMICS_AGENT_NODE_NAME
  • dir: APPDYNAMICS_AGENT_BASE_DIR
  • nodereuse: APPDYNAMICS_AGENT_REUSE_NODE_NAME
  • nodereuseprefix: APPDYNAMICS_AGENT_REUSE_NODE_NAME_PREFIX
  • uniquehostid: APPDYNAMICS_AGENT_UNIQUE_HOST_ID
export APPDYNAMICS_AGENT_NODE_NAME="pod-`hostname`"

Build a monitoring extension

  • https://community.appdynamics.com/t5/Knowledge-Base/How-do-I-build-a-Monitoring-or-Alerting-extension/ta-p/19580
    • Cassandra Extension: https://www.appdynamics.com/community/exchange/extension/cassandra-monitoring-extension/
    • Memcached Extension: https://www.appdynamics.com/community/exchange/extension/memcached-monitoring-extension/
    • Build a monitoring extension using java: https://docs.appdynamics.com/21.9/en/infrastructure-visibility/machine-agent/extensions-and-custom-metrics/build-a-monitoring-extension-using-java
    • Build a monitoring extension using scripts: https://docs.appdynamics.com/21.9/en/infrastructure-visibility/machine-agent/extensions-and-custom-metrics/build-a-monitoring-extension-using-scripts
  • Appdynamics vmware multibuildpack
    • https://docs.pivotal.io/partners/appdynamics/multibuildpack.html

Python Agent

https://docs.appdynamics.com/21.9/en/application-monitoring/install-app-server-agents/python-agent/python-agent-configuration-in-a-containerized-environment

Instrumenting Frontend

https://docs.appdynamics.com/21.5/en/end-user-monitoring/browser-monitoring/browser-real-user-monitoring/set-up-and-access-browser-rum

Angular

  • https://github.com/derrekyoung/appd-sampleapp-angular2
  • https://docs.appdynamics.com/21.5/en/end-user-monitoring/browser-monitoring/browser-real-user-monitoring/set-up-and-access-browser-rum

Opentracing

https://docs.appdynamics.com/21.5/en/application-monitoring/configure-instrumentation/automatic-instrumentation-of-specialist-packages-frameworks/open-tracing-support

<dependency>
     <groupId>com.appdynamics.agent</groupId>
     <artifactId>opentracer</artifactId>
     <version>4.5.13.27526</version>
</dependency>
import com.appdynamics.opentracing.core.AppdynamicsTracerFactory;
import com.lightbend.cinnamon.opentracing.TracerFactory;
import io.opentracing.Tracer;

public class AppdynamicsTracerPlugin implements TracerFactory {
    @Override
    public Tracer create() {
        return AppdynamicsTracerFactory.getTracer();
    }
}

https://docs.appdynamics.com/21.5/en/application-monitoring/ingest-opentelemetry-trace-data

help

otel-collector_1     | 2021-09-02T05:09:00.699Z info    exporterhelper/queued_retry.go:325      Exporting failed. Will retry the request after interval.        {"kind": "exporter", "name": "otlphttp", "error": "error exporting items, request to https://pdx-sls-agent-api.saas.appdynamics.com/v1/traces responded with HTTP Status Code 403", "interval": "5.52330144s"}
otel-collector_1     | 2021-09-02T05:09:17.978Z info    exporterhelper/queued_retry.go:325      Exporting failed. Will retry the request after interval.        {"kind": "exporter", "name": "otlphttp", "error": "error exporting items, request to https://pdx-sls-agent-api.saas.appdynamics.com/v1/traces responded with HTTP Status Code 403", "interval": "13.101300599s"}
otel-collector_1     | 2021-09-02T05:09:31.554Z info    exporterhelper/queued_retry.go:325      Exporting failed. Will retry the request after interval.        {"kind": "exporter", "name": "otlphttp", "error": "error exporting items, request to https://pdx-sls-agent-api.saas.appdynamics.com/v1/traces responded with HTTP Status Code 403", "interval": "15.823926909s"}

Java Instrument

  • https://docs.appdynamics.com/21.5/en/application-monitoring/install-app-server-agents/java-agent/use-the-java-agent-api-and-instrumentation-sdk
  • https://docs.appdynamics.com/21.5/en/application-monitoring/install-app-server-agents/java-agent/use-the-java-agent-api-and-instrumentation-sdk/java-agent-api-user-guide

https://docs.appdynamics.com/21.5/en/application-monitoring/install-app-server-agents/java-agent/use-the-java-agent-api-and-instrumentation-sdk

<dependency>
     <groupId>com.appdynamics.agent</groupId>
     <artifactId>agent-api</artifactId>
     <version>4.5.18.29239</version>
</dependency>

https://github.com/camisalo/simple-servlet/blob/706435d13658a960dca6b1c4985398701dacd4b9/pom.xml

download agent https://accounts.appdynamics.com/downloads

https://docs.appdynamics.com/21.5/en/application-monitoring/install-app-server-agents/java-agent/administer-the-java-agent

java -javaagent:/home/appdynamics/agent/javaagent.jar \
     -Dappdynamics.controller.hostName=mycontroller.example.com \
     -Dappdynamics.controller.port=8090 \
     -Dappdynamics.agent.applicationName=ACMEOnline \
     -Dappdynamics.agent.tierName=Inventory \
     -Dappdynamics.agent.nodeName=Inventory1 \
     MyApplication.jar
<?xml version="1.0" encoding="UTF-8"?>
<controller-info>
	<controller-host>192.168.1.20</controller-host>
	<controller-port>8090</controller-port>
	<controller-ssl-enabled>false</controller-ssl-enabled>
	<application-name>ACMEOnline</application-name>
	<tier-name>InventoryTier</tier-name>
	<node-name>Inventory1</node-name>
	<agent-runtime-dir></agent-runtime-dir>
	<enable-orchestration>false</enable-orchestration>
	<account-name>customer1</account-name>
	<account-access-key>341bf72e-7d7a-1234-b33d-9n712nn574</account-access-key>
	<force-agent-registration>false</force-agent-registration>
</controller-info> 

DB Instrument

Install DB Agent

https://docs.appdynamics.com/21.2/en/database-visibility/administer-the-database-agent/install-the-database-agent

java -Xmx1536m -jar /opt/appd-db-agent/db-agent.jar

MySQL

https://docs.appdynamics.com/21.1/en/database-visibility/add-database-collectors/configure-mysql-collectors

GRANT SELECT,PROCESS,SHOW DATABASES on *.* to 'DBMon_Agent_User'@'host' identified by 'password';
GRANT REPLICATION CLIENT ON *.* to 'DBMon_Agent_User'@'host';
FLUSH privileges;
docker run -dit --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=mysql mysql
docker exec -it mysql mysql -uroot -pmysql
create user 'DBMon_Agent_User'@'%' identified by 'root';
GRANT SELECT,PROCESS,SHOW DATABASES on *.* to 'DBMon_Agent_User'@'%';
GRANT REPLICATION CLIENT ON *.* to 'DBMon_Agent_User'@'%';
FLUSH privileges;

Postgresql

https://docs.appdynamics.com/21.1/en/database-visibility/add-database-collectors/configure-postgresql-collectors

psql -U admin <dbname>

Ensure that you create the pg_stat_statements extension by using the command, create extension pg_stat_statements.

CREATE FUNCTION get_sa() 
RETURNS SETOF pg_stat_activity LANGUAGE sql AS
$$ SELECT * FROM pg_catalog.pg_stat_activity; $$
VOLATILE
SECURITY DEFINER;
 
CREATE VIEW pg_stat_activity_allusers AS SELECT * FROM get_sa(); 
GRANT SELECT ON pg_stat_activity_allusers TO public;
CREATE FUNCTION get_querystats() 
RETURNS SETOF pg_stat_statements LANGUAGE sql 	AS
$$ SELECT * FROM pg_stat_statements; $$
VOLATILE
SECURITY DEFINER;
CREATE VIEW pg_stat_statements_allusers AS SELECT * FROM get_querystats();
GRANT SELECT ON pg_stat_statements_allusers TO public;

Quarkus + Appdynamics

https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/Quarkus.20.2B.20Appdynamics

Error help :(

 ____              _
 |  _ \            | |
 | |_) | ___   ___ | | _____
 |  _ < / _ \ / _ \| |/ / __|
 | |_) | (_) | (_) |   <\__ \
 |____/ \___/ \___/|_|\_\___/


Powered by Quarkus 2.2.1.Final
2021-09-01 23:50:23,039 INFO  [io.quarkus] (main) rest-book 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.2.1.Final) started in 1.566s. Listening on: http://0.0.0.0:8702
2021-09-01 23:50:23,044 INFO  [io.quarkus] (main) Profile prod activated. 
2021-09-01 23:50:23,044 INFO  [io.quarkus] (main) Installed features: [cdi, rest-client, resteasy, resteasy-jsonb, smallrye-context-propagation, smallrye-fault-tolerance, smallrye-openapi]
2021-09-01 23:50:27,835 INFO  [io.ver.ext.web.RoutingContext] (executor-thread-0) RoutingContext failure (500): org.jboss.resteasy.spi.UnhandledException: java.lang.LinkageError: loader constraint violation: when resolving method 'com.appdynamics.instrumentation.sdk.logging.ISDKLogger com.appdynamics.agent.sdk.impl.LoggerFactory.getNewLogger(java.lang.String)' the class loader io.quarkus.bootstrap.runner.RunnerClassLoader @130f889 of the current class, com/appdynamics/agent/api/AppdynamicsAgent, and the class loader 'bootstrap' for the method's defining class, com/appdynamics/agent/sdk/impl/LoggerFactory, have different Class objects for the type com/appdynamics/instrumentation/sdk/logging/ISDKLogger used in the signature (com.appdynamics.agent.api.AppdynamicsAgent is in unnamed module of loader io.quarkus.bootstrap.runner.RunnerClassLoader @130f889, parent loader 'app'; com.appdynamics.agent.sdk.impl.LoggerFactory is in unnamed module of loader 'bootstrap')
        at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:106)
        at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:372)
        at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:218)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:519)
        at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:261)
        at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:161)
        at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
        at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:164)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:247)
        at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:73)
        at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:138)
        at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1.run(VertxRequestHandler.java:93)
        at io.quarkus.vertx.core.runtime.VertxCoreRecorder$13.runWith(VertxCoreRecorder.java:543)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
        at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
        at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:829)

Docker

FROM openjdk:11-jdk

COPY ./appdynamics-agent /opt/appdynamics-agent
COPY ./start.sh /start.sh

CMD ["/start.sh"]
#!/bin/bash

export APPDYNAMICS_AGENT_APPLICATION_NAME=demo_app
#export APPDYNAMICS_AGENT_TIER_NAME=quarkus_book_tier
export APPDYNAMICS_AGENT_ACCOUNT_NAME=
export APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY=
export APPDYNAMICS_CONTROLLER_HOST_NAME=.saas.appdynamics.com
export APPDYNAMICS_CONTROLLER_PORT=443
export APPDYNAMICS_CONTROLLER_SSL_ENABLED=true
export APPDYNAMICS_AGENT_NODE_NAME="pod-`hostname`"
#export APPDYNAMICS_JAVA_AGENT_REUSE_NODE_NAME=false
#export APPDYNAMICS_JAVA_AGENT_REUSE_NODE_NAME_PREFIX=<value>


java -javaagent:/opt/appdynamics-agent/ver21.8.0.32958/javaagent.jar \
     -jar /wkdir/quarkus-run.jar

Resolving backends to Tiers

https://docs.appdynamics.com/21.3/en/application-monitoring/remote-services/resolve-remote-services-to-tiers