`
wangxiaohigh
  • 浏览: 1427324 次
文章分类
社区版块
存档分类
最新评论

Monit安装配置及其使用

阅读更多
Monit是一款功能非常丰富的进程、文件、目录和设备的监测软件,用于Unix平台。 它可以自动修复那些已经停止运作的程序,特使适合处理那些由于多种原因导致的软件错误。monit运行于应用层
安装很简单,三部曲
#./configure
#make
#make install
复制配置文件
# cp monitrc /etc/monitrc
接下来我们根据实际情况来修改这个配置文件
set daemon 120 # Poll at 2-minute intervals//每2分钟检查一次
set logfile /home/monit/log/monit.log //monit的日志文件
set alert zhouwei@chinabank.com.cn with reminder on 1 cycle //出现1次错误的时候发报警邮件到指定的邮箱
#set mailserver mail.tildeslash.com, mail.foo.bar port 10025, localhost with tim
eout 15 seconds
set mailserver 10.10.9.109 //设置邮件服务器
set httpd port 2812 and use address 10.10.8.2 //设置http监控页面的端口和ip
allow localhost # Allow localhost to connect //允许本机访问
allow 10.10.8.0/24 //允许此IP段访问
allow admin:nishiwode # Allow Basic Auth //认证的用户名和密码
# all system //平均负载.内存使用率,cpu使用率
check system 10.10.8.2
if loadavg (1min) > 4 then alert
if loadavg (5min) > 2 then alert
if memory usage > 75% then alert
if cpu usage (user) > 70% then alert
if cpu usage (system) > 30% then alert
if cpu usage (wait) > 20% then alert
# all disk //磁盘空间使用率
check device data with path /dev/sda2
if space usage > 90% then alert
if inode usage > 85% then alert
check device home with path /dev/sda3
if space usage > 85% then alert
if inode usage > 85% then alert
# all rsync
#10.10.8.2
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 host 127.0.0.1 port 22 protocol ssh then restart
if 5 restarts within 5 cycles then timeout
//监控ssh服务
check process httpd with pidfile /var/run/httpd.pid
group apache
start program = "/etc/init.d/httpd start"
stop program = "/etc/init.d/httpd stop"
if failed host 127.0.0.1 port 80
protocol http then restart
if 5 restarts within 5 cycles then timeout
//监控http服务

//监控自定义服务
check process web_lb with pidfile /data/v20/server/web_lb/httpd.pid
start program = "/data/v20/bin/lb.sh" //启动脚本
stop program = "/data/v20/bin/lb_stop.sh" //停止脚本
if failed host 10.10.8.2 port 16101 proto http then restart
if failed host 10.10.8.2 port 16101 proto http for 5 times within 5 cycles t
hen exec "/data/v20/bin/lb_pay.sh"
if failed host 10.10.8.2 port 16102 type TCPSSL proto http then restart
if failed host 10.10.8.2 port 16102 type TCPSSL proto http for 5 times withi
n 5 cycles then exec "/data/v20/bin/lb_pay.sh

RHEL可以用如下方法启动monit
# vi /etc/inittab
添加:
mo:2345:respawn:/usr/local/bin/monit -Ic /etc/monitrc
Now start monit:
# init -q或者# telinit -q
You can verify that monit is started from /var/log/message log file:
# tail -f /var/log/message
如果正常启动能看到如下输出:
Nov 21 04:39:21 server monit[8759]: Starting monit daemon
Nov 21 04:39:21 server monit[8759]: Monit started
分享到:
评论

相关推荐

    centos7安装monit

    监控进程,守护进程,实时拉起进程,监控工具脚本,用于程序拉起,监控程序状态,程序停止,启动等功能.....

    monit使用说明.docx

    Monit是unix系统上用于管理监视进程、文件、目录及设备的工具。Monit提供自动维护和修复功能,并能在出错时执行相应的关联的行为。比如monit可以开启一个进程(当它没有正常运行),重启一个进程(如果它没有反应)...

    docker-monit:用于monit的Docker映像

    监控的基本图像docker-monit是一个映像,已配置为可直接使用或用作监控守护程序更多自定义应用程序的基础。 docker-monit可用于从提取该图像包括监控版本5.13概述此映像将monit安装到以下位置: / opt / monit Monit...

    monit_bin:从源代码安装monit并使用LWRP添加几个工具

    从源安装monit。 包括设置工具monitensite、monitdisite。 为创建的配置添加 LWRP。 要求 制作(构建必不可少) 平台 乌本图 智能操作系统 用法 recipe[monit]默认安装。 从其他食谱调用 include_recipe "monit_...

    Ansible-monit.zip

    Ansible-monit.zip,配置monit的ansible角色。还将设置ssh、ntp和cron.anxs-monit的基线监视,ansible是一个简单而强大的自动化引擎。它用于帮助配置管理、应用程序部署和任务自动化。

    ansible-monit:Monit的Ansible角色

    在不安装和使用自定义服务的情况下配置monit: - role : monit monit_setup : configure monit_custom_services : consul : {group: monitoring, pid: /var/run/consul/consul.pid, checks: [ {type: host, ...

    monit 服务端监控

    monit软件可监控软件部署服务端口及名称,使用方便切软件规模小

    monit监控工具(客户端)

    centos6.5 monit 监控 性能 程序自动化监控

    监测应用monit

    Monit是一款功能非常丰富的进程、文件、目录和设备的监测软件。它可以自动修复那些已经停止运作的程序,特使适合处理那些由于多种原因导致的软件错误。

    monit-fabric:monit-graphite 是一个快速的'n'dirty 结构脚本,用于在 debian 挤压盒上安装 monit

    Monit-Fabric - Debian Squeeze 上 Monit 的结构安装程序 monit-graphite 是一个快速的'n'dirty 结构脚本,用于在 debian 挤压盒上安装 为什么? 我找不到 backport 安装,我喜欢 Fabric,所以它保留了所有安装步骤...

    monit-5.4.tar.gz

    monit-5.4.tar.gz qsdk 编译包

    monit-rpm:为最新的Monit(RedHat CentOS)构建RPM软件包

    使用以下命令在CentOS上安装最新的Monit: sudo yum -y install https://extras.getpagespeed.com/release-el$(rpm -E %{rhel})-latest.rpm sudo yum install monit 背景 当我发现EPEL存储库中的Monit一年都没有...

    monit:ASYD 的 Monit 分叉

    AsydSolutions/monit 这是来自官方的分支,包括一些小的更改,用于从 XML Web API 获取更详细的输出以用于 ASYD(即主机故障通知)。 ... 您需要安装 ANSI-C99 编译器来构建 Monit。 推荐使用自由

    capistrano-unicorn-monit:为 Unicorn 配置监控

    使用 capistrano 部署独角兽的监控配置 安装 将此行添加到您的应用程序的 Gemfile: group::development do gem 'capistrano-unicorn-monit', github: 'bypotatoes/capistrano-unicorn-monit' end 然后执行: $ ...

    monit2telegram:一个简单的脚本,可使用Telegram机器人发送Monit警报

    monit2telegram:一个简单的脚本,可使用Telegram机器人发送Monit警报

    Ansible-ansible-role-monit.zip

    Ansible-ansible-role-monit.zip,负责配置monit.monit的角色,ansible是一个简单而强大的自动化引擎。它用于帮助配置管理、应用程序部署和任务自动化。

    monit-dashboard:Web仪表板,可一目了然地监控所有monit服务器

    应用程序每隔300秒(经过硬编码)会在每个已配置的服务器的XMl报告中要求Monit内置Web服务器提供的数据。 然后,借助内置的Web服务器,它可以显示在单个HTML页面中。 先决条件 Debian GNU / Linux Web.py框架 apt ...

    monit-5.0.1.tar.gz_monit-5.0.1.tar.gz

    monit-5.0.1.tar.gz 有需要的可以下载看看

    ansible-role-monit:用于配置监视的Ansible角色

    ansible-role-monit:用于配置监视的Ansible角色

    monit-docker:Docker化监控

    Docker化监控克隆这个 repo。 编辑以设置您的配置。 在 conf.d 中添加要监视的服务/进程的配置比如可以在... Monit 图像已准备就绪,可以作为docker run -d -p 2812:2812 调用Monit 现在正在运行并且可以在<host>:2812

Global site tag (gtag.js) - Google Analytics