zabbix 监控文件夹

安装inotify

wget http://github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz

tar -zxvf inotify-tools-3.14.tar.gz

./configure

make && make install

创建脚本

root@localhost ian]# cat inotify.sh
#!/bin/sh

 /usr/local/bin/inotifywait -mrq -e create,delete,moved_to,close_write --fromfile '/home/ian/excludedir' --format "%T%w%f" --timefmt '%y-%m-%d %H:%M' --format "%T %w%f 事件 信息:%e" >> /tmp/wenjian.txt

创建需要监控的目录

[root@localhost ian]# cat excludedir
/etc/cron.hourly
/etc/cron.daily
/etc/cron.weekly
启动inotify

nohup sh inotify.sh &

zabbix 客户端改成主动式,配置----主机---监控项选择log日志监控 

键值:log[/tmp/wenjian.txt]

猜你喜欢

转载自www.cnblogs.com/iantest/p/9626925.html
今日推荐