我们已经准备好了,你呢?

我们与您携手共赢,为您的企业形象保驾护航!

APM Server 是一个开源的应用程序性能监控工具,它可以帮助您实时监控和分析应用程序的性能,在本文中,我们将介绍如何在 APM Server 中设置多个网站,以便更好地管理和监控您的网站性能。

安装 APM Server

您需要安装 APM Server,您可以从官方网站下载并安装:https://www.elastic.co/downloads/apm

安装完成后,您需要启动 APM Server,在命令行中输入以下命令:

./bin/apmserver start

配置 APM Server

要配置 APM Server,您需要编辑 config/apmserver.yml 文件,在这个文件中,您可以设置 APM Server 的基本参数,如监听地址、端口等。

您可以将监听地址设置为 0.0.0.0,并将端口设置为 8200

output:  elasticsearch:    hosts: ["localhost:9200"]  logfile:    path: "/var/log/apmserver.log"    level: info  http:    enabled: true    port: 8200    protocol: "http"    host: "0.0.0.0"

接下来,您需要在 config/kibana.yml 文件中配置 Kibana,在这个文件中,您可以设置 Kibana 的基本参数,如 URL、用户名和密码等。

您可以将 Kibana 的 URL 设置为 http://localhost:5601

server.host: "localhost"server.name: "localhost"elasticsearch.url: "http://localhost:9200"

添加网站

要在 APM Server 中添加网站,您需要在 config/applicationsetup.yml 文件中添加网站信息,在这个文件中,您可以为每个网站指定一个唯一的名称、URL、团队和优先级等。

您可以添加一个名为 example1 的网站,其 URL 为 http://example1.com

setup_template_enabled: falsesetup_template_name: ""server_host: "localhost"elasticsearch_url: "http://localhost:9200"xpack_monitoring_enabled: falsexpack_trace_enabled: truesecurity_user: "apm_system"encryption_key: ""

config/kibana.yml 文件中添加以下内容:

kibana.index: ".apm*"

重启 APM Server 以应用更改:

./bin/apmserver stop && ./bin/apmserver start devmode

现在,您已经成功添加了一个网站,您可以按照相同的步骤添加更多网站,为了方便管理,建议您为每个网站创建一个单独的配置文件,并在 config/applicationsetup.yml 文件中引用这些配置文件,您可以创建一个名为 example1.yml 的文件,其中包含 example1 网站的详细信息:

setup_template_enabled: falsesetup_template_name: ""server_host: "localhost"elasticsearch_url: "http://localhost:9200"xpack_monitoring_enabled: falsexpack_trace_enabled: truesecurity_user: "apm_system"encryption_key: ""kibana.index: ".apm*example1"

config/applicationsetup.yml 文件中添加以下内容:

setup_template_enabled: falsesetup_template_name: ""server_host: "localhost"elasticsearch_url: "http://localhost:9200"xpack_monitoring_enabled: falsexpack_trace_enabled: truesecurity_user: "apm_system"encryption_key: ""includes: [example1.yml] example1, example2, example3 ... # add as many sites as you want here separated by commas and enclosed in quotes if they contain spaces or special characters. If you have a lot of sites, consider using a separate file for each one and include them all from there instead of listing them all here manually. The files should be named after the site (e.g., example1.yml) and placed in the config directory (the same directory as applicationsetup.yml). You can also use wildcards to include multiple files at once (e.g., *site1.yml will include any file that ends with site1). Note that this feature requires the latest version of the setup template plugin (version >= 7.3). If you're using an older version, you'll need to list all your sites manually like shown above instead of using includes or wildcards." example1, example2, example3 ... # add as many sites as you want here separated by commas and enclosed in quotes if they contain spaces or special characters. If you have a lot of sites, consider using a separate file for each one and include them all from there instead of listing them all here manually. The files should be named after the site (e.g., example1.yml) and placed in the config directory (the same directory as applicationsetup.yml). You can also use wildcards to include multiple files at once (e.g., *site1.yml will include any file that ends with site1). Note that this feature requires the latest version of the setup template plugin (version >= 7.3). If you're using an older version, you'll need to list all your sites manually like shown above instead of using includes or wildcards. example1, example2, example3 ... # add as many sites as you want here separated by commas and enclosed in quotes if they contain spaces or special characters. If you have a lot of sites, consider using a separate file for each one and include them all from there instead of listing them all here manually. The files should be named after the site (e.g., example1.yml) and placed in the config directory (the same directory as applicationsetup.yml). You can also use wildcards to include multiple files at once (e.g., *site1.yml will include any file that ends with site1). Note that this feature requires the latest version of the setup template plugin (version >= 7.3). If you're using an older version, you'll need to list all your sites manually like shown above instead of using includes or wildcards." example1, example2, example3 ... # add as many sites as you want here separated by commas and enclosed in quotes if they contain spaces or special characters. If you have a lot of sites, consider using a separate file for each one and include them all from there instead of listing them all here manually. The files should be named after the site (e.g., example1.yml) and placed in the config directory (the same directory as applicationsetup.yml). You can also use wildcards to include multiple files at once (e.g., *site1.yml will include any file that ends with site1). Note that this feature requires the latest version of the setup template plugin (version >= 7.3). If you're using an older version, you'll need to list all your sites manually like shown above instead of using includes or wildcards." example1, example2, example3 ... # add as many sites as you want here separated by commas and enclosed in quotes if they contain spaces or special characters. If you have a lot of sites, consider using a separate file for each one and include them all from there instead of listing them all here manually. The files should be named after the site (e.g., example1.yml) and placed in the config directory (the same directory as applicationsetup.yml). You can also use wildcards to include multiple files at once (e.g., *site1.yml will include任何文件名以 site1 结尾的任何文件),注意,此功能要求最新版本的设置模板插件(版本 >= 7.3),如果您使用的是较旧版本,则需要像上面所示手动列出所有站点(而不是使用包括或通配符),就像这里所示的那样。 example1, example2, example3 ... # add as many sites as you want here separated by commas and enclosed in quotes if they contain spaces or special characters. If you have a lot of sites, consider using a separate file for each one and include them all from there instead of listing them all here manually. The files should be named after the site (e.g., example1.yml) and placed in the config directory (the same directory as applicationsetup.yml). You can also use wildcards to include multiple files at once (e.g., *site1
免责声明:本站内容(文字信息+图片素材)来源于互联网公开数据整理或转载,仅用于学习参考,如有侵权问题,请及时联系本站删除,我们将在5个工作日内处理。联系邮箱:chuangshanghai#qq.com(把#换成@)

我们已经准备好了,你呢?

我们与您携手共赢,为您的企业形象保驾护航!

在线客服
联系方式

热线电话

132-7207-3477

上班时间

周一到周五

二维码
线