newrelic python代理issu

2024-04-25 06:41:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我有3个独立的python应用程序在python Virtual env中,在同一个服务器中的mog_gwsgi模式。我在第一个应用程序python虚拟环境中安装了newrelic,它在newrelic GUI页面上显示得很好。在

当我跟随并在各自的python虚拟环境中为第二个和第三个应用程序安装相同的东西时。但这两个应用程序并没有显示在Newrelic GUI应用程序页面中。在

对于所有3个应用程序,日志文件从一开始就没有更新。在

请帮助我配置和集成多个python应用程序,这些应用程序托管在一个服务器python env中。在

以下是我遵循的步骤。在

centos公司

在apps virtual env中安装New Relic Python代理

source <virtual path>
pip install newrelic
pip freeze

生成配置文件:

^{pr2}$

验证conf文件:

newrelic-admin validate-config newrelic.ini

配置conf文件中的变量

logfile = log file name
loglevel=info
app_name = name

将appliactions mod\wsgi文件与NewRelic集成:

在下面添加wsgi.py文件

vi wsgi.py
import newrelic.agent
newrelic.agent.initialize('/etc/newrelic/newrelic.ini')

安装的newrelic版本为“newrelic==2.12.0.10”

请帮帮我。在

谢谢你, subhani466@gmail.com在


Tags: pip文件namepy服务器env应用程序wsgi
2条回答

我知道您不久前发布了这篇文章,但是我发现的解决方案是在虚拟环境之外安装newrelic pip install newrelic。在

任何面临这个问题的人只需在虚拟环境之外安装newrelic。在

我对你的安排有点不清楚。如果三个Python应用程序都在同一个虚拟环境中,并且使用newrelic.ini文件对于这三个应用程序,则所有三个应用程序都将报告给同一个UI列表。您需要以不同的方式命名配置文件(newrelic.ini文件,并以同样的方式引用它们,或者将应用程序拆分为单独的虚拟环境。在

至于没有写入的日志文件,听起来你对该目录没有用户权限。您可以在newrelic文档中阅读更多信息,这里:https://docs.newrelic.com/docs/python/python-agent-logging

The path provided for 'log_file' should be writable to the user that your application runs as. If using Apache/mod_wsgi that would usually be the Apache user which has restricted access to the filesystem. You might therefore need to create a special directory into which the log file can be placed which is writable to the Apache user. Because the current working directory of an application could be anything, it is recommended that an absolute path and not a relative path be used.

如果您需要更多帮助,请在http://support.newrelic.com与我们一起开罚单

相关问题 更多 >