How to get your AppDynamics Metrics into Load Impact Test Results

How to get your AppDynamics metrics into Load Impact test results

This example shows how to get a single CPU metric into Load Impact test results using the Load Impact Server Metrics Agent.

Assumption: You have your AppDynamics agents set up, configured and running.

1. Get your Load Impact Server Monitoring Agent and install it on your server.

See this Knowledge Base Article if this is not already set up

2. Go into your AppDynamics panel and find the REST API URL for the particular metric you want to collect.

Example here:

For our example collecting our CPU metric it’s

3. Assuming you have installed your Load Impact Server Metrics Agent on a windows box, create a powershell script containing this (named appdynamics_cpu.ps1):

$user = "myppadynamicsuser@myappdynamicsaccount"

$password = "<myappdynamicspassword>"

$uri =

$auth = 'Basic ' + [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($user+":"+$password ))

$req = New-Object System.Net.WebClient

$req.Headers.Add('Authorization', $auth)

[xml]$resp = $req.DownloadString($uri)

$cpu =  $resp."metric-datas"."metric-data".metricValues."metric-value".value

"AppDynamics CPU | 'AppDynCPU'=$cpu"

4. And to be able to run the powershell script we are somewhat lazy (and skip setting up proper authorization and authentication on our windows box, do not do this in your production environment and create a cmd file containing this (named appdynamics.cmd):


powershell -noprofile -ExecutionPolicy Bypass -f "c:\Server Metrics Agent\appdynamics_cpu.ps1"


5. Now to the interesting part, how to get that into Load Impact!

Open the li_metrics_agent.conf file located in your server metrics agent install folder. On a windows box that typically is c:\server metrics agent\.

Find the section that starts with

# An external script


# The script needs to output data in the Nagios performance data format, see:


This section is where you add any and all extra metrics to collect during the test run.

Add this

# CPU usage from AppDynamics


command = "c:/Server Metrics Agent/appdynamics.cmd"

save, and recycle your server metrics agent service (it’s aptly named Load Impact Server Metrics Agent Service) to pick up the configuration changes.

6. The next time you run your test and include the server metrics agent in the test config (see #1 for usage) you will get the AppDynamics metric included so you can plot like this:

And for those of you not deploying the Load Impact Server Metrics Agent on windows but rather on a *nix this shell script (named in this example) will output the same thing as the cmdfile/powershell combo on windows (it uses curl to call the REST API, get here if you don’t have it


echo "AppDynamics CPU|'AppDynCpu='"$(curl -s -G -u myappdynamicsuser@myappdynamicsaccount:myappdynamicspassword "" | grep -oPm1 "(?<=<value>)[^<]+")

And just for clarity you would add this line to your li_metrics_agent.conf

# CPU usage from AppDynamics


command = ""

Now that you know how to do it, go find your analytics metrics in AppDynamics, include them in your test runs and enjoy correlating analytics and results at the speed of test!

Feedback and Knowledge Base