zabbix监控varnish
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:下载模板,并导入
模板如下:
0
1
127.0.0.1
10050
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
0
(last("varnish.stat")+last("varnish.stat"))/(last("varnish.stat")+
last("varnish.stat")+last("varnish.stat"))*100
localhost
161
0
Varnish
Varnish: Cache
Accept failures
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Backend conn. too many
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Backend
Backend conn. success
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Backend
Backend conn. failures
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Backend
Backend conn. recycles
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Backend
Backend requests made
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Backend
Backend conn. reuses
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Backend
Backend conn. was closed
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Backend
Backend conn. not attempted
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Backend
Backend conn. unused
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Backend
Cache hits for pass
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Cache
Cache hits
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Cache
Cache misses
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Cache
Client connections accepted
60
90
365
0
0
0
1
0
0
0
localhost
public
interfaces.ifTable.ifEntry.ifInOctets.1
161
0
Varnish
Varnish: Connections
Connection dropped, no sess/wrk
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Connections
Connection dropped late
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Connections
Client requests received
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Connections
ESI parse errors (unlock)
60
90
365
1
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: ESI
Objects ESI parsed (unlock)
60
90
365
1
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: ESI
Fetch had bad headers
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Fetch
Fetch chunked
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Fetch
Fetch wanted close
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Fetch
Fetch EOF
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Fetch
Fetch failed
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Fetch
Fetch head
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Fetch
Fetch with Length
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Fetch
Fetch pre HTTP/1.1 closed
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Fetch
Fetch zero len
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Fetch
HCB Inserts
60
90
365
1
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: HCB
HCB Lookups with lock
60
90
365
1
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: HCB
HCB Lookups without lock
60
90
365
1
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: HCB
HTTP header overflows
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
N backends
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
N objects on deathrow
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
N expired objects
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
N LRU moved objects
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
N LRU nuked objects
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
N LRU saved objects
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
N struct objectcore
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
N struct objecthead
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
N struct object
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Objects overflowing workspace
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Sessions
Objects sent with sendfile
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Sessions
Objects sent with write
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Sessions
N struct sess
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
N struct sess_mem
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
N struct smf
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
N small free smf
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
N large free smf
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
N unresurrected objects
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
N struct vbe_conn
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
N worker threads
60
90
365
0
0
0
0
0
0
0
localhost
161
0
Varnish
Varnish: Workers
N worker threads created
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Workers
N dropped work requests
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Workers
N worker threads not created
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Workers
N worker threads limited
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Workers
N overflowed work requests
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Workers
N queued work requests
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Workers
Session Closed
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Sessions
Session herd
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Sessions
Session Linger
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Sessions
Session Pipeline
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Sessions
Session Read Ahead
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: Sessions
SHM MTX contention
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: SHM
SHM cycles through buffer
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: SHM
SHM flushes due to overflow
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: SHM
SHM records
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: SHM
SHM writes
60
90
365
0
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: SHM
SMA bytes allocated
60
90
365
1
0
b
0
0
0
0
0
localhost
161
0
Varnish
Varnish: SMA
SMA bytes free
60
90
365
1
0
b
0
0
0
0
0
localhost
161
0
Varnish
Varnish: SMA
SMA outstanding bytes
60
90
365
1
0
b
0
0
0
0
0
localhost
161
0
Varnish
Varnish: SMA
SMA outstanding allocations
60
90
365
1
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: SMA
SMA allocator requests
60
90
365
1
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: SMA
SMS bytes allocated
60
90
365
1
0
b
0
0
0
0
0
localhost
161
0
Varnish
Varnish: SMS
SMS bytes freed
60
90
365
1
0
b
0
1
0
0
0
localhost
161
0
Varnish
Varnish: SMS
SMS outstanding bytes
60
90
365
1
0
b
0
1
0
0
0
localhost
161
0
Varnish
Varnish: SMS
SMS outstanding allocations
60
90
365
1
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: SMS
SMS allocator requests
60
90
365
1
0
0
1
0
0
0
localhost
161
0
Varnish
Varnish: SMS
Total body bytes
60
90
365
1
0
b
0
0
0
0
0
localhost
161
0
Varnish
Varnish: Totals
Total fetch
60
90
365
1
0
0
0
0
0
0
localhost
161
0
Varnish
Varnish: Totals
Total header bytes
60
90
365
1
0
b
0
0
0
0
0
localhost
161
0
Varnish
Varnish: Totals
Total pass
60
90
365
1
0
0
0
0
0
0
localhost
161
0
Varnish
Varnish: Totals
Total pipe
60
90
365
1
0
0
0
0
0
0
localhost
161
0
Varnish
Varnish: Totals
Total Requests
60
90
365
1
0
0
0
0
0
0
localhost
161
0
Varnish
Varnish: Totals
Total Sessions
60
90
365
1
0
0
0
0
0
0
localhost
161
0
Varnish
Varnish: Totals
0
0
0
0
0
0.0000
100.0000
0
0
0.0000
0.0000
0
0
008080
0
2
0
5
0
1
800080
0
2
0
5
0
2
00ff00
0
2
0
5
0
3
808080
0
2
0
5
0
4
c0c0c0
0
2
0
5
0
5
ff0000
0
2
0
5
0
6
ffff00
0
2
0
5
0
7
ffa500
0
2
0
5
0
0
0
0
0
0.0000
100.0000
0
0
0.0000
0.0000
0
0
009900
0
2
0
5
0
0
008080
0
2
0
5
0
1
990000
0
2
0
5
0
0
0
0
0
0.0000
100.0000
0
0
0.0000
0.0000
0
0
009900
0
2
0
5
0
1
008080
0
2
0
5
0
2
800000
0
2
0
5
0
3
ff0000
0
2
0
5
0
0
0
0
0
0.0000
100.0000
0
0
0.0000
0.0000
0
0
008080
0
2
0
5
0
1
800080
0
2
0
5
0
2
00ff00
0
2
0
5
0
3
808080
0
2
0
5
0
4
c0c0c0
0
2
0
5
0
5
ffff00
0
2
0
5
0
6
ffa500
0
2
0
5
0
7
00ffff
0
2
0
5
0
8
ff0000
0
2
0
5
0
0
0
0
0
0.0000
100.0000
0
0
0.0000
0.0000
0
0
008080
0
2
0
5
0
1
800080
0
2
0
5
0
2
00ff00
0
2
0
5
0
3
808080
0
2
0
5
0
4
c0c0c0
0
2
0
5
0
5
ffa500
0
2
0
5
0
6
ff0000
0
2
0
5
我将上面的文件命名为varnish.xml
该模板下载地址:
https://github.com/rdvn/zabbix-templates/tree/master/varnish
将该模板导入到zabbix server中!
选择 配置--->模板--->载入然后选中自己的模板文件,点击 载入 按钮即可!
查看是否有varnish的相关模板
最后一行,显然模板已经被导入了!下面就是将该模板添加到主机上,然后过几分钟就可以读取到数据了
5:读取到的数据见附件!
页:
[1]