【发布时间】:2015-04-08 14:03:25
【问题描述】:
我正在尝试使用 monit 管理服务器上的内容。我想做的是在 3 个不同的端口上运行 3 个不同的 gunicorn 服务器。
目前我可以一次运行所有服务器,例如在屏幕中。我可以通过命令启动服务器:
gunicorn -c app1.http_server.config app1.http_server.server:app
gunicorn -c app2.http_server.config app2.http_server.server:app
gunicorn -c app3.http_server.config app3.http_server.server:app
根据我对 monit 工作原理的了解,我应该在 monitrc 文件中指定所有内容,例如:
#set mailserver localhost
#set alert myemail@gmail.com
check process app1 with pidfile /var/run/app1.pid
start program = "gunicorn -c app1.http_server.config app1.http_server.server:app"
stop program = "???"
if failed unixsocket ??? then start
if cpu > 50% for 5 cycles then alert
# TODO app2, app3
check system resources
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
check filesystem rootfs with path /
if space usage > 80% then alert
我尝试使用各种东西来停止程序字段并启动程序,但 monit 无法启动 gunicorn 服务器。所以我的问题是如何从监视器运行和停止 gunicorn 服务器?当我启动它时,gunicorn 的 unixsocket 会是什么?谁能提供一些可以帮助我进行设置的示例?
【问题讨论】:
标签: python flask gunicorn monit