Varnish Administration Console

Cache (Varnish instance)

{
    "agentHost": "192.168.50.104",
    "agentPassword": "varnish",
    "agentPort": 46085,
    "agentUsername": "varnish",
    "created": "2017-08-08T16:15+0200",
    "dash_n": "cache4",
    "description": "",
    "groupId": "59d623cabf085f6187eb9d5f",
    "groupName": "alfredo",
    "id": "5989c76d436cde7136986b36",
    "name": "192.168.50.104:46085_cache4",
    "status": "",
    "timestamp": "2017-10-16T11:38+0200",
    "varnishName": "varnish",
    "varnishRevision": "d266ac5c6",
    "varnishVersion": "4.1.8",
    "version": ""
}

GET

{
    "caches": [
        {
            "agentHost": "192.168.50.104",
            "agentPassword": "varnish",
            "agentPort": 46085,
            "agentUsername": "varnish",
            "created": "2017-08-08T16:15+0200",
            "dash_n": "cache4",
            "description": "",
            "groupId": "59d623cabf085f6187eb9d5f",
            "groupName": "alfredo",
            "id": "5989c76d436cde7136986b36",
            "name": "192.168.50.104:46085_cache4",
            "status": "",
            "timestamp": "2017-10-16T11:38+0200",
            "varnishName": "varnish",
            "varnishRevision": "d266ac5c6",
            "varnishVersion": "4.1.8",
            "version": ""
        },
        {
            "agentHost": "192.168.50.103",
            "agentPassword": "varnish",
            "agentPort": 36085,
            "agentUsername": "varnish",
            "created": "2017-08-08T16:15+0200",
            "dash_n": "cache3",
            "description": "",
            "groupId": "59d623cabf085f6187eb9d5f",
            "groupName": "alfredo",
            "id": "5989c77e436cde7136986b3a",
            "name": "192.168.50.103:36085_cache3",
            "status": "",
            "timestamp": "2017-10-16T11:34+0200",
            "varnishName": "varnish",
            "varnishRevision": "d266ac5c6",
            "varnishVersion": "4.1.8",
            "version": ""
        },
        {
            "agentHost": "127.0.0.1",
            "agentPassword": "varnish",
            "agentPort": 17085,
            "agentUsername": "varnish",
            "created": "2017-08-08T16:15+0200",
            "dash_n": "c1",
            "description": "",
            "groupId": "59d623cabf085f6187eb9d5f",
            "groupName": "alfredo",
            "id": "5989c787436cde7136986b3e",
            "name": "127.0.0.1:17085_c1",
            "status": "",
            "timestamp": "2017-10-16T11:37+0200",
            "varnishName": "varnish-plus",
            "varnishRevision": "ba23f33",
            "varnishVersion": "4.1.7r3",
            "version": ""
        },
        {
            "agentHost": "192.168.50.101",
            "agentPassword": "varnish",
            "agentPort": 16085,
            "agentUsername": "varnish",
            "created": "2017-08-08T16:23+0200",
            "dash_n": "cache1",
            "description": "",
            "groupId": null,
            "groupName": "all",
            "id": "5989c94f436c77379fbb9e62",
            "name": "192.168.50.101:16085_cache1",
            "status": "",
            "timestamp": "2017-10-05T14:21+0200",
            "varnishName": "varnish",
            "varnishRevision": "07eff4c29",
            "varnishVersion": "4.0.5",
            "version": ""
        }
    ]
}


GET

Example with api/v1/cache/1/2

{page_number}=1 {items_per_page}=2

{
    "list": [
        {
            "agentHost": "192.168.50.104",
            "agentPassword": "varnish",
            "agentPort": 46085,
            "agentUsername": "varnish",
            "created": "2017-08-08T16:15+0200",
            "dash_n": "cache4",
            "description": "",
            "groupId": "59d623cabf085f6187eb9d5f",
            "groupName": "alfredo",
            "id": "5989c76d436cde7136986b36",
            "name": "192.168.50.104:46085_cache4",
            "status": "",
            "timestamp": "2017-10-16T11:38+0200",
            "varnishName": "varnish",
            "varnishRevision": "d266ac5c6",
            "varnishVersion": "4.1.8",
            "version": ""
        },
        {
            "agentHost": "127.0.0.1",
            "agentPassword": "varnish",
            "agentPort": 17085,
            "agentUsername": "varnish",
            "created": "2017-08-08T16:15+0200",
            "dash_n": "c1",
            "description": "",
            "groupId": "59d623cabf085f6187eb9d5f",
            "groupName": "alfredo",
            "id": "5989c787436cde7136986b3e",
            "name": "127.0.0.1:17085_c1",
            "status": "",
            "timestamp": "2017-10-16T11:37+0200",
            "varnishName": "varnish-plus",
            "varnishRevision": "ba23f33",
            "varnishVersion": "4.1.7r3",
            "version": ""
        }
    ]
}


GET

{
    "agentHost": "192.168.50.104",
    "agentPassword": "varnish",
    "agentPort": 46085,
    "agentUsername": "varnish",
    "created": "2017-08-08T16:15+0200",
    "dash_n": "cache4",
    "description": "",
    "groupId": "59d623cabf085f6187eb9d5f",
    "groupName": "alfredo",
    "id": "5989c76d436cde7136986b36",
    "name": "192.168.50.104:46085_cache4",
    "status": "",
    "timestamp": "2017-10-16T11:38+0200",
    "varnishName": "varnish",
    "varnishRevision": "d266ac5c6",
    "varnishVersion": "4.1.8",
    "version": ""
}


PUT

If probe is defined in your vcl, it will be used to check the health of the backend. If sick is set, the backend will be marked as sick and not used to fulfill requests and if healthy is set, the backend will be marked as healthy.

For example it can be sent via curl to cache with id 57a0a98b4a2abf4cba82954f and default backend:

   curl -X PUT -H "Content-Type: application/json"
   -u vac:vac
   http://localhost:8080/api/v1/cache/57a0a98b4a2abf4cba82954f/setbackend/default/healthy


PUT/PATCH


  • Note that PATCH is supported. This means that values are merged and unsupported fields are ignored.

  • Note that foreign key relations are ignored. Explicit API calls are put in place to support these relationships.

For example, the payload could be:

    {"name":"varnish-cache-renamed"}


DELETE

Remove a single cache entity. Note that cache sets associated with a group cannot be deleted. A 400 will be returned if attempted.

POST

	{"name":"varnish-cache-renamed"}


GET

The following samples are supported.

  • 10 min in 1 sec resolution
  • 20 min in 2 sec resolution
  • 45 min in 3 sec resolution
  • 125 min in 5 sec resolution
  • 1 hour in 1 min resolution

Note that the archive follows the Fibonacci sequence to maximise coverage.

The default {counter} set are as follows.

  • cache_hit
  • cache_miss
  • cache_hitpass
  • client_req
  • s_hdrbytes
  • s_bodybytes
  • client_conn
  • backend_fail
  • n_wrk_drop
  • client_drop
  • n_wrk_queued
  • n_lru_nuked
  • SMF.s0.c_bytes

The {consolfunc} function can take the following values:

  • average
  • min
  • max
  • last
  • first
  • total

    {
    "counter": "cache_hit",
    "values": [
        {
            "time": 1383551626,
            "value": 1213
        },
        {
            "time": 1383551627,
            "value": 1532
        }
    ]
    }


GET

The following samples are supported.

  • 10 min in 1 sec resolution
  • 20 min in 2 sec resolution
  • 45 min in 3 sec resolution
  • 125 min in 5 sec resolution
  • 1 hour in 1 min resolution

Note that the archive follows the Fibonacci sequence to maximise coverage.

The {consolfunc} function are as follows.

  • average
  • min
  • max
  • last
  • first
  • total

An example of the response is as follows:

    {
    "stats": [
        {
            "counter": "cache_hit",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1303
                },
                {
                    "time": 1383551661,
                    "value": 1248
                }
            ]
        },
        {
            "counter": "cache_miss",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1333
                },
                {
                    "time": 1383551661,
                    "value": 1220
                }
            ]
        },
        {
            "counter": "cache_hitpass",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1407
                },
                {
                    "time": 1383551661,
                    "value": 1194
                }
            ]
        },
        {
            "counter": "client_req",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1454
                },
                {
                    "time": 1383551661,
                    "value": 1195
                }
            ]
        },
        {
            "counter": "s_hdrbytes",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1521
                },
                {
                    "time": 1383551661,
                    "value": 1121
                }
            ]
        },
        {
            "counter": "s_bodybytes",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1498
                },
                {
                    "time": 1383551661,
                    "value": 1138
                }
            ]
        },
        {
            "counter": "client_conn",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1525
                },
                {
                    "time": 1383551661,
                    "value": 1104
                }
            ]
        },
        {
            "counter": "backend_fail",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1490
                },
                {
                    "time": 1383551661,
                    "value": 1168
                }
            ]
        },
        {
            "counter": "n_wrk_drop",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1458
                },
                {
                    "time": 1383551661,
                    "value": 1185
                }
            ]
        },
        {
            "counter": "client_drop",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1424
                },
                {
                    "time": 1383551661,
                    "value": 1204
                }
            ]
        },
        {
            "counter": "n_wrk_queued",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1389
                },
                {
                    "time": 1383551661,
                    "value": 1230
                }
            ]
        },
        {
            "counter": "n_lru_nuked",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1311
                },
                {
                    "time": 1383551661,
                    "value": 1302
                }
            ]
        },
        {
            "counter": "SMF.s0.c_bytes",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1276
                },
                {
                    "time": 1383551661,
                    "value": 1277
                }
            ]
        }
    ]
    }


GET

The following samples are supported.

  • 10 min in 1 sec resolution
  • 20 min in 2 sec resolution
  • 45 min in 3 sec resolution
  • 125 min in 5 sec resolution
  • 1 hour in 1 min resolution

Note that the archive follows the Fibonacci sequence to maximise coverage.

The default graph supported are as follows.

  • avghitratio
  • reqpersec
  • trafficserved
  • hitvsmiss
  • cnnvsrequest
  • badthings
  • memoryvslru

The purpose of the graph is the group counters with a name.

The consolidation function are as follows.

  • average
  • min
  • max
  • last
  • first
  • total

An example of the response for avghitratio graph is as follows:

    {
        "avghitratio": [
	        {
	            "cache_hit": 1150,
	            "cache_hitpass": 1211,
	            "cache_miss": 1204,
	            "client_req": 1264,
	            "time": 1385107726
	        },
	        {
	            "cache_hit": 1474,
	            "cache_hitpass": 1375,
	            "cache_miss": 1392,
	            "client_req": 1377,
	            "time": 1385107727
	        }
        ]
    }


GET

This is the same value as issuing the following on the command line:

    > date +%s

Query RRD for past data in the vac. The following samples are supported.

  • 10 min in 1 sec resolution
  • 20 min in 2 sec resolution
  • 45 min in 3 sec resolution
  • 125 min in 5 sec resolution
  • 1 hour in 1 min resolution

The default counter set are as follows.

  • cache_hit
  • cache_miss
  • cache_hitpass
  • client_req
  • s_hdrbytes
  • s_bodybytes
  • client_conn
  • backend_fail
  • n_wrk_drop
  • client_drop
  • n_wrk_queued
  • n_lru_nuked
  • SMF.s0.c_bytes

The consolidation function are as follows.

  • average
  • min
  • max
  • last
  • first
  • total

An example of the response is as follows:

    {
    "counter": "cache_hit",
    "values":
	[
	        {
	            "time": 1383551626,
	            "value": 1213
	        },
	        {
	            "time": 1383551627,
	            "value": 1532
	        }
	    ]
    }


GET

This is the same value as issuing the following on the command line:

    > date +%s

Query RRD for past data in the vac. The following samples are supported.

  • 10 min in 1 sec resolution
  • 20 min in 2 sec resolution
  • 45 min in 3 sec resolution
  • 125 min in 5 sec resolution
  • 1 hour in 1 min resolution

The consolidation function are as follows.

  • average
  • min
  • max
  • last
  • first
  • total

    {
    "stats": [
        {
            "counter": "cache_hit",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1303
                },
                {
                    "time": 1383551661,
                    "value": 1248
                }
            ]
        },
        {
            "counter": "cache_miss",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1333
                },
                {
                    "time": 1383551661,
                    "value": 1220
                }
            ]
        },
        {
            "counter": "cache_hitpass",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1407
                },
                {
                    "time": 1383551661,
                    "value": 1194
                }
            ]
        },
        {
            "counter": "client_req",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1454
                },
                {
                    "time": 1383551661,
                    "value": 1195
                }
            ]
        },
        {
            "counter": "s_hdrbytes",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1521
                },
                {
                    "time": 1383551661,
                    "value": 1121
                }
            ]
        },
        {
            "counter": "s_bodybytes",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1498
                },
                {
                    "time": 1383551661,
                    "value": 1138
                }
            ]
        },
        {
            "counter": "client_conn",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1525
                },
                {
                    "time": 1383551661,
                    "value": 1104
                }
            ]
        },
        {
            "counter": "backend_fail",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1490
                },
                {
                    "time": 1383551661,
                    "value": 1168
                }
            ]
        },
        {
            "counter": "n_wrk_drop",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1458
                },
                {
                    "time": 1383551661,
                    "value": 1185
                }
            ]
        },
        {
            "counter": "client_drop",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1424
                },
                {
                    "time": 1383551661,
                    "value": 1204
                }
            ]
        },
        {
            "counter": "n_wrk_queued",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1389
                },
                {
                    "time": 1383551661,
                    "value": 1230
                }
            ]
        },
        {
            "counter": "n_lru_nuked",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1311
                },
                {
                    "time": 1383551661,
                    "value": 1302
                }
            ]
        },
        {
            "counter": "SMF.s0.c_bytes",
            "values": [
                {
                    "time": 1383551660,
                    "value": 1276
                },
                {
                    "time": 1383551661,
                    "value": 1277
                }
            ]
        }
    ]
    }


GET

This is the same value as issuing the following on the command line:

    > date +%s

Query RRD for past data in the vac. The following samples are supported.

  • 10 min in 1 sec resolution
  • 20 min in 2 sec resolution
  • 45 min in 3 sec resolution
  • 125 min in 5 sec resolution
  • 1 hour in 1 min resolution

The default graph supported are as follows.

  • avghitratio
  • reqpersec
  • trafficserved
  • hitvsmiss
  • cnnvsrequest
  • badthings
  • memoryvslru

The purpose of the graph is the group counters with a name.

The consolidation function are as follows.

  • average
  • min
  • max
  • last
  • first
  • total

An example of the response for avghitratio graph is as follows:

    {
        "avghitratio": [
        {
            "cache_hit": 1150,
            "cache_hitpass": 1211,
            "cache_miss": 1204,
            "client_req": 1264,
            "time": 1385107726
        },
        {
            "cache_hit": 1474,
            "cache_hitpass": 1375,
            "cache_miss": 1392,
            "client_req": 1377,
            "time": 1385107727
        }
        ]
    }


GET

    {
    "param_changeset": {},
    "param_consistent": true,
    "responseStatus": 200,
    "responseString": "",
    "vcl_consistent": true,
    "vcl_name": ""
    }


GET

    {
    "panic": "Child has not panicked or panic has been cleared",
    "paramChangeset": {
        "group": {
            "default": "",
            "description": "The unprivileged group to run as...",
            "unit": "",
            "value": "nobody (-2)"
        },
        "listen_address": {
            "default": ":80",
            "description": "Whitespace separated list of...",
            "unit": "",
            "value": "localhost:6080"
        },
        "user": {
            "default": "",
            "description": "The unprivileged user to run as...",
            "unit": "",
            "value": "nobody (-2)"
        },
        "waiter": {
            "default": "default",
            "description": "Select the waiter kernel interface...",
            "unit": "",
            "value": "default (kqueue, poll)"
        }
    },
    "ping": "PONG 1369746345 1.0",
    "responseStatus": 200,
    "responseString": "",
    "status": "Child in state running",
    "vclList": {
        "vcls": [
            {
                "name": "boot",
                "refs": "0",
                "status": "active"
            }
        ]
    }
    }


GET

The response below is reduced for clarity

    {
    "acceptor_sleep_decay": {
        "default": "0.900",
        "description": "If we run out of resources, such as...",
        "unit": "",
        "value": "0.666000"
    },
    "acceptor_sleep_incr": {
        "default": "0.001",
        "description": "If we run out of resources, such as ...",
        "unit": "s",
        "value": "0.001000"
    },
    ...
    }


GET

    {
	    "group": {
	        "default": "",
	        "description": "The unprivileged group to run as...",
	        "unit": "",
	        "value": "nobody (-2)"
	    },
	    "listen_address": {
	        "default": ":80",
	        "description": "Whitespace separated list of network endpoints...",
	        "unit": "",
	        "value": "localhost:6080"
	    },
	    "user": {
	        "default": "",
	        "description": "\nThe unprivileged user to run as...",
	        "unit": "",
	        "value": "nobody (-2)"
	    }
    }


POST

For example, a vcl.list command can be sent via curl to cache with id 52769fe7b2da640380243e4c:

    curl -X POST -H "Content-Type: text/plain"
    -u vac:vac
    http://localhost:8080/api/v1/cache/52769fe7b2da640380243e4c/varnishadm
    -d "vcl.list" -v

    {
        "message": "\nactive        0 boot\n"
    }

Note that the formatting is “as-is” from varnishadm.


POST

For example, a vcl.list command can issued to the cache with id 52769fe7b2da640380243e4c using:

    {
        "command": "vcl.list"
    }

    {
        "message": "\nactive        0 boot\n"
    }

Note that the formatting is “as-is” from varnishadm.


PUT

  • Request body no required