比较来自世界各地的卖家的域名和 IT 服务价格

在文本文件中检测和电子邮件新的行 Linux

此日志文件,后跟我们要遵循的文件。 通常他没有收到任何更新。 但是每周一次或两次,他更新,当我们想要接收有关它的通知时。

有没有办法定期检查 (任务 cron) 并检测这样的文本文件中的更改,以及 Linux 发送电子邮件以更改。 如果电子邮件中有新行,但我们可以没有最后一个愿望,这也是很好的。
已邀请:

奔跑吧少年

赞同来自:

对于快速系统测试系统,我建议使用
http://mmonit.com/monit/docume ... sting
. 恶魔默认 Monit 将检查一切 30 或者 60 秒 (可定制), 但这是做你所要求的一种简单方法。 还易于配置电子邮件通知或其他操作。

他们的例子:

  check file syslog with path /var/log/syslog
ignore match
"^\w{3} [ :0-9]{11} [._[:alnum:]-]+ monit\[[0-9]+\]:"
ignore match /etc/monit/ignore.regex
if match
"^\w{3} [ :0-9]{11} [._[:alnum:]-]+ mrcoffee\[[0-9]+\]:"
if match /etc/monit/active.regex then alert

快网

赞同来自:

如果您正在使用 Nagios, 看一看
http://exchange.nagios.org/dir ... tails
插入:

Name       : check_logfiles
Arch : x86_64
Version : 3.4.2
Release : 1.el5.rf
Size : 167 k
Repo : installed
Summary : Logfile check plugin for nagios
URL : [url=http://sourceforge.net/projects/check-logfiles]http://sourceforge.net/projects/check-logfiles[/url]
License : GPL
Description: check_logfiles is a plugin for Nagios which searches for patterns in logfiles. It is capable of scanning
: multiple logfiles and their rotated ancestors in a single run.

例如:


# /usr/lib64/nagios/plugins/check_logfiles --logfile='/var/log/mysqld.log' --criticalpattern='is marked as crashed'


OK - no errors or warnings|default_lines=0 default_warnings=0 default_criticals=0 default_unknowns=0

要回复问题请先登录注册