1:zabbix server 搭建省略
2:varnish安装、启动省略
3:在varnish所在地机器上需要安装zabbix,作agent使用,在/usr/local/zabbix/etc/zabbix_agentd.conf文件的最后添加,
UserParameter=varnish.stat[*],(test -f /usr/local/varnish3/bin/varnishstat && /usr/local/varnish3/bin/varnishstat -n /data/varnish/cache -1 -f $1 | awk '{print $$2}')
##注意,因为启动varnish的时候我没有使用默认的cache,我的cache目录为/data/varnish/cache,所以必须使用-n /data/varnish/cache,否则zabbix server获取不到数据,同时在varnish所在地机器的/tmp/zabbix_agentd.log 下会有如下的报错:
点击(此处)折叠或打开
-
Cannot open /usr/local/varnish3/var/varnish/buf486.**.com/_.vsm: No such file or directory
-
Cannot open /usr/local/varnish3/var/varnish/buf486.**.com/_.vsm: No such file or directory
-
Cannot open /usr/local/varnish3/var/varnish/buf486.**.com/_.vsm: No such file or directory
-
Cannot open /usr/local/varnish3/var/varnish/buf486.**.com/_.vsm: No such file or directory
-
Cannot open /usr/local/varnish3/var/varnish/buf486.**.com/_.vsm: No such file or directory
-
Cannot open /usr/local/varnish3/var/varnish/buf486.**.com/_.vsm: No such file or directory
重启zabbix_agentd服务,/etc/init.d/zabbix_agentd restart
或者也可以如附件!
4:下载模板,并导入
模板如下:
1
127.0.0.1
3
0
127.0.0.1
623
0
2
Templates
smeonline.sk farma
Balancer
-
Cache efectivity
60
90
365
0
0
%
0
0
0
0
(last("varnish.stat[cache_hit]")+last("varnish.stat[cache_hitpass]"))/(last("varnish.stat[cache_hit]")+
last("varnish.stat[cache_hitpass]")+last("varnish.stat[cache_miss]"))*100
localhost
161
0
-
Accept failures
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Backend conn. too many
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Backend conn. success
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Backend conn. failures
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Backend conn. recycles
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Backend requests made
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Backend conn. reuses
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Backend conn. was closed
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Backend conn. not attempted
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Backend conn. unused
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Cache hits for pass
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Cache hits
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Cache misses
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Client connections accepted
60
90
365
0
0
0
1
0
0
localhost
public
interfaces.ifTable.ifEntry.ifInOctets.1
161
0
-
Connection dropped, no sess/wrk
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Connection dropped late
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Client requests received
60
90
365
0
0
0
1
0
0
localhost
161
0
-
ESI parse errors (unlock)
60
90
365
1
0
0
1
0
0
localhost
161
0
-
Objects ESI parsed (unlock)
60
90
365
1
0
0
1
0
0
localhost
161
0
-
Fetch had bad headers
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Fetch chunked
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Fetch wanted close
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Fetch EOF
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Fetch failed
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Fetch head
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Fetch with Length
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Fetch pre HTTP/1.1 closed
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Fetch zero len
60
90
365
0
0
0
1
0
0
localhost
161
0
-
HCB Inserts
60
90
365
1
0
0
1
0
0
localhost
161
0
-
HCB Lookups with lock
60
90
365
1
0
0
1
0
0
localhost
161
0
-
HCB Lookups without lock
60
90
365
1
0
0
1
0
0
localhost
161
0
-
HTTP header overflows
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N backends
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N objects on deathrow
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N expired objects
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N LRU moved objects
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N LRU nuked objects
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N LRU saved objects
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N struct objectcore
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N struct objecthead
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N struct object
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Objects overflowing workspace
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Objects sent with sendfile
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Objects sent with write
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N struct sess
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N struct sess_mem
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N struct smf
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N small free smf
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N large free smf
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N unresurrected objects
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N struct vbe_conn
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N worker threads
60
90
365
0
0
0
0
0
0
localhost
161
0
-
N worker threads created
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N dropped work requests
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N worker threads not created
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N worker threads limited
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N overflowed work requests
60
90
365
0
0
0
1
0
0
localhost
161
0
-
N queued work requests
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Session Closed
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Session herd
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Session Linger
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Session Pipeline
60
90
365
0
0
0
1
0
0
localhost
161
0
-
Session Read Ahead
60
90
365
0
0
0
1
0
0
localhost
161
0
-
SHM MTX contention
60
90
365
0
0
0
1
0
0
localhost
161
0
-
SHM cycles through buffer
60
90
365
0
0
0
1
0
0
localhost
161
0
-
SHM flushes due to overflow
60
90
365
0
0
0
1
0
0
localhost
161
0
-
SHM records
60
90
365
0
0
0
1
0
0
localhost
161
0
-
SHM writes
60
90
365
0
0
0
1
0
0
localhost
161
0
-
SMA bytes allocated
60
90
365
1
0
b
0
0
0
0
localhost
161
0
-
SMA bytes free
60
90
365
1
0
b
0
0
0
0
localhost
161
0
-
SMA outstanding bytes
60
90
365
1
0
b
0
0
0
0
localhost
161
0
-
SMA outstanding allocations
60
90
365
1
0
0
1
0
0
localhost
161
0
-
SMA allocator requests
60
90
365
1
0
0
1
0
0
localhost
161
0
-
SMS bytes allocated
60
90
365
1
0
b
0
0
0
0
localhost
161
0
-
SMS bytes freed
60
90
365
1
0
b
0
1
0
0
localhost
161
0
-
SMS outstanding bytes
60
90
365
1
0
b
0
1
0
0
localhost
161
0
-
SMS outstanding allocations
60
90
365
1
0
0
1
0
0
localhost
161
0
-
SMS allocator requests
60
90
365
1
0
0
1
0
0
localhost
161
0
-
Total body bytes
60
90
365
1
0
b
0
0
0
0
localhost
161
0
-
Total fetch
60
90
365
1
0
0
0
0
0
localhost
161
0
-
Total header bytes
60
90
365
1
0
b
0
0
0
0
localhost
161
0
-
Total pass
60
90
365
1
0
0
0
0
0
localhost
161
0
-
Total pipe
60
90
365
1
0
0
0
0
0
localhost
161
0
-
Total Requests
60
90
365
1
0
0
0
0
0
localhost
161
0
-
Total Sessions
60
90
365
1
0
0
0
0
0
localhost
161
0
0
0
0
0
0
0.0000
100.0000
0
0
0
0
008080
0
2
0
0
1
800080
0
2
0
0
2
00ff00
0
2
0
0
3
808080
0
2
0
0
4
c0c0c0
0
2
0
0
5
ff0000
0
2
0
0
6
ffff00
0
2
0
0
7
ffa500
0
2
0
0
0
0
0
0
0.0000
100.0000
0
0
0
0
009900
0
2
0
0
0
008080
0
2
0
0
1
990000
0
2
0
0
0
0
0
0
0.0000
100.0000
0
0
0
0
009900
0
2
0
0
1
008080
0
2
0
0
2
800000
0
2
0
0
3
ff0000
0
2
0
0
0
0
0
0
0.0000
100.0000
0
0
0
0
008080
0
2
0
0
1
800080
0
2
0
0
2
00ff00
0
2
0
0
3
808080
0
2
0
0
4
c0c0c0
0
2
0
0
5
ffff00
0
2
0
0
6
ffa500
0
2
0
0
7
00ffff
0
2
0
0
8
ff0000
0
2
0
0
0
0
0
0
0.0000
100.0000
0
0
0
0
008080
0
2
0
0
1
800080
0
2
0
0
2
00ff00
0
2
0
0
3
808080
0
2
0
0
4
c0c0c0
0
2
0
0
5
ffa500
0
2
0
0
6
ff0000
0
2
0
我将上面的文件命名为varnish.xml
该模板下载地址:
将该模板导入到zabbix server中!
选择 配置--->模板--->载入 然后选中自己的模板文件,点击 载入 按钮即可!
查看是否有varnish的相关模板
最后一行,显然模板已经被导入了!下面就是将该模板添加到主机上,然后过几分钟就可以读取到数据了
5:读取到的数据见附件!
阅读(2696) | 评论(0) | 转发(0) |