zabbix / community-templates

Zabbix Community Templates repository

Home Page:https://share.zabbix.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Varnish template improvements & v7 changes

linceaerian opened this issue · comments

Hello Maintainer(s),

I would suggest adding in the doc of the varnish template:

Varnish group / access

Please note that in order for the template to work, access must be given to your zabbix user to access varnishd.

Ex:

adduser zabbix varnish

Userparameter in place of system.run

In case people does not want to activate system.run, which can lead to vuln

If you prefer use UserParameter, you can:

  • Add a user parameter defined as: UserParameter=varnish.stat,varnishstat -j in you Zabbix configuration
  • Change the item "Varnish: Get status" to "varnish.stat"

Varnish JSON changes

Also I found that the JSON for some version of varnish is different, so maybe use a macro for the "get status" post processing to use in case the data use the new version.

Ex of data for varnish > 7.0

{"version":1,"timestamp":"2024-03-26T17:06:01","counters":{"MGT.uptime":{"description":"Management process uptime","flag":"c","format":"d","value":263150}}

I updated mine by adding "$.counters" in the post processing for get status.

Cache hit rate

The cache hit rate item should be updated to avoid division by 0 when no traffic, either in updating the JS (clean) or a catch in the post processing for failure (less clean).

Ex:

var values = JSON.parse(value);
var hit = values["MAIN.cache_hit"].value;
var miss = values["MAIN.cache_miss"].value;
var hitpass = values["MAIN.cache_hitpass"].value;
if (hit==0)
  return 100;
return hit / (hit + miss) * 100;

Same problem for "Cache hit rate 5m" => divide by zero.

Main sesssion drop

The stat MAIN.sess_drop has been renamed MAIN.sess_dropped.

Thanks for the template, have a good day :)