<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export><version>5.0</version><date>2021-11-21T21:57:40Z</date><groups><group><name>Templates/Applications</name></group></groups><templates><template><template>App Varnish by Zabbix agent</template><name>App Varnish by Zabbix agent</name><description>## Description

Simple template for the Varnish cache using results from the varnishstat command. Ensure that &quot;EnableRemoteCommands=1&quot; is set in the host's agent config file.

## Overview

Simple template for the Varnish cache using results from the varnishstat command. Ensure that &quot;EnableRemoteCommands=1&quot; is set in the host's agent config file.



## Author

Dave Humphrey (dave@uesp.net)

</description><groups><group><name>Templates/Applications</name></group></groups><applications><application><name>Varnish</name></application><application><name>Zabbix raw items</name></application></applications><items><item><name>Varnish: Service response time</name><key>net.tcp.service.perf[http,&quot;{$VARNISH.STATUS.HOST}&quot;,&quot;{$VARNISH.STATUS.PORT}&quot;]</key><history>7d</history><value_type>FLOAT</value_type><units>s</units><applications><application><name>Varnish</name></application></applications><triggers><trigger><expression>{min(5m)}={$VARNISH.RESPONSE_TIME.MAX.WARN}</expression><name>Varnish: Service response time is too high (over {$VARNISH.RESPONSE_TIME.MAX.WARN}s for 5m)</name><priority>WARNING</priority><manual_close>YES</manual_close><dependencies><dependency><name>Varnish: Process is not running</name><expression>{App Varnish by Zabbix agent:proc.num[&quot;{$VARNISH.PROCESS_NAME}&quot;].last()}=0</expression></dependency><dependency><name>Varnish: Service is down</name><expression>{App Varnish by Zabbix agent:net.tcp.service[http,&quot;{$VARNISH.STATUS.HOST}&quot;,&quot;{$VARNISH.STATUS.PORT}&quot;].last()}=0</expression></dependency></dependencies></trigger></triggers></item><item><name>Varnish: Service ping</name><key>net.tcp.service[http,&quot;{$VARNISH.STATUS.HOST}&quot;,&quot;{$VARNISH.STATUS.PORT}&quot;]</key><history>7d</history><applications><application><name>Varnish</name></application></applications><triggers><trigger><expression>{last()}=0</expression><name>Varnish: Service is down</name><priority>AVERAGE</priority><manual_close>YES</manual_close><dependencies><dependency><name>Varnish: Process is not running</name><expression>{App Varnish by Zabbix agent:proc.num[&quot;{$VARNISH.PROCESS_NAME}&quot;].last()}=0</expression></dependency></dependencies></trigger></triggers></item><item><name>Varnish: CPU utilization</name><key>proc.cpu.util[&quot;{$VARNISH.PROCESS_NAME}&quot;]</key><history>7d</history><value_type>FLOAT</value_type><units>%</units><description>Process CPU utilization percentage.</description><applications><application><name>Varnish</name></application></applications></item><item><name>Varnish: Memory usage (rss)</name><key>proc.mem[&quot;{$VARNISH.PROCESS_NAME}&quot;,,,,rss]</key><history>7d</history><units>B</units><description>Resident set size memory used by process in bytes.</description><applications><application><name>Varnish</name></application></applications></item><item><name>Varnish: Memory usage (vsize)</name><key>proc.mem[&quot;{$VARNISH.PROCESS_NAME}&quot;,,,,vsize]</key><history>7d</history><units>B</units><description>Virtual memory size used by process in bytes.</description><applications><application><name>Varnish</name></application></applications></item><item><name>Varnish: Number of processes running</name><key>proc.num[&quot;{$VARNISH.PROCESS_NAME}&quot;]</key><history>7d</history><applications><application><name>Varnish</name></application></applications><triggers><trigger><expression>{last()}=0</expression><name>Varnish: Process is not running</name><priority>HIGH</priority></trigger></triggers></item><item><name>Varnish: Get status</name><key>system.run[varnishstat -j]</key><history>1h</history><trends>0</trends><value_type>TEXT</value_type><applications><application><name>Zabbix raw items</name></application></applications><triggers><trigger><expression>{nodata(10m)}=1</expression><name>Varnish: Failed to fetch stats (or no data for 10m)</name><priority>WARNING</priority><description>Zabbix has not received data for stats for the last 10m.</description><manual_close>YES</manual_close><dependencies><dependency><name>Varnish: Process is not running</name><expression>{App Varnish by Zabbix agent:proc.num[&quot;{$VARNISH.PROCESS_NAME}&quot;].last()}=0</expression></dependency><dependency><name>Varnish: Service is down</name><expression>{App Varnish by Zabbix agent:net.tcp.service[http,&quot;{$VARNISH.STATUS.HOST}&quot;,&quot;{$VARNISH.STATUS.PORT}&quot;].last()}=0</expression></dependency></dependencies></trigger></triggers></item><item><name>Varnish: Backend connections</name><type>DEPENDENT</type><key>varnish.backend.connections</key><delay>0</delay><history>7d</history><description>Backend connections succeeded</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$[&quot;MAIN.backend_conn&quot;].value</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Backend failed</name><type>DEPENDENT</type><key>varnish.backend.failed</key><delay>0</delay><history>7d</history><description>Backend connections failed</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$[&quot;MAIN.backend_fail&quot;].value</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Backend requests</name><type>DEPENDENT</type><key>varnish.backend.requests</key><delay>0</delay><history>7d</history><description>Backend requests made</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$[&quot;MAIN.backend_req&quot;].value</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Backend unhealthy</name><type>DEPENDENT</type><key>varnish.backend.unhealthy</key><delay>0</delay><history>7d</history><description>Backend connections not attempted</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$[&quot;MAIN.backend_unhealthy&quot;].value</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Bytes per second</name><type>DEPENDENT</type><key>varnish.bytes.rate</key><delay>0</delay><history>7d</history><value_type>FLOAT</value_type><units>Bps</units><description>Calculated as change rate for 'Total bytes' stat.</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JAVASCRIPT</type><params>var values = JSON.parse(value);
var headBytes = values[&quot;MAIN.s_resp_hdrbytes&quot;].value;
var bodyBytes = values[&quot;MAIN.s_resp_bodybytes&quot;].value;
return headBytes + bodyBytes;</params></step><step><type>CHANGE_PER_SECOND</type><params/></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Cache hit-pass</name><type>DEPENDENT</type><key>varnish.cache.hitpasses</key><delay>0</delay><history>7d</history><description>Cache hits for pass</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$[&quot;MAIN.cache_hitpass&quot;].value</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Cache hits</name><type>DEPENDENT</type><key>varnish.cache.hits</key><delay>0</delay><history>7d</history><description>Cache hits</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$[&quot;MAIN.cache_hit&quot;].value</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Cache misses</name><type>DEPENDENT</type><key>varnish.cache.misses</key><delay>0</delay><history>7d</history><description>Cache misses</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$[&quot;MAIN.cache_miss&quot;].value</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Client requests</name><type>DEPENDENT</type><key>varnish.client.requests</key><delay>0</delay><history>7d</history><description>Good client requests received</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$[&quot;MAIN.client_req&quot;].value</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Cache hit rate</name><type>DEPENDENT</type><key>varnish.hitrate</key><delay>0</delay><history>7d</history><value_type>FLOAT</value_type><units>%</units><description>Average hit rate since the cache was started</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JAVASCRIPT</type><params>var values = JSON.parse(value);
var hit = values[&quot;MAIN.cache_hit&quot;].value;
var miss = values[&quot;MAIN.cache_miss&quot;].value;
var hitpass = values[&quot;MAIN.cache_hitpass&quot;].value;
return hit / (hit + miss) * 100;</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Cache hit rate 5m</name><type>CALCULATED</type><key>varnish.hitrate5m</key><history>7d</history><value_type>FLOAT</value_type><units>%</units><params>(last(&quot;varnish.cache.hits&quot;) - last(&quot;varnish.cache.hits&quot;,#2)) * 100 / ((last(&quot;varnish.cache.misses&quot;) - last(&quot;varnish.cache.misses&quot;,#2)) + (last(&quot;varnish.cache.hits&quot;) - last(&quot;varnish.cache.hits&quot;,#2)))</params><description>Average cache hit rate in the past 5m</description><applications><application><name>Varnish</name></application></applications></item><item><name>Varnish: Expired objects</name><type>DEPENDENT</type><key>varnish.objects.expired</key><delay>0</delay><history>7d</history><description>Number of expired objects</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$[&quot;MAIN.n_expired&quot;].value</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: LRU nuked objects</name><type>DEPENDENT</type><key>varnish.objects.lrunuked</key><delay>0</delay><history>7d</history><description>Number of LRU nuked objects</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$[&quot;MAIN.n_lru_nuked&quot;].value</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Num purges</name><type>DEPENDENT</type><key>varnish.objects.purges</key><delay>0</delay><history>7d</history><description>Number of purge operations executed</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$[&quot;MAIN.n_purges&quot;].value</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Total request bytes</name><type>DEPENDENT</type><key>varnish.request.bytes</key><delay>0</delay><history>7d</history><units>B</units><description>Total bytes received</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JAVASCRIPT</type><params>var values = JSON.parse(value);
var headBytes = values[&quot;MAIN.s_req_hdrbytes&quot;].value;
var bodyBytes = values[&quot;MAIN.s_req_bodybytes&quot;].value;
return headBytes + bodyBytes;</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Requests per second</name><type>DEPENDENT</type><key>varnish.requests.rate</key><delay>0</delay><history>7d</history><value_type>FLOAT</value_type><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$[&quot;MAIN.client_req&quot;].value</params></step><step><type>CHANGE_PER_SECOND</type><params/></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Total response bytes</name><type>DEPENDENT</type><key>varnish.response.bytes</key><delay>0</delay><history>7d</history><units>B</units><description>Total bytes sent</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JAVASCRIPT</type><params>var values = JSON.parse(value);
var headBytes = values[&quot;MAIN.s_resp_hdrbytes&quot;].value;
var bodyBytes = values[&quot;MAIN.s_resp_bodybytes&quot;].value;
return headBytes + bodyBytes;</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Session dropped</name><type>DEPENDENT</type><key>varnish.session.dropped</key><delay>0</delay><history>7d</history><description>Sessions dropped</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$[&quot;MAIN.sess_drop&quot;].value</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Threads created</name><type>DEPENDENT</type><key>varnish.threads.created</key><delay>0</delay><history>7d</history><description>Threads created</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$[&quot;MAIN.threads_created&quot;].value</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Threads failed</name><type>DEPENDENT</type><key>varnish.threads.failed</key><delay>0</delay><history>7d</history><description>Thread creation failure</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$[&quot;MAIN.threads_failed&quot;].value</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Threads limited</name><type>DEPENDENT</type><key>varnish.threads.limited</key><delay>0</delay><history>7d</history><description>Threads hit max</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$[&quot;MAIN.threads_limited&quot;].value</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item></item><item><name>Varnish: Uptime</name><type>DEPENDENT</type><key>varnish.uptime</key><delay>0</delay><history>7d</history><units>uptime</units><description>Service uptime in seconds</description><applications><application><name>Varnish</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$[&quot;MAIN.uptime&quot;].value</params></step></preprocessing><master_item><key>system.run[varnishstat -j]</key></master_item><triggers><trigger><expression>{last()}=10m</expression><name>Varnish: Has been restarted (uptime &lt; 10m)</name><priority>INFO</priority><description>Uptime is less than 10 minutes</description><manual_close>YES</manual_close></trigger></triggers></item></items><macros><macro><macro>{$VARNISH.PROCESS_NAME}</macro><value>varnishd</value><description>Process name of the Varnish server.</description></macro><macro><macro>{$VARNISH.RESPONSE_TIME.MAX.WARN}</macro><value>5</value><description>Max response time before a warning is given.</description></macro><macro><macro>{$VARNISH.STATUS.HOST}</macro><value>127.0.0.1</value><description>IP or hostname of the Varnish server.</description></macro><macro><macro>{$VARNISH.STATUS.PORT}</macro><value>80</value><description>Port of the Varnish server.</description></macro></macros></template></templates><graphs><graph><name>Cache hit rate</name><graph_items><graph_item><color>1A7C11</color><item><host>App Varnish by Zabbix agent</host><key>varnish.hitrate</key></item></graph_item><graph_item><sortorder>1</sortorder><color>F63100</color><item><host>App Varnish by Zabbix agent</host><key>varnish.hitrate5m</key></item></graph_item></graph_items></graph><graph><name>Request rate</name><graph_items><graph_item><color>1A7C11</color><item><host>App Varnish by Zabbix agent</host><key>varnish.requests.rate</key></item></graph_item></graph_items></graph></graphs></zabbix_export>
