

VarnishSpy: Monitor Varnish STDOUT for All URLs
source link: https://www.tuicool.com/articles/hit/QVrIVn6
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

VarnishSpy
Overview
This is a simple client/server that will monitor the varnishncsa stdout for all the urls that are coming into varnish and connected clients will get a listing of the top 50 urls being hit since they loaded the page.
The server uses node.js with socket.io and the client uses socket.io with a small bit of jquery mixed in.
Server Installation
Install node.js on the server. You can visit their website at
Or you can use my quick install
git clone git://github.com/ry/node.git cd node ./configure make sudo make install
Then you can install VarnishSpy. This must be running on the same host that varnish is running on and the user running the server has to be able to run the varnishncsa command
git clone git://github.com/mzupan/varnishspy.git cd varnishspy/server node server.js
If you want the server to ignore certain extentions edit the server.js and add/remove items from
var ignore = new Array()
Right now its set to ignore certain images/css/js and some font files.
The server is up and running!
Client Installation
If you place the client on a new host it is
git clone git://github.com/mzupan/varnishspy.git cp -rf varnishspy/client/* /path/to/htdocs/root
Then you want to edit /path/to/htdocs/root/index.html and set the serverhost javascript var to be the ip that the server is running on.
Then hit the url you setup and you should see connections on your server and data coming into the website
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK