帮助手册

在 Docker 容器中安装 S247DataExporter 和 Python Agent(同一容器)

注意

在开始安装之前,请参阅此 知识库文章,了解前提条件、配置步骤和备选安装方式的详细信息。

按照以下步骤在 Docker 容器中安装 S247DataExporter 和 Python Agent:

  1. Dockerfile 中安装 APM Insight Python 包,并通过 APM_APP_NAME 环境变量设置 Python 应用程序名称。
  2. Dockerfile 中添加带有安装参数的 S247DataExporter 安装命令。
  3. entrypoint 脚本文件中,通过将命令作为参数传递给 apminsight-run 命令来启动 S247DataExporter 和您的 Python 应用程序。

Dockerfile 示例

FROM python:3.9
#
# Your code
#
# Prerequisite (ignore if already installed)
RUN apt-get update && apt-get install -y wget unzip procps curl
# Set your license key and appplication name to be shown in site24x7 apm client
ENV S247_LICENSE_KEY="license-key"
ENV APM_APP_NAME="Python-Application"

# installing the Python agent pip3 install -U apminsight
# installing the S247DataExporter (This is mandatory for the Python agent to work)
RUN wget -O InstallDataExporter.sh https://staticdownloads.site24x7.com/apminsight/S247DataExporter/linux/InstallDataExporter.sh
RUN sh InstallDataExporter.sh -root -nsvc
# Entrypoint script
COPY ./example-entrypoint.sh /example-entrypoint.sh
ENTRYPOINT [ "sh","/example-entrypoint.sh" ]

入口脚本示例

#!/bin/sh
# Start S247DataExporter
sh /opt/S247DataExporter/bin/service.sh start
# Pass your application start command to the apminsight-run script
apminsight-run <user application execute command> 
注意

 

默认情况下,Python 应用程序分别使用 2002120022 作为状态端口和数据端口。如果您需要修改这些端口,可以使用以下键通过环境变量设置:

  • 状态端口 - AGENT_STATUS_PORT
  • 数据端口 - AGENT_DATA_PORT

 

如何在 Docker 容器中安装各种 APM Insight Agent
Java | .NET | PHP | Node.js

如何在 Kubernetes 环境中安装各种 APM Insight Agent
Java | .NET | PHP | Node.js | Python

本文档对您有帮助吗?

您愿意帮助我们改进文档吗?请告诉我们哪些方面可以做得更好。


很抱歉本文档未能让您满意。我们希望了解可以从哪些方面改进您的体验。


感谢您抽出时间分享反馈。我们将利用您的反馈来改进在线帮助资源。

短链接已复制!