安装varnish-dashboard
varnish-dashboard的项目地址:https://github.com/brandonwamboldt/varnish-dashboard
需要安装vagent2 vagent2项目地址:https://github.com/varnish/vagent2
首先安装vagent2,安装的系统上需要安装过varnish
下载地址https://github.com/varnish/vagent2/archive/4.0.1.tar.gz
安装依赖
yum -y install automake autoconf libcurl libcurl-devel python-docutils libmicrohttpd-devel
解压
[[email protected] ~]# tar xvf vagent2-4.0.1.tar vagent2-4.0.1/ vagent2-4.0.1/.gitignore vagent2-4.0.1/.travis.yml vagent2-4.0.1/INSTALL.rst vagent2-4.0.1/LICENSE vagent2-4.0.1/Makefile.am vagent2-4.0.1/NEWS.rst vagent2-4.0.1/README.rst vagent2-4.0.1/THANKS vagent2-4.0.1/Vagrantfile [[email protected] ~]# cd vagent2-4.0.1 [[email protected] vagent2-4.0.1]# ./autogen.sh + aclocal -I /usr/share/aclocal + autoheader + automake --add-missing --copy --foreign configure.ac:47: installing './compile' configure.ac:10: installing './install-sh' configure.ac:10: installing './missing' src/Makefile.am: installing './depcomp' parallel-tests: installing './test-driver' + autoconf [[email protected] vagent2-4.0.1]# ./configure #报错 ...... checking pkg-config is at least version 0.9.0... yes checking for VARNISHAPI... no configure: error: Package requirements (varnishapi >= 4.0.0) were not met: No package 'varnishapi' found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables VARNISHAPI_CFLAGS and VARNISHAPI_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. [[email protected] vagent2-4.0.1]# cp /usr/local/varnish/lib/pkgconfig/varnishapi.pc /usr/lib64/pkgconfig/ [[email protected] vagent2-4.0.1]# ./configure ...... config.status: creating include/Makefile config.status: creating src/Makefile config.status: creating tests/Makefile config.status: creating config.h config.status: executing depfiles commands [[email protected] vagent2-4.0.1]# make ... make[2]: Leaving directory `/root/vagent2-4.0.1/src' Making all in tests make[2]: Entering directory `/root/vagent2-4.0.1/tests' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/root/vagent2-4.0.1/tests' make[2]: Entering directory `/root/vagent2-4.0.1' rst2man README.rst varnish-agent.1 README.rst:: (WARNING/2) "p_w_picpath" not supported make[2]: Leaving directory `/root/vagent2-4.0.1' make[1]: Leaving directory `/root/vagent2-4.0.1' [[email protected] vagent2-4.0.1]# make install ...... /agent.js '/usr/local/share/varnish-agent/html/js' make[2]: Leaving directory `/root/vagent2-4.0.1' make[1]: Leaving directory `/root/vagent2-4.0.1' 运行的时候可能报错 [[email protected] ~]# varnish-agent varnish-agent: error while loading shared libraries: libvarnishapi.so.1: cannot open shared object file: No such file or directory 做个软链就行了 [[email protected] ~]# ln -s /usr/local/varnish/lib/libvarnishapi.so.1.0.0 /usr/lib64/libvarnishapi.so.1
安装成功
创建用户名密码
[[email protected] ~]# mkdir /etc/varnish/ [[email protected] ~]# echo "test:test123" > /etc/varnish/agent_secret
下载varnish-dashboard
mkdir -p /var/www/html cd /var/www/html git clone git://github.com/brandonwamboldt/varnish-dashboard.git
将config.example.js
复制 config.js
修改config.js
var config = { servers: [{ name: "Varnish", host: null, port: 6085, user: "varnish_agent_user", pass: "varnish_agent_pass" }],
运行
varnish-agent -H /var/www/html/varnish-dashboard
浏览器访问
http://<varnish_ip>:6085/html/
目前无法监控多台varnish
大家可以研究一下使用nginx or apache来运行varnish-dashboard
下面有段原话:
You can download this dashboard using one of the release packages or by
using Git clone, it does not matter. You can install the dashboard on
the same server as Varnish, and serve it using the Varnish Agent (with
the -H
option), or you can run it on a stand-alone server
using Apache or Nginx (or you can load it locally, it doesn't even need a
web server!).
转载于:https://blog.51cto.com/314258/1677149