This topic helps you deploy the Machine Agent on the Pivotal CloudFoundry (PCF) platform.

Before You Start

  • Acquire admin or space developer access on CloudFoundry to deploy, run, and manage applications.
    For more information on access rights see the CloudFoundry documentation.
  • Download Machine Agent.

Setting Up Machine Agent

  1. Set up the AppDynamics GitHub repository.

    git clone 
    cd cloudfoundry-apps/cf-machine-agent 
  2. Ensure that the Standalone Machine Agent is downloaded from the AppDynamics Download Center into the current directory.

    (master)$ ls	extensions			manifest.yml
  3. Copy the extensions, if any, to the extensions directory. Note that extensions must be of .zip format, containing extension_folder/{.jar, *.monitor.xml}.

    (master)$ cp ~/Downloads/ extensions/
  4. Edit the JAVA_OPTS section in the manifest.yml to add the Controller information. 
    For example, the manifest.yml is similar to the following after filling in the details:

    - name: appdynamics-machine-agent
      memory: 1G
      health-check-type: process
      no-route: true
      buildpack: java_buildpack_offline
        JAVA_OPTS: '-Dappdynamics.agent.accountAccessKey=accessKey -Dappdynamics.agent.accountName=customer1 -Dappdynamics.controller.port=8090 -Dappdynamics.agent.applicationName=app -Dappdynamics.agent.tierName=tier -Dappdynamics.agent.nodeName=node -Dappdynamics.controller.ssl.enabled=false'

    You may check the additions as follows:

    (master)$ git diff
    -    JAVA_OPTS: '-Dappdynamics.agent.accountAccessKey={} -Dappdynamics.agent.accountName={} -Dappdynamics.controller.hostName={} -Dappdynamics.controller.port={} -Dappdynamics.agent.applicationName={} -Dappdynamics.agent.tierName={} -Dappdynamics.agent.nodeName={} -Dappdynamics.controller.ssl.enabled={true|false}'
    +    JAVA_OPTS: '-Dappdynamics.agent.accountAccessKey=accessKey -Dappdynamics.agent.accountName=customer1 -Dappdynamics.controller.port=8090 -Dappdynamics.agent.applicationName=app -Dappdynamics.agent.tierName=tier -Dappdynamics.agent.nodeName=node -Dappdynamics.controller.ssl.enabled=false'
  5. Run

    This script packages the extension zip files into the Machine Agent monitor directory, cleans the Machine Agent, and adjusts the permissions of files per requirements from PCF.

    (master)$ ./ 
    Creating workdir tmp
    Moving MachineAgent to tmp dir
    Unzipping MachineAgent
    Unzipping Extensions from ../extensions to ./monitors Directory
    Cleaning MachineAgent - removing *.asc files
    Adjusting permissions as per requirement from CloudFoundry
    Packaging MachineAgent
  6. Deploy the Machine Agent application.

    (master)$ cf push 
    Pushing from manifest to org appdynamics-org / space appdynamics-space as admin...
    Using manifest file /Users/appD_user/appdy/cloudfoundry-apps/cf-machine-agent/manifest.yml
    Getting app info...
    Updating app with these attributes...
      name:                appdynamics-machine-agent
      path:                /Users/appD_user/appdy/cloudfoundry-apps/cf-machine-agent/
      buildpack:           java_buildpack_offline
      command:             JAVA_OPTS="-agentpath:$PWD/.java-buildpack/open_jdk_jre/bin/jvmkill-1.16.0_RELEASE=printHeapHistogram=1$TMPDIR -Djava.ext.dirs=$PWD/.java-buildpack/container_security_provider:$PWD/.java-buildpack/open_jdk_jre/lib/ext$PWD/.java-buildpack/java_security/ $JAVA_OPTS" && CALCULATED_MEMORY=$($PWD/.java-buildpack/open_jdk_jre/bin/java-buildpack-memory-calculator-3.13.0_RELEASE -totMemory=$MEMORY_LIMIT -loadedClasses=30244 -poolType=metaspace -stackThreads=250 -vmOptions="$JAVA_OPTS") && echo JVM Memory Configuration: $CALCULATED_MEMORY && JAVA_OPTS="$JAVA_OPTS $CALCULATED_MEMORY" && MALLOC_ARENA_MAX=2 JAVA_OPTS=$JAVA_OPTS JAVA_HOME=$PWD/.java-buildpack/open_jdk_jre exec $PWD/bin/machine-agent
      disk quota:          1G
      health check type:   process
      instances:           1
      memory:              1G
      stack:               cflinuxfs2
    Updating app appdynamics-machine-agent...

    In a few seconds, the Machine Agent starts in a container in the PCF Elastic Runtime as an application named appdynamics-machine-agent.

  7. Check whether the application is running.

    (master)$ cf apps
    Getting apps in org appdynamics-org / space appdynamics-space as admin...
    appdynamics-machine-agent   started           1/1         1G       1G
  • No labels