Articles of monit

有没有办法让monit不要尝试重启一个进程?

如果运行时间过长,我就会监视一个进程并杀死它。 但是,我不希望此过程自动重新启动。 我没有指定start program ,但是每个循环,monitlogging它不能重新启动进程。 有没有办法告诉monit不要尝试重新启动进程和/或从日志中抑制它? check process libreoffice matching soffice.bin if uptime > 2 then exec "/usr/bin/killall –older-than 2m soffice.bin"

monit在“如果不存在”检查后不运行脚本

我遇到了monit问题。 我已经设置监控monit。 不过,我在检查运行的进程时遇到了麻烦。 如果进程没有运行,我想运行一个特定的脚本,将创buildpagerduty警报。 我的Monit文件看起来像这样: check process "myapp" matching "myapp" start program = "/usr/local/myapp start" stop program = "/usr/local/myapp stop" if does not exist then exec "/bin/bash pagerduty_script 'MyApp Down' trigger" pagerduty_script只是一个包含两个参数"string event"和动作trigger的包装器 脚本起作用。 我已经在terminaltesting,它运行良好。 事件实际上是在pagerduty中创build的。 但是,即使没有进程正在运行,它似乎并不像monit实际运行它: ps -ef | grep myapp vagrant 23950 23136 0 17:40 pts/0 00:00:00 grep –color=auto myapp sudo monit状态: Process […]

如何使用monit检查目录内的文件数量?

我在我的服务器上有一个目录,我想用Monit来监视这个目录下的文件数目…我怎么能这样做呢? 谢谢。

monit:如何发送电子邮件像警报

我想为以下情况自定义警报消息: if cpu > 75% for 2 cycles then exec "command|mail -s subject [email protected]" 到monitrcconfiguration文件 我怎样才能添加该命令? check process apache with pidfile /var/run/apache2.pid start program = "/etc/init.d/apache2 start" with timeout 60 seconds stop program = "/etc/init.d/apache2 stop" if cpu > 60% for 2 cycles then alert if cpu > 80% for 5 cycles then restart # […]

如何让monit只在检查失败时提醒一次,而不是在恢复成功时提醒一次?

道歉,如果这是同样的问题, 如何重新启动成功时禁止监视警报? ,但似乎可能会有所不同,所以我再次问。 当一个实例的正常运行时间是2分钟时,我们希望有一个monit警报检查。 这是为了在实例重启时提醒我们。 我得到了这个工作: check program uptimecheck with path /root/uptime_check.sh if status != 0 then alert ..但问题是,它也会在“检查成功”时发出警报。我只想在失败时发出警报。 我怎样才能做到这一点? 谢谢!

为什么在使用nginx和monit的时候基本的auth循环

我正在尝试configurationnginx,以便http://example.com/monit访问http://127.0.0.1:2812 ,这是monit正在监听的url。 通过nginx(nginx.conf文件)和monit(monitrc文件)设置了两个authentication。 现在,访问http://example.com/monit/ ,应该popup两个input表单,但进入第二个(通过monit)后,nginx的popup一次。 任何人都可以指出什么是错的? (注意:解决这个问题很简单 – closures一个基本的authentication) 我testing了debian jessie。 对不起,如果它不会重现 这是我的/usr/local/nginx/conf/nginx.conf(从源代码安装) server{ … auth_basic "restricted" auth_basic_user_file /home/user/.htpasswd; location /monit/ { rewrite ^/monit/(.*) /$1 break; proxy_pass http://127.0.0.1:2812; } } 此configuration要求用户input用户名/密码以访问此服务器指令中的任何文件。 如果uri以/ monit /开头,则input位置指令,并将其传递给127.0.0.1:2812 。 简单。 然后在/ etc / monitrc中,我设置了一个基本的authentication。 set httpd port 2812 and allow 127.0.0.1 # allow access only from localhost allow admin:monit […]

开始monit与停止的服务

是否有可能在monit中有一个服务的条目 在系统启动和monit启动时服务不启动 monit显示它的状态 只有在http界面中按下开始或停止button才会启动或停止它。

通过Google Apps邮件服务器发送邮件

我正在尝试使用monit v5.1发送通知邮件。 我使用Google Apps作为邮件服务器,因此我想使用他们的基础设施发送邮件。 我在/ etc / monit / monitrc中input了以下信息: set mailserver smtp.gmail.com PORT 587 USERNAME "[email protected]" PASSWORT "mypassword" using TLSV1 with timeout 30 seconds 当monit试图发送邮件时,我得到以下错误: Sendmail error: 530 5.7.0 Must issue a STARTTLS command first. 我如何告诉monit使用STARTTLS? 如何通过使用Google Apps邮件服务器发送警报邮件?

在Linux Centos错误消息中configurationMonit应用程序

我正在尝试configurationMonit来监视我的pidfile。 除了一个,我没有问题。 这是我configuration的: check process chat with pidfile /var/run/chat.pid start program = "/etc/init.d/chat start" start program = "/etc/init.d/chat stop" 这是我开始与/etc/init.d/chat聊天时的过程: ps -ef | grep chat root 17659 1 0 19:23 pts/2 00:00:00 /usr/bin/php -q /usr/statistic/chatManager root 17662 17659 0 19:23 pts/2 00:00:00 /usr/bin/php -q /usr/statistic/chatManager 这是我在monit日志文件中看到的内容: 当我开始这个过程时: [GMT Mar 21 19:23:51] info : 'chat' process […]

Monit和薄的和未发现的gem

我一直在使用Monit监视我的瘦服务器,一切正常,直到我将我的Rails版本从2.3.4升级到2.3.14。 现在当我尝试使用monit来启动Thin时,它给了我一个无法解释的gem错误: Missing the Rails 2.3.14 gem. Please `gem install -v=2.3.14 rails` 我认为这可能是一个GEM PATH问题,也尝试在启动命令中设置GEM_HOME和PATHvariables: check process thin3001 with pidfile /home/blahblah/apps/Vocab/shared/pids/thin.3001.pid start program = "/usr/bin/env PATH=/usr/lib/ruby/gems/1.8/gems GEM_HOME=/usr/lib/ruby/gems/1.8/gems /usr/bin/ruby /usr/bin/thin -C /etc/thin/vocab.yml start -o 3001" stop program = "/usr/bin/ruby /usr/bin/thin -C /etc/thin/vocab.yml stop -o 3001" if totalmem > 150.0 MB for 5 cycles then restart group thin […]