Skip to content

配置指标

Ignite 的指标管理通过命令行工具来操作。

1.列出指标源

可以列出一个节点或整个集群的所有可用指标源:

shell
node metric source list
cluster metric source list

2.列出指标

可以列出节点的所有指标。

提示

要查看指标列表,需要先启用相关指标源,具体请参见下面的启用指标源

shell
node metric list

上述命令返回与其导出器对应的所有可用指标的列表。

3.启用指标源

指标收集可能会影响程序的性能,因此所有指标源默认都处于禁用状态。

指标源的启用方式:

  • 节点范围:可以使用参数来指定要与之交互的节点,-u可以指定节点的 URL,-n参数可以指定节点名;
  • 集群范围

例如:

shell
node metric source enable -n=defaultNode jvm
cluster metric source enable jvm

4.禁用指标源

指标源的禁用方式:

  • 节点范围:可以使用参数来指定要与之交互的节点,-u可以指定节点的 URL,-n参数可以指定节点名;
  • 集群范围

例如:

shell
node metric source disable -n=defaultNode jvm
cluster metric source disable jvm

5.配置指标导出器

要使用外部工具访问收集的指标,需要配置指标导出器。

5.1.JMX

JMX 导出器以 JMX(Java 管理扩展)格式提供有关 Ignite 节点的信息,启用该导出器后,节点会向监控工具暴露指标。

JMX 导出器的启用方式:

shell
cluster config update ignite.metrics.exporters.myJmxExporter.exporterName=jmx

之后 JMX 监控工具将能够从指定节点收集已启用的指标: JMX

5.2.OpenTelemetry

OpenTelemetry 导出器会接入节点提供的 OpenTelemetry 服务,并向其发送集群信息,每个节点独立发送指标,并且需要访问指定的端点。

以下示例显示了基本的 OpenTelemetry 配置,由于 OpenTelemetry 服务需要不同的 URL 格式,并且可能需要头信息,因此此示例可能不适用于具体的环境。

shell
cluster config update ignite.metrics.exporters.test: {exporterName:otlp, endpoint:"http://localhost:9090/api/v1/otlp/v1/metrics", protocol:"http/protobuf"}

此命令创建的 OpenTelemetry 导出器将如下所示:

{
        compression=gzip
        endpoint="http://localhost:9090/api/v1/otlp/v1/metrics"
        exporterName=otlp
        headers=[]
        name=test
        period=30000
        protocol="http/protobuf"
        ssl {
            ciphers=""
            clientAuth=none
            enabled=false
            keyStore {
                password="********"
                path=""
                type=PKCS12
            }
            trustStore {
                password="********"
                path=""
                type=PKCS12
            }
        }
    },

以下是配置参数的说明:

参数描述默认值
compression对内容的压缩方式,可选值:nonegzipgzip
endpointOpenTelemetry 端点,每个节点单独解析端点。
exporterName导出器名称,必须为 otlp 以使用 OpenTelemetry
headers请求头信息(如果有)。
name用户定义的导出器名,用于在 Ignite 中引用。
period指标的导出间隔(毫秒)。30000
protocol用于发送 Opentelemetry 数据的协议,可选值: grpchttp/protobufgrpc
ssl.ciphers要启用的密码列表,以逗号分隔,为空表示自动选择密码。
ssl.clientAuth是否启用 SSL 客户端身份验证以及是否为强制性身份验证。
ssl.enabled是否启用 SSL。false
ssl.keyStore.passwordSSL 密钥库密码。
ssl.keyStore.pathSSL 密钥库的路径。
ssl.keyStore.type密钥库类型。PKCS12
ssl.trustStore.password信任库密码。
ssl.trustStore.path信任库的路径。
ssl.trustStore.type信任库类型。PKCS12

5.2.1.与 Grafana 的集成

连接到 Grafana Cloud 时,需要使用 protobuf 协议,并在配置中传递认证的头信息:

shell
cluster config update ignite.metrics.exporters.test: {exporterName:otlp, endpoint:"https://otlp-gateway-prod-eu-west-2.grafana.net/otlp", protocol:"http/protobuf", headers {Authorization.header="Basic myBasicAuthKey"}}

5.2.2.与 Prometheus 的集成

连接 Prometheus 时,需要使用 protobuf 协议,并在启用 otlp 指标接收器后将指标发送到/api/v1/otlp/v1/metrics ,具体请参见 Prometheus 文档

shell
cluster config update ignite.metrics.exporters.test: {exporterName:otlp, endpoint:"http://localhost:9090/api/v1/otlp/v1/metrics", protocol:"http/protobuf"}

18624049226