APM Server 信息 API
APM Server 公开了一个用于查询常规服务器信息的 API 端点。此轻量级端点可用作服务器运行状态的健康检查。
这是服务器信息端点
http(s)://{hostname}:{port}/
向服务器信息端点发送 HTTP GET 请求将返回 HTTP 200,表明服务器正在运行。
要配置对 APM Server 的身份验证访问,必须遵循 APM API 密钥 或 APM 密钥令牌 中的说明,以配置正确的 APM 访问权限。
如果在 HTTP GET 请求中一并传递了 API 密钥 或 密钥令牌,除了 HTTP 200 外,响应载荷还将包含一些关于 APM Server 的信息。
使用 GET 请求 APM Server 状态的示例(不含凭据)
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 Server 信息的示例,带有 密钥令牌
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"
}