Kristian Lyngstøl's Blog

The Varnish Agent

Posted on 2013-01-22

We just released the Varnish Agent 2.0.

The Varnish Agent is a HTTP REST interface to control Varnish. It also provides a proof of concept front-end in html/JavaScript. In other words: A fully functional Web UI for Varnish.

We use the agent to interface between our commercial Varnish Administration Console and Varnish. This is the first agent written in C and the first version exposing a HTTP REST interface, so while 2.0 might suggest some maturity, it might be wiser to consider it a tech preview.


I've written the agent for the last few weeks, and it's been quite fun. This is the first time I've ever written JavaScript, and it was initially just an after thought that quickly turned into something quite fun.

Some features:

  • Mostly self documenting, so it should be simple to integrate in other environments.
  • Close to 0 configuration. In fact, it currently requires 0 configuration, but might eventually require a tiny bit for authentication.
  • "Unit tests" for most functionality.
  • Upload and download VCL. Uploaded VCL is stored to disk.
  • Deploy vcl (e.g: use it). A hard link points to the most recently deployed VCL, allowing you to use that on varnish boot.
  • Show and change parameters.
  • Stop/start Varnish, show/delete panics, show status, etc
  • Varnishstat: Retrieve varnishstat data in json format
  • Varnishlog data: Retrieve varnishlog data in json format (Historic data only atm).
  • Modularised.

I've had a lot of fun hacking on this and I hope you will have some fun playing with it too!