Search
Varnish Enterprise

Introduction Installation Upgrading Troubleshooting Changelog Changelog for 6.0.x Changes (Varnish Cache 4.1) Changes (Varnish Cache Plus 4.1) Known Issues Features Backend SSL/TLS Client SSL/TLS termination Cluster In-Process TLS MSE 4 Basic Configuration / Getting Started Configuration Persisted caching Categories Configuration Reference MSE 3.0 Settings mkfs.mse Memory Governor MSE 2.0 NUMA Parallel ESI Backend health counter HTTP/2 Support JSON Logging TCP Only Probes Timeouts Transit Buffer Varnish scoreboard VMODs Accept Accounting ACL (aclplus) ActiveDNS Akamai Connector AWS VCL Body Access & Transformation (xbody) Brotli Cookie Plus (cookieplus) DeviceAtlas DeviceAtlas3 Digest Dynamic backends (goto) Edgestash File Format Geolocation (geoip/mmdb) Header Manipulation (headerplus) HTTP communication (http) Image JSON parsing (json) JWT Key value storage (kvstore) Least connections director (leastconn) Module to control the built-in HTTP2 transport (h2) MSE control (mse) MSE4 control (mse4) Probe Proxy ProxyV2 TLV Attribute Extraction (proxy) Pseudo Random Number Generator Purge (purge/softpurge) Real-time Status (rtstatus) Reverse DNS (resolver) Rewrite S3 VMOD Session Slicer SQLite3 Stale Standard (std) Stat (Prometheus) Strings (str) Synthetic backends (synthbackend) Tag-based invalidation (Ykey/Xkey) TCP configuration (tcp) TLS Total Encryption (crypto) Unified director object (udo) Uniform Resource Identifier (uri) Unix Socket Utilities (unix) URL Plus (urlplus) Utils Vsthrottle

Real-time Status (rtstatus)

Description

The rtstatus vmod allows you to query your Varnish server for a JSON object containing counters.

Visiting the URL /rtstatus.json on the Varnish server will produce an application/json response of the following format:

{
  "uptime" : "0+16:12:58",
  "uptime_sec": 58378.00,
  "hitrate": 30.93,
  "load": 2.73,
  "varnish_version" : "[...]",
  "server_id": "[...]",
  "be_info":
  [
    { "server_name": "[...]", "happy": [...], "bereq_tot": [...], [...] },
    [...]
  ]
  "[counter]": {"type": "[...]", "ident": "[...]", "descr": "[...]", "value": [...] },
  [...]
}

It comes with a user interface in the form of a static web page that renders the JSON file at the URL /rtstatus.html.

Numbers

Varnish version Varnish version installed on your server.

Varnish uptime Child uptime.

Hit ratio Absolute hitrate ratio. It is evaluated as: (n_hit) / (n_hit + n_miss). Note that uptime is not taken into consideration for this counter.

Avg hitrate Average hitrate since uptime. It is evaluated as: ((n_hit) / (n_hit + n_miss)) / uptime.

Avg load Average load since uptime. It is evaluated as: n_requests / uptime.

The list of counters is described in the varnish-counters(7) manual, and for convenience backend counters are grouped by backend in the be_info field.

Usage

In your VCL you can use this vmod along the following lines:

vcl 4.0;

import rtstatus;

sub vcl_recv {
  if (req.url == "/rtstatus.json" || req.url == "/rtstatus.html") {
    return (synth(200));
  }
}

sub vcl_synth {
  if (req.url == "/rtstatus.json") {
    rtstatus.synthetic_json();
    return (deliver);
  }
  if (req.url == "/rtstatus.html") {
    rtstatus.synthetic_html();
    return (deliver);
  }
}

API

synthetic_json

VOID synthetic_json()

Returns a JSON object with relevant Varnish counters. Takes care of setting the content type.

Arguments: None

Type: Function

Returns: None

Restricted to: vcl_synth, vcl_backend_error

synthetic_html

VOID synthetic_html()

Renders in a UI the JSON file obtained from the synthetic_json function. Takes care of setting the content type.

Arguments: None

Type: Function

Returns: None

Restricted to: vcl_synth, vcl_backend_error

Availability

The rtstatus VMOD is available in Varnish Enterprise version 6.0.0r0 and later.


®Varnish Software, Wallingatan 12, 111 60 Stockholm, Organization nr. 556805-6203