设为首页 加入收藏

TOP

Monit : 开源监控工具介绍(四)
2017-10-13 10:36:39 】 浏览:6969
Tags:Monit 开源 监控 工具 介绍
# group server # # ## Check a
file's timestamp. In this example, we test if a file is older ## than 15 minutes and assume something is wrong if its not updated. Also, ## if the file size exceed a given limit, execute a script # # check file database with path /data/mydatabase.db # if failed permission 700 then alert # if failed uid data then alert # if failed gid data then alert # if timestamp > 15 minutes then alert # if size > 100 MB then exec "/my/cleanup/script" as uid dba and gid dba # # ## Check directory permission, uid and gid. An event is triggered if the ## directory does not belong to the user with uid 0 and gid 0. In addition, ## the permissions have to match the octal description of 755 (see chmod(1)). # # check directory bin with path /bin # if failed permission 755 then unmonitor # if failed uid 0 then unmonitor # if failed gid 0 then unmonitor # # ## Check a remote host availability by issuing a ping test and check the ## content of a response from a web server. Up to three pings are sent and ## connection to a port and an application level network check is performed. # # check host myserver with address 192.168.1.1 # if failed ping then alert # if failed port 3306 protocol mysql with timeout 15 seconds then alert # if failed port 80 protocol http # and request /some/path with content = "a string" # then alert # # ## Check a network link status (up/down), link capacity changes, saturation ## and bandwidth usage. # # check network public with interface eth0 # if failed link then alert # if changed link then alert # if saturation > 90% then alert # if download > 10 MB/s then alert # if total upload > 1 GB in last hour then alert # # ## Check custom program status output. # # check program myscript with path /usr/local/bin/myscript.sh # if status != 0 then alert # # ############################################################################### ## Includes ############################################################################### ## ## It is possible to include additional configuration parts from other files or ## directories. # # include /etc/monit.d/* # # 导入其他单项服务的监控配置 # Include all files from /etc/monit.d/ include /etc/monit.d/*

 

· 通知周期设置

 
Monit默认情况下如果一个服务失败只发送一个通知:   alert foo@bar
 
如果您希望在服务保持处于失败状态时每十个周期通知一次,您可以使用:   alert foo@bar with reminder on
10 cycles
 
同样,如果您想在每个失败的周期获得通知,您可以使用:   alert foo@bar with reminder on
1 cycle

要禁止某些用户和服务的警报,可以在服务检查的局部配置里添加语句:   noalert mail
-address

 



·  服务检测周期设置

 

可以使用every语句修改服务检查计划。 1.轮询周期倍数 EVERY [number] CYCLES 2.Cron-style EVERY [cron] # [cron] # * * * * * # 分 时 日 月 周 3.与Cron-style相反(do-not-check) NOT EVERY [cron] 示例: 示例1:每两个周期检查一次 check process nginx with pidfile /var/run/nginx.pid every 2 cycles 示例2:在上午8点到下午7点之间检查每个工作日 check program checkOracleDatabase with path /var/monit/programs/checkoracle.pl every "* 8-19 * * 1-5" 示例3:在星期日0AM到3AM之间不要在备份窗口中运行检查,否则运行具有常规轮询周期频率的检查。 check process mysqld with pidfile /var/run/mysqld.pid not every "* 0-3 * * 0" 注意不要使用特定的分钟,因为Monit可能不会在那分钟运行。

 

 

 

· WEB UI界面

 

 

 

参考:

http://www.cnblogs.com/52fhy/p/6412547.html

http://blog.csdn.net/senlin1202/article/details/54291176

https://mmonit.com/monit/documentation/monit.html

首页 上一页 1 2 3 4 下一页 尾页 4/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇shell脚本--cut命令 下一篇rsync配置安装

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目