Nagios 检查失败:UWSGI 严重:无法连接()工作者操作正在进行中

Nagios 检查失败:UWSGI 严重:无法连接()工作者操作正在进行中

一切似乎都已安装并正常运行(站点/服务器正在运行)但不断出现此错误:

UWSGI CRITICAL: could not connect() to workers Operation now in progress

运行时:

uwsgi --nagios --socket=0.0.0.0:1717

我的 uwsgi.conf (匿名)是:

description "uwsgi instance"
start on runlevel [2345]
stop on runlevel [06]

exec uwsgi --master --die-on-term --ini /etc/uwsgi/apps-enabled/my-app.com

我的 ini 文件是:

[uwsgi]
uid = www-data
gid = www-data
plugins = python

module= wsgi_app
home = /home/django/domains/my-app.com/my-app.com/
pythonpath = /home/django/domains/my-app.com/my-app/uwsgi/
touch-reload = /home/django/domains/my-app.com/my-app/uwsgi/restart.trig
socket = /tmp/my-app.com.socket
logto = /var/log/uwsgi/my-app.com.log
enable-threads = true
single-interpreter = true

listen=4000
threads = 5
workers = 10
master = true
max-requests=1000
buffer-size = 32768
post-buffering = 8192

答案1

所以这是一个简单的对齐插座的问题。因此,不要:

uwsgi --nagios --socket=0.0.0.0:1717

那么我应该是:

uwsgi --nagios --socket=/tmp/my-app.com.socket

但我的问题并没有就此结束。然后我遇到了权限问题。可以通过添加 来解决chmod-socket = 666。但该解决方案的安全性并不完美。相反,您可以将其设置为 664,授予用户 sudoer 权限来运行 uwsgi 命令并运行 nagios 命令,如下所示:

sudo /usr/local/bin/uwsgi --nagios --socket=/tmp/my-app.com.socket

要授予您的用户 sudo 权限,请将其添加到您的 /etc/sudoer 文件中(将用户名更改为正确的用户名):

username ALL=(ALL) NOPASSWD:/usr/local/bin/uwsgi --nagios --socket=/tmp/my-app.com.socket

当我从 aptitude install 转到 pip install 时,我也必须删除plugins = python。并且也listen = 4000必须被删除,因为它超出了我的限制。

所以最后我有这个 uwsgi 设置:

[uwsgi]
uid = www-data
gid = www-data

module = wsgi_app
home = /home/django/domains/my-app.com/my-app.com/
pythonpath = /home/django/domains/my-app.com/my-app/uwsgi/
touch-reload = /home/django/domains/my-app.com/my-app/uwsgi/restart.trig
socket = /tmp/my-app.com.socket
chmod-socket = 664
logto = /var/log/uwsgi/my-app.com.log
enable-threads = true
single-interpreter = true

threads = 5
workers = 10
master = true
max-requests = 1000
buffer-size = 32768
post-buffering = 8192

相关内容