APM Server 信息 API
Elastic Stack
APM Server 公开了一个 API 端点来查询常规服务器信息。 这个轻量级的端点可用作服务器启动/关闭的运行状况检查。
这是服务器信息端点
http(s)://{hostname}:{port}/
向服务器信息端点发送一个 HTTP GET
请求将会返回 HTTP 200,表明服务器已启动。
要配置对 APM 服务器的身份验证访问,必须按照APM API 密钥或APM 密钥令牌中的说明,为 APM 访问配置正确的权限。
如果将API 密钥或密钥令牌与 HTTP GET
请求一起传递,除了 HTTP 200 之外,响应负载还将包含一些关于 APM 服务器的信息。
使用 GET 的 APM 服务器状态请求示例,无凭据
curl --verbose -X GET http://127.0.0.1:8200
* Trying 127.0.0.1:8200...
* TCP_NODELAY set
* Connected to 127.0.0.1 (10.244.3.40) port 8200 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1:8200
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< X-Content-Type-Options: nosniff
< Date: Tue, 17 Oct 2023 22:04:05 GMT
< Content-Length: 0
<
* Connection #0 to host 127.0.0.1 left intact
使用 GET 的 APM 服务器信息请求示例,带密钥令牌
curl -X GET http://127.0.0.1:8200/ \
-H "Authorization: Bearer secret_token"
{
"build_date": "2021-12-18T19:59:06Z",
"build_sha": "24fe620eeff5a19e2133c940c7e5ce1ceddb1445",
"publish_ready": true,
"version": "9.0.0"
}