Varnish
Auto-Detection
Exporter Metrics
Auto-Detection
Section titled “Auto-Detection”Glouton automatically detects Varnish when it is running on the monitored host.
Exporter Metrics
Section titled “Exporter Metrics”Detailed Varnish metrics are available through the third-party jonnenauha/prometheus_varnish_exporter.
Prerequisites
Section titled “Prerequisites”- Varnish Cache installed and running
- Glouton agent installed on the same host
- The
varnishstatcommand available on the system (included with Varnish) - Go toolchain (if building from source) or access to GitHub releases
Installing the Exporter
Section titled “Installing the Exporter”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:
varnishstat -1Download the latest release from the prometheus_varnish_exporter releases page, or install with Go:
go install github.com/jonnenauha/prometheus_varnish_exporter@latestStart the exporter:
prometheus_varnish_exporterThe exporter listens on port 9131 by default. Verify it is working:
curl http://localhost:9131/metricsFor production use, create a systemd service unit to manage the exporter process.
Glouton Configuration
Section titled “Glouton Configuration”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"EOFCreate or edit C:\ProgramData\glouton\conf.d\99-varnish.conf:
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"| Metric | Description |
|---|---|
varnish_main_client_req | Total number of client requests received |
varnish_main_cache_hit | Total number of cache hits |
varnish_main_cache_miss | Total number of cache misses |
varnish_main_backend_conn | Total number of backend connections made |
varnish_main_threads | Number of threads in all pools |
varnish_main_sess_conn | Total number of sessions accepted |