Varnish Cache

Version 1

    This template retrieves the replication status of a Varnish Cache server installed on a Linux or Unix computer.


    Prerequisites: SSH and Perl installed on the target server. SNMP installed on the target server and permission to monitor the varnishd process.

    Credentials: Root credentials on the target server.

    This template was tested on Varnish Cache 3.0.


    Note: Before using this monitor, the correct argument should be set for all script monitors. All monitors require the following arguments:
    perl ${SCRIPT} path_to_varnishstat
    where
    path_to_varnishstat - This is full path to the varnishstat command.

    Below is an example using the Scripts Arguments field:
    perl ${SCRIPT} /usr/bin/varnishstat


    Monitored Components

    Uptime

    This counter returns the time that the server has been up. Format of time: (days)d (hours)h (minutes)m (seconds)s.

     

    Connections and Cache

    The returned values are as follows:

         Connections Accepted – This component returns the number of client connections accepted.

         Connections Dropped – This component returns the number of connection dropped.

         Requests Received – This component returns the number of client requests received.

         Cache Hit – This component returns the number of cache hits.

         Cache Hitpass – This component returns the number of cache hit passes. When varnish gets a response from the backend and finds out it cannot be cached, it will then create a cache object that records that fact, so that the next request goes directly to "pass."

         Cache Miss – This component returns the number of cache misses.

         Connections Dropped Late – This component returns the number of connection dropped late.

    Note: This component has the “Count statistic as difference” option enabled. It will return the difference between two polling intervals.

     

    Backend

    The returned values are as follows:

         Success – This component returns the number of successful backend connections.

         Not Attempted – This component returns the number of backend connections that were not attempted.

         Too Many – This component returns the number of “too many” backend connections.

         Failures – This component returns the number of failed backend connections.

         Reuses – This component returns the number of reused backend connections.

         Was Closed – This component returns the number of closed backend connections.

         Recycles – This component returns the number of recycled backend connections.

         Retry – This component returns the number of backend connections that were retried.

         Requests – This component returns the number of backend requests made.

    Note: This component has the “Count statistic as difference” option enabled. It will return the difference between two polling intervals.

     

    Fetches

    The returned values are as follows:

         Head – This component returns the number of head fetches.

         Length – This component returns the number of fetches with length.

         Chunked – This component returns the number of chunked fetches.

         EOF – This component returns the number of EOF fetches.

         Bad – This component returns the number of fetches with bad headers.

         Close – This component returns the number of “wanted to close” fetches.

         Old HTTP – This component returns the number of pre HTTP/1.1 closed fetches.

         Zero – This component returns the number of fetches with zero length.

         Failed – This component returns the number of failed fetches.

    Note: This component has the “Count statistic as difference” option enabled. It will return the difference between two polling intervals.

     

    Worker Threads and Requests

    The returned values are as follows:

         Threads – This component returns the total number of worker threads.

         Created – This component returns the number of worker threads created.

         Not Created – This component returns the number of worker threads not created. The returned value should be zero.

         Limited – This component returns the number of worker threads limited. It occurs when Varnish wanted to create a worker thread, but was not able to because of the thread_pool_max setting. The returned value should be zero.

         Queued Requests – This component returns the number of queued work requests. This is the number of requests that are on the queue, waiting for a worker thread to become available. The returned value should be zero, but some spikes are allowed.

         Dropped Requests – This component returns the number of dropped work requests. This is the number of requests Varnish has given up trying to handle due to a full queue. The returned value should be zero. If it grows, that means either Varnish has too high load, or the queue is too small. The queue is defined by thread_pool_max.

     

    General Statistic

    The returned values are as follows:

         Sessions – This component returns the total number of sessions.

         Requests – This component returns the total number of requests.

         Pipe – This component returns the total number of pipes.

         Pass – This component returns the total number of passes.

         Fetch – This component returns the total number of fetches.

         Header Bytes – This component returns the total number of header bytes.

         Body Bytes – This component returns the total number of body bytes.

    Note: This component has the “Count statistic as difference” option enabled. It will return the difference between two polling intervals.

     

    Sessions

    The returned values are as follows:

         Closed – This component returns the number of closed sessions.

         Pipeline – This component returns the number of pipelined sessions.

         Read Ahead – This component returns the number of read ahead sessions.

         Linger – This component returns the number of linger sessions.

         Herd – This component returns the number of herded sessions.

    Note: This component has the “Count statistic as difference” option enabled. It will return the difference between two polling intervals.

     

    SHM

    This monitor returns Shared Memory (SHM) statistic. The returned values are as follows:

         Records – This component returns the number of SHM records.

         Writes – This component returns the number of SHM writes.

         Flushes – This component returns the number of SHM flushes due to overflow.

         Cycles – This component returns the number of SHM cycles through buffer.

         Count – This component returns the number of SHM MTX contention.

         Note: This component has the “Count statistic as difference” option enabled. It will return the difference between two polling intervals.

     

    SMS

    This monitor returns Synthetic Memory Statistic (SMS). The returned values are as follows:

         Requests – This component returns the number of SMS allocator requests.

         Outstanding Allocations – This component returns the number of SMS outstanding allocations.

         Outstanding Bytes – This component returns the number of SMS outstanding bytes.

         Allocated Bytes – This component returns the number of SMS bytes allocated.

         Bytes Freed – This component returns the number of SMS bytes freed.

    Note: This component has the “Count statistic as difference” option enabled. It will return the difference between two polling intervals.

     

    VCL

    This monitor returns Varnish Configuration Language (VCL) statistic. The returned values are as follows:

         Total – This component returns the total number of VCL objects.

         Available – This component returns the number of available VCL objects.

         Discarded – This component returns the number of discarded VCL objects.

     

    Bans

    The returned values are as follows:

         Active – This component returns the total number of active bans.

         Gone – This component returns the total number of gone bans.

         Added – This component returns the number of new bans added.

         Deleted – This component returns the number of old bans deleted.

         Tested Objects – This component returns the number of tested objects.

         Tested Regexes – This component returns the number of bans tested against regexes.

         Duplicates Removed – This component returns the number of removed duplicate bans.

     

    HCB

    This monitor returns critical bit tree based hash (HCB) statistic. The returned values are as follows:

         Lookups Without Lock – This component returns the number of HCB Lookups without lock.

         Lookups With Lock – This component returns the number of HCB Lookups with lock.

         Inserts – This component returns the number of HCB Inserts.

    Note: This component has the “Count statistic as difference” option enabled. It will return the difference between two polling intervals.

     

    ESI

    This monitor returns Edge Side Includes (ESI) parse statistic. The returned values are as follows:

         Parse Errors – This component returns the number of ESI parse errors.

         Parse Warnings – This component returns the number of ESI parse warnings.

    Note: This component has the “Count statistic as difference” option enabled. It will return the difference between two polling intervals.

     

    LRU

    This monitor returns Least Recently Used (LRU) list statistic. The returned values are as follows:

         Nuked – This component returns the number of LRU nuked objects.

         Moved  – This component returns the number of LRU moved objects.

    Note: This component has the “Count statistic as difference” option enabled. It will return the difference between two polling intervals.

     

    Objects

    The returned values are as follows:

         Sent by Sendfile – This component returns the number of objects sent with Sendfile.

         Sent by Write – This component returns the number of objects sent with write.

         Overflowing – This component returns the number of overflowing workspace objects.

    Note: This component has the “Count statistic as difference” option enabled. It will return the difference between two polling intervals.

     

    Process: varnishd

    This monitor returns CPU and memory usage of varnishd.

     

    TCP Port: Varnish Cache

    This component monitor tests the ability of Varnish Cache to accept incoming sessions. It monitors TCP Port 8080

     

    Portions of this template are based on the following articles. Copyright 2014:
    https://www.varnish-cache.org/trac/wiki/StatsExplained
    https://collectd.org/wiki/index.php/Plugin:Varnish- output of “
    varnishstat –l” command.

    Last updated 11/19/2014