需求: 监控/root/data/test.log 一分钟内增长的大小, 每一分钟检测一次,增长超过10M就告警
一、配置监控项
键值选择
vfs.file.size[file]
注意,单位是bytes
,也就是B


二、配置触发器
注意把文件大小的值 换成 以
B
(bytes
)为单位


三、看一下最新数据,已经检测到数据了

四、测试一下
[root@localhost data]# ls
install_windows_zbx-agent.sh install_zbx-agent.sh test.log
[root@localhost data]# du -h test.log
300M test.log
[root@localhost data]# zabbix_get -s 127.0.0.1 -k vfs.file.size[/root/data/test.log]314572800
[root@localhost data]# dd if=/dev/zero of=t.log bs=1M count=11
11+0 records in
11+0 records out
11534336 bytes (12 MB) copied, 0.00731116 s, 1.6 GB/s
[root@localhost data]# du -h t.log
11M t.log
[root@localhost data]# cat t.log >> test.log
[root@localhost data]# du -h test.log
311M test.log
[root@localhost data]# zabbix_get -s 127.0.0.1 -k vfs.file.size[/root/data/test.log]
326107136
[root@localhost data]#
给
test.log
文件增加了11M 看看数据和告警

注意:Zabbix上面 1M是1000Kb ,换算是1000不是1024,所以数据有一点差异

网友评论