标签: monit

如何设置 monit 脚本来检查目录是否存在,如果不存在则创建它

在 monit 文档中,我可以看到有一个 check directory 命令,但我看不到任何示例,说明如何使用它来查看目录是否存在以及是否不使用 mkdir 命令创建目录。

monitoring monit mkdir

1
推荐指数
1
解决办法
4099
查看次数

php-fpm 的监控配置

我正在努力为 php-fpm 找到一个有效的 monit 配置。

这是我尝试过的:

### Monitoring php-fpm: the parent process.
check process php-fpm with pidfile /var/run/php-fpm/php-fpm.pid
  group phpcgi # phpcgi group
  start program = "/etc/init.d/php-fpm start"
  stop program  = "/etc/init.d/php-fpm stop"
  ## Test the UNIX socket. Restart if down.
  if failed unixsocket /var/run/php-fpm.sock then restart
  ## If the restarts attempts fail then alert.
  if 3 restarts within 5 cycles then timeout
  depends on php-fpm_bin
  depends on php-fpm_init

## Test the php-fpm binary.
check file php-fpm_bin with path /usr/sbin/php-fpm …
Run Code Online (Sandbox Code Playgroud)

php-fpm monit

1
推荐指数
1
解决办法
5252
查看次数

Monit 未重新启动进程

我必须monit监视一个进程,但它没有意识到它已关闭。我的监控配置是这样的:

 check process xxx with pidfile /var/run/xxx.pid
 group yyy
 start program = "/etc/init.d/xxx start"
 stop program = "/etc/init.d/xxx stop"
 if failed host 127.0.0.1 port 9999  then restart
 if 5 restarts within 5 cycles then timeout
Run Code Online (Sandbox Code Playgroud)

问题是即使我的进程崩溃了,PID 文件仍然存在。所以...PID 存在但本地主机中的端口 9999 应该失败。那么... monit 是否应该不重启这个过程?应该删除pid文件吗?不能做那种OR

提前致谢,

monitoring pid monit centos6

1
推荐指数
1
解决办法
5242
查看次数

无法让 monit 运行“exec”操作

monit在 CentOS 6.5 上有一个工作安装。检测到事件并发送警报邮件,但我试图通过该exec功能在事件触发时发生其他事情,但这些都不起作用。

例如,我有一个规则:

if cpu usage (user) > 10% then 
   exec "/bin/echo 'user limit' >> /tmp/monit-status-log" as uid someuser and gid somegroup
Run Code Online (Sandbox Code Playgroud)

该规则在 cpu 负载下适当地触发,但没有任何内容写入文件(其保护设置为 rw-rw-rw)。

就执行而言,执行的日志文件看起来是正确的,我猜:

[PST Feb 20 09:31:04] info     : 'linux2.example.com' Monit reloaded
[PST Feb 20 09:31:31] info     : Reinitializing monit daemon
[PST Feb 20 09:31:31] info     : Awakened by the SIGHUP signal
[PST Feb 20 09:31:31] info     : Reinitializing monit - Control file '/etc/monit.conf'
[PST Feb 20 09:31:31] info     : …
Run Code Online (Sandbox Code Playgroud)

centos monit

1
推荐指数
1
解决办法
3484
查看次数

如何使用monit监控postfix邮件队列?

有没有办法使用 monit 监控 postfix 邮件队列?可用的脚本只是检查、启动/关闭/内存或 CPU。我想在队列开始填满时收到通知。能够在不同的队列上设置监视器以便能够做出适当的反应会很好。

monitoring postfix monit

1
推荐指数
1
解决办法
2743
查看次数

Apache、MySQL 和 Postfix 的监控配置

我计划使用以下配置在我的生产服务器上启用 Monit。我对 Monit 完全陌生,想听听其他人的建议,或者是否有其他指令我应该考虑根据您的经验来支持我的监控脚本。

我的服务器是 CentOS 5.6。

谢谢!

#httpd----
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 cpu > 60% for 2 cycles then alert
if cpu > 80% for 5 cycles then restart
if 5 restarts within 5 cycles then timeout

#mysqld----
check process mysqld with pidfile /var/run/mysqld/mysqld.pid
group mysql
start program = "/etc/init.d/mysqld start"
stop program = …
Run Code Online (Sandbox Code Playgroud)

centos monit

0
推荐指数
1
解决办法
3038
查看次数

标签 统计

monit ×6

monitoring ×3

centos ×2

centos6 ×1

mkdir ×1

php-fpm ×1

pid ×1

postfix ×1