Skip to content
BleemeoBleemeo

Varnish

Auto-Detection
Exporter Metrics

Glouton automatically detects Varnish when it is running on the monitored host.

Detailed Varnish metrics are available through the third-party jonnenauha/prometheus_varnish_exporter.

  • Varnish Cache installed and running
  • Glouton agent installed on the same host
  • The varnishstat command available on the system (included with Varnish)
  • Go toolchain (if building from source) or access to GitHub releases

No special configuration is required on the Varnish side. The exporter reads metrics directly from varnishstat, which accesses Varnish’s shared memory log.

Verify that varnishstat is working:

Terminal window
varnishstat -1

Download the latest release from the prometheus_varnish_exporter releases page, or install with Go:

Terminal window
go install github.com/jonnenauha/prometheus_varnish_exporter@latest

Start the exporter:

Terminal window
prometheus_varnish_exporter

The exporter listens on port 9131 by default. Verify it is working:

Terminal window
curl http://localhost:9131/metrics

For production use, create a systemd service unit to manage the exporter process.

Terminal window
sudo tee /etc/glouton/conf.d/99-varnish.conf > /dev/null << 'EOF'
metric:
prometheus:
targets:
- url: "http://localhost:9131/metrics"
name: "varnish"
allow_metrics:
- "varnish_main_client_req"
- "varnish_main_cache_hit"
- "varnish_main_cache_miss"
- "varnish_main_backend_conn"
- "varnish_main_threads"
- "varnish_main_sess_conn"
EOF
MetricDescription
varnish_main_client_reqTotal number of client requests received
varnish_main_cache_hitTotal number of cache hits
varnish_main_cache_missTotal number of cache misses
varnish_main_backend_connTotal number of backend connections made
varnish_main_threadsNumber of threads in all pools
varnish_main_sess_connTotal number of sessions accepted