Monit - Linux系统进程、文件、目录和设备的监测软件
2014-05-28 11:13
330 查看
Monit是一款功能非常丰富的进程、文件、目录和设备的监测软件,适用于Linux/Unix平台。 它可以自动修复那些已经停止运作的程序,特使适合处理那些由于多种原因导致的软件错误,同时Monit 包含一个内嵌的 HTTP(S) Web 界面,你可以使用浏览器方便地查看 Monit 所监视的服务器。
Monit官网:http://mmonit.com/monit/
32位:wget -c http://pkgs.repoforge.org/monit/monit-5.2.5-1.el5.rf.i386.rpm;rpm -ivh monit-5.2.5-1.el5.rf.i386.rpm
64位:wget -c http://pkgs.repoforge.org/monit/monit-5.2.5-1.el5.rf.x86_64.rpm;rpm -ivh monit-5.2.5-1.el5.rf.x86_64.rpm
Debian可以直接:apt-get install monit 安装。
下面是一个简单的例子,配置文件中已经包含了大量的例子,可以看配置文件参考。
看了一下php-fpm貌似用Monit还不是很好监控。
如果添加了http可以直接使用http://ip:2812 进行管理。
Monit官网:http://mmonit.com/monit/
1、安装Monit
CentOS可以到:http://pkgs.repoforge.org/monit/ 下载对应位数rpm包安装。32位:wget -c http://pkgs.repoforge.org/monit/monit-5.2.5-1.el5.rf.i386.rpm;rpm -ivh monit-5.2.5-1.el5.rf.i386.rpm
64位:wget -c http://pkgs.repoforge.org/monit/monit-5.2.5-1.el5.rf.x86_64.rpm;rpm -ivh monit-5.2.5-1.el5.rf.x86_64.rpm
Debian可以直接:apt-get install monit 安装。
2、修改配置文件
CentOS用RPM包安装的话配置文件在: /etc/monit.conf;Debian apt-get安装的话配置文件在:/etc/monit/monitrc;下面是一个简单的例子,配置文件中已经包含了大量的例子,可以看配置文件参考。
set daemon 120 #设置检测时间 set logfile /var/log/monit.log #monit日志 set alert www@vpser.net with reminder on 1 cycle #出现1次错误的时候发报警邮件到指定的邮箱 set mailserver mail.vpser.net #设置邮件服务器 set httpd port 2812 and # 设置http监控页面的端口 use address 74.207.246.99 # http监控页面的IP allow localhost # 允许本地访问 allow 123.23.45.0/24 # 允许此IP段访问 #allow 0.0.0.0/0.0.0.0 # 允许所有IP访问 allow username:password #设置访问用户名密码 #检测sshd服务 check process sshd with pidfile /var/run/sshd.pid start program "/etc/init.d/sshd start" stop program "/etc/init.d/sshd stop" if failed port 22 protocol ssh then restart if 5 restarts within 5 cycles then timeout #检测mysql服务 check process mysql with pidfile /usr/local/mysql/var/vpser.pid group database start program = "/etc/init.d/mysql start" stop program = "/etc/init.d/mysql stop" if failed host 127.0.0.1 port 3306 then restart if 5 restarts within 5 cycles then timeout #检测nginx服务 check process nginx with pidfile /usr/local/nginx/logs/nginx.pid start program = "/etc/init.d/nginx start" stop program = "/etc/init.d/nginx stop" if failed host www.vpser.net port 80 protocol http then restart配置中的pid及启动、关闭脚本的路径一定要是全路径,且参数一定要正确否则会造成无法正常检测或正常启动。
看了一下php-fpm貌似用Monit还不是很好监控。
如果添加了http可以直接使用http://ip:2812 进行管理。
3、启动/停止Monit
CentOS:
chkconfig monit on //加入开机启动 /etc/init.d/monit {start|stop|restart|force-reload|syntax}
Debian:
编辑:/etc/default/monit 文件,查找 startup=0 ,将0改为1,保存。
update-rc.d -f monit defaults /etc/init.d/monit {start|stop|restart|force-reload|syntax}
相关文章推荐
- 简述Linux 文件系统的目录结构
- 解读Linux文件系统的目录结构(转)
- 文件系统管理 之 在Linux系统中存储设备的两种表示方法
- Linux下的文件系统与目录系统简介
- 简述Linux 文件系统的目录结构
- 简述 Linux 文件系统的目录结构
- 最近成果-透明加密文件系统SDK-支持透明加密解密-手动加密解密-目录加密解密-指定进程加密-指定后缀加密-指定非法进程-锁定驱动器-支持Office文件加密解密-打开文件时加密等
- Linux下的文件系统与目录系统简介
- linux文件系统概念&目录结构
- linux2.6内核文件系统与设备模型
- Linux系统特殊文件--目录概念及使用
- 简述Linux 文件系统的目录结构
- 简述Linux 文件系统的目录结构
- 新手入门 Linux系统下各文件目录的含义
- Linux的文件系统的目录结构
- 完美解读Linux中文件系统的目录结构
- 简述Linux 文件系统的目录结构
- linux笔记02(查询系统帮助与查找文件或目录)
- 简述Linux 文件系统的目录结构
- 最近刚为公司完成的一款监视的小工具软件!用DELPHI 7 写的,可以从后台监控系统﹑键盘﹑鼠标﹑屏幕以及文件与目录!有源码!