VPS: DigitalOcean 放大: v0.43 Nginx: v1.13.0 PHP-FPM: v7.0.19 操作系统: CentOS7
我正在尝试在php-fpm-metrics报告工具中启用Nginx-Amplify。它适用于几分钟,然后在服务重启后在/var/log/amplify-agent/agent.log
中出错
agent.conf(相关部分):
[credentials]
api_key = ******************
hostname =
uuid = *******************
imagename =
[nginx]
user = nginx
stub_status = /nginx_status
[extensions]
phpfpm = True
agent.log(错误):
2017-05-30 21:30:48,374 [21034] supervisor running /usr/sbin/nginx -t -c /etc/nginx/nginx.conf
2017-05-30 21:31:18,079 [21034] supervisor failed to find php-fpm bin path, last attempt: "ls -la /proc/24400/exe" failed due to AmplifySubprocessError
2017-05-30 20:37:18,394 [9929] supervisor run failed
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/amplify/agent/managers/abstract.py", line 135, in _run
self._start_objects()
File "/usr/lib/python2.7/site-packages/amplify/agent/managers/abstract.py", line 123, in _start_objects
child_obj.start()
File "/usr/lib/python2.7/site-packages/amplify/agent/objects/abstract.py", line 149, in start
context.log.debug('starting object "%s" %s' % (self.type, self.definition_hash))
File "/usr/lib/python2.7/site-packages/amplify/agent/objects/abstract.py", line 84, in definition_hash
definition_string = str(map(lambda x: u'%s:%s' % (x, self.definition[x]), sorted(self.definition.keys())))
File "/usr/lib/python2.7/site-packages/amplify/ext/abstract/object.py", line 47, in definition
return {'type': self.type, 'local_id': self.local_id, 'root_uuid': self.root_uuid}
File "/usr/lib/python2.7/site-packages/amplify/agent/objects/abstract.py", line 115, in local_id
self._local_id = hashlib.sha256('_'.join(self.local_id_args)).hexdigest()
TypeError: sequence item 0: expected string, list found
PHP-FPM /etc/php-fpm.d/www.conf
(相关部分):
[www]
user = nginx
group = nginx
listen = /var/run/php-fpm/php-fpm.sock
listen.backlog = 16383
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 25
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 10
pm.max_requests = 500
pm.status_path = /php_status
Nginx.conf(相关部分):
user nginx nginx;
正如文档中所述,有效:
$ SCRIPT_NAME=/php_status SCRIPT_FILENAME=/php_status QUERY_STRING= REQUEST_METHOD=GET cgi-fcgi -bind -connect /var/run/php-fpm/php-fpm.sock
结果:
X-Powered-By: PHP/7.0.19
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate, max-age=0
Content-type: text/plain;charset=UTF-8
pool: www
process manager: dynamic
start time: 29/May/2017:15:40:29 +0200
start since: 107193
accepted conn: 806252
listen queue: 0
max listen queue: 0
listen queue len: 0
idle processes: 10
active processes: 14
total processes: 24
max active processes: 25
max children reached: 1840
slow requests: 330
我想问题是,重启过程和一段时间后“更改”pid:
supervisor failed to find php-fpm bin path, last attempt: "ls -la /proc/24400/exe" failed due to AmplifySubprocessError
不确定,但pm.max_requests = 500
也许是可以回应的。
答案 0 :(得分:1)
感谢您的报告!
这里有两个影响您系统的问题。首先是我们无法通过bin_path
找到phpfpm
的{{1}}:
ls
这意味着我们的代理正在运行的用户没有访问supervisor failed to find php-fpm bin path, last attempt: "ls -la /proc/24400/exe" failed due to AmplifySubprocessError
主进程或其任何子池的proc
文件系统的权限。此信息纯粹与元相关,不应影响代理程序的运行或其状态页面中phpfpm
指标的集合。我们收集的信息是您phpfpm
,然后我们会在其上运行bin_path
以收集有关您--version
的版本信息,以便显示在您的广告资源中。
也就是说,我们将在本周末(2017年6月16日星期五)或下周初(2017年6月19日星期一)发布新代理phpfpm
,这项工作有很多改进流动,可能会使你受益。
影响系统的第二个问题更严重,可能会影响代理运行时:
0.44
我不能确定您的系统,但是当我们的代理发现孤立的17-05-30 21:31:18,079 [21034] supervisor failed to find php-fpm bin path, last attempt: "ls -la /proc/24400/exe" failed due to AmplifySubprocessError
2017-05-30 20:37:18,394 [9929] supervisor run failed
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/amplify/agent/managers/abstract.py", line 135, in _run
self._start_objects()
File "/usr/lib/python2.7/site-packages/amplify/agent/managers/abstract.py", line 123, in _start_objects
child_obj.start()
File "/usr/lib/python2.7/site-packages/amplify/agent/objects/abstract.py", line 149, in start
context.log.debug('starting object "%s" %s' % (self.type, self.definition_hash))
File "/usr/lib/python2.7/site-packages/amplify/agent/objects/abstract.py", line 84, in definition_hash
definition_string = str(map(lambda x: u'%s:%s' % (x, self.definition[x]), sorted(self.definition.keys())))
File "/usr/lib/python2.7/site-packages/amplify/ext/abstract/object.py", line 47, in definition
return {'type': self.type, 'local_id': self.local_id, 'root_uuid': self.root_uuid}
File "/usr/lib/python2.7/site-packages/amplify/agent/objects/abstract.py", line 115, in local_id
self._local_id = hashlib.sha256('_'.join(self.local_id_args)).hexdigest()
TypeError: sequence item 0: expected string, list found
工作时,其他客户已报告此错误。例如,phpfpm pool
的输出可能是:
ps xao pid,ppid,command | grep 'php-fpm[:]'
我们仍在调查导致这种情况的原因,但是现在我们通过静默处理这种情况使我们的代理更加强大。此修复程序可在我们的代理商版本[
'15923 1 php-fpm: master process (/etc/php-fpm.conf)',
'20704 15923 php-fpm: pool www',
'20925 15923 php-fpm: pool www',
'21350 15923 php-fpm: pool www',
'21385 15923 php-fpm: pool www',
'21386 15923 php-fpm: pool www',
'21575 15923 php-fpm: pool www',
'21699 15923 php-fpm: pool www',
'21734 15923 php-fpm: pool www',
'21735 15923 php-fpm: pool www',
'21781 15923 php-fpm: pool www',
'21782 15923 php-fpm: pool www',
'22287 15923 php-fpm: pool www',
'22330 15923 php-fpm: pool www',
'22331 15923 php-fpm: pool www',
'22495 15923 php-fpm: pool www',
'22654 21386 php-fpm: pool www', # <---- Orphan?
''
]
中找到,该版本应尽快发布,如上所述。
如果您仍然感兴趣,我强烈建议您在发布时下载并安装代理0.44
。如果您仍然在系统上发现问题,请随时通过我们的客户支持渠道与我们联系。
我还建议您考虑检查自己的系统,看看您是否有任何“孤儿”池工人,因为它有可能表明其他问题。但同样,我们的新代理人将适当地抓住并处理这种情况。
我希望这有帮助!
Grant(NGINX Amplify代理商贡献者)