AppDynamics Monitoring Extension for use with Varnish

Varnish Monitoring Extension


This extension works only with the standalone machine agent.


Use Case


Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any server that speaks HTTP and configure it to cache the contents. The varnish-monitoring-extension gathers cache metrics exposed through Varnish's REST API and sends them to the AppDynamics Metric Browser.



Before the extension is installed, the prerequisites mentioned here need to be met. Please do not proceed with the extension installation if the specified prerequisites are not met.

This extension requires vagent2 to be installed. Please follow the steps in to install vagent2. You can also install vagent2 from the attached binary file.




   1. Download and Unzip the VarnishMonitor zip file into the <machineagent install dir>/monitors/ directory.

  2. Edit the file config.yml located at <MachineAgent_Dir>/monitors/ The metricPrefix of the extension has to be configured as specified here. Please make sure that the right metricPrefix is chosen based on your machine agent deployment, otherwise this could lead to metrics not being visible in the controller.

   3. Configure vagent2 details in <machineagent install dir>/monitors/VarnishMonitor/config.yml.

  4. Open <machineagent install dir>/monitors/VarnishMonitor/EnabledMetrics.xml and configure the list of enabled metrics.

   5. Restart the machine agent.

   6. In the AppDynamics Metric Browser, look for: Application Infrastructure Performance | <Tier> | Custom Metrics | Varnish




Note : Please make sure to not use tab (\t) while editing yaml files. You may want to validate the yaml file using a yaml validator

   1. Configure the Varnish Vagent2 details by editing the config.yml file in/monitors/VarnishMonitor/.

   2. Below is the default config.yml

   - name: "LocalVarnish"
     host: "localhost"
     port: 6085
     scheme: "http"
     username: "admin"
     # Provide either password or passwordEncrypted and encryptionKey
     password: "admin"
     passwordEncrypted: ""
     encryptionKey: ""
     enabledMetricsPath: "monitors/VarnishMonitor/EnabledMetrics.xml"
   - name: "RemoteVarnish"
     host: "localhost"
     port: 6085
     scheme: "http"
     username: "admin"
     password: "admin"
     passwordEncrypted: ""
     encryptionKey: ""
     enabledMetricsPath: "monitors/VarnishMonitor/EnabledMetrics.xml"

# Number of concurrent threads for
# dealing with multiple Varnish instances
# Note: You don't necessarily have to match the no of threads
# to the no of Varnish instances configured above
# unless you have a lot of CPUs in your machine
numberOfVarnishThreads: 2

#This will create this metric in all the tiers, under this path
metricPrefix: "Custom Metrics|Varnish|"

#This will create it in specific Tier/Component. Make sure to replace  with the appropriate one from your environment.
#To find the  in your environment, please follow the screenshot
#metricPrefix: Server|Component:|Custom Metrics|Varnish 

   3. Default EnabledMetrics.xml

<!-- Only metrics present here will be shown in the Controller. Remaining metrics will be ignored -->
    <Metric name="timestamp"/>
    <Metric name="MAIN.uptime" displayName="Uptime"/>
    <Metric name="MAIN.pools" collectDelta="true" displayName="No Of Pools"/>
    <Metric name="MAIN.threads" collectDelta="true"/>
    <Metric name="MAIN.threads_created" collectDelta="true"/>
    <Metric name="MAIN.n_backend"/>
    <Metric name="MAIN.shm_records"/>
    <Metric name="MAIN.shm_writes"/>
    <Metric name="MAIN.n_vcl"/>
    <Metric name="MAIN.n_vcl_avail"/>
    <Metric name="MAIN.bans"/>
    <Metric name="MAIN.bans_completed"/>
    <Metric name="MAIN.bans_added"/>
    <Metric name="MAIN.bans_persisted_bytes"/>
    <Metric name="MAIN.vsm_free"/>
    <Metric name="MAIN.vsm_used"/>
    <Metric name="MGT.uptime"/>
    <Metric name="MGT.child_start"/>
    <Metric name="MEMPOOL.busyobj.pool"/>
    <Metric name="MEMPOOL.busyobj.sz_wanted"/>
    <Metric name="MEMPOOL.busyobj.sz_actual"/>
    <Metric name="MEMPOOL.req0.pool"/>
    <Metric name="MEMPOOL.req0.sz_wanted"/>
    <Metric name="MEMPOOL.req0.sz_actual"/>



Password Encryption Support

To avoid setting the clear text password in the config.yaml, please follow the process below to encrypt the password

   1. Download the util jar to encrypt the password from and navigate to the downloaded directory

   2. Encrypt password from the commandline java -cp appd-exts-commons-1.1.2.jar com.appdynamics.extensions.crypto.Encryptor encryptionKey myPassword

   3. Specify the passwordEncrypted and encryptionKey in config.yaml




NOTE: Only metrics configured in the EnabledMetrics.xml file will be collected. Please add the metrics you want to collect to this file.

Here are some of the varnish metrics available through vagent2.


Metric NameDescription
client_connClient connections accepted
client_dropConnection dropped, no sess/wrk
client_reqClient requests received
cache_hitCache hits
cache_hitpassCache hits for pass
cache_missCache misses
backend_connBackend conn. success
backend_unhealthyBackend conn. not attempted
backend_busyBackend conn. too many
backend_failBackend conn. failures
backend_reuseBackend conn. reuses
backend_toolateBackend connection was closed
backend_recycleBackend connnection recycles
backend_retryBackend connection retry
n_wrkN worker threads
n_wrk_createN worker threads created
n_wrk_failedN worker threads not created
n_wrk_maxN worker threads limited
n_wrk_lqueuework request queue length
n_wrk_queuedN queued work requests
n_wrk_dropN dropped work requests
n_backendN backends
n_expiredN expired objects
s_sessTotal Sessions
s_reqTotal Requests
uptimeClient uptime
dir_dns_lookupsDNS director lookups
dir_dns_failedDNS director failed lookups
dir_dns_hitDNS director cached lookups hit
dir_dns_cache_fullDNS director full dnscache



    Please look at the troubleshooting document and make sure that everything is followed correctly.

Support Tickets

If after going through the Troubleshooting Document you have not been able to get your extension working, please file a ticket and add the following information.

Please provide the following in order for us to assist you better.

1. Stop the running machine agent.
2. Delete all existing logs under <MachineAgent>/logs.
3. Please enable debug logging by editing the file <MachineAgent>/conf/logging/log4j.xml. Change the level value of the following <logger> elements to debug.
    <logger name="com.singularity">
    <logger name="com.appdynamics">
4. Start the machine agent and please let it run for 10 mins. Then zip and upload all the logs in the directory <MachineAgent>/logs/*.
5. Attach the zipped <MachineAgent>/conf/* directory here.
6. Attach the zipped <MachineAgent>/monitors/ExtensionFolderYouAreHavingIssuesWith directory here.

Custom Dashboard





Always feel free to fork and contribute any changes directly via GitHub.



For any support questions, please






Last Update:





  • 1.3.2: Re-write to latest spec. Extracted configuration out of monitor.xml and moved to config.yml
  • 1.3.3: Updated Licenses
  • 1.3.4: Using scheme from config