Varnish - Monitoring Extension

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.




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. Configure vagent2 details in <machineagent install dir>/monitors/VarnishMonitor/config.yml.

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

   4. Restart the machine agent.

   5. 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


Custom Dashboard





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



For any support questions, please






Last Update:

22 Dec 2016




  • 1.3.2: Re-write to latest spec. Extracted configuration out of monitor.xml and moved to config.yml