

参数 | 说明 |
名称 | 集成名称,命名规范如下: 名称具有唯一性。 名称需要符合下面的正则:'^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$'。 |
地址 | 填写 Kafka Broker 的连接地址。 |
Kafka 版本 | 选填,部分特定版本必填,例如 0.10.2.0。 |
标签 | 给指标添加自定义 Label。 |
抓取间隔 | 数据抓取间隔,填写示例:60s、1m30s、5m、1h30m。 |
抓取超时 | 抓取超时必须小于等于抓取间隔。填写方式同抓取间隔。 |
topic 过滤正则 | 选填,不填默认采集全部的 topic。填写后只会采集符合正则的 topic。 |
group 过滤正则 | 选填,不填默认采集全部的 group。填写后只会采集符合正则的 group。 |
apiVersion: apps/v1kind: Deploymentmetadata:labels:k8s-app: kafka-exporter # 根据业务需要调整成对应的名称,建议加上 Kafka 实例的信息, 如 ckafka-2vrgx9fd-kafka-exportername: kafak-exporter # 根据业务需要调整成对应的名称,建议加上 Kafka 实例的信息, 如 ckafka-2vrgx9fd-kafka-exporternamespace: kafka-demo # 集群的 namespace,exporter 会部署在该 namespace 下spec:replicas: 1selector:matchLabels:k8s-app: kafka-exporter # 根据业务需要调整成对应的名称,建议加上 Kafka 实例的信息, 如 ckafka-2vrgx9fd-kafka-exportertemplate:metadata:labels:k8s-app: kafka-exporter # 根据业务需要调整成对应的名称,建议加上 Kafka 实例的信息, 如 ckafka-2vrgx9fd-kafka-exporterspec:containers:- args:- --kafka.server=x.x.x.x:9092 # 对应 Kafka 实例的地址信息image: ccr.ccs.tencentyun.com/rig-agent/kafka-exporter:v1.3.0imagePullPolicy: IfNotPresentname: kafka-exporterports:- containerPort: 9308name: metric-port # 这个名称在配置抓取任务的时候需要securityContext:privileged: falseterminationMessagePath: /dev/termination-logterminationMessagePolicy: FilednsPolicy: ClusterFirstimagePullSecrets:- name: qcloudregistrykeyrestartPolicy: AlwaysschedulerName: default-schedulersecurityContext: {}terminationGracePeriodSeconds: 30
PodMonitors,YAML 配置示例如下:apiVersion: monitoring.coreos.com/v1kind: PodMonitormetadata:name: kafka-exporter # 填写一个唯一名称namespace: cm-prometheus # 按量实例: 集群的 namespace; 包年包月实例(已停止售卖): namespace 固定,不要修改spec:podMetricsEndpoints:- interval: 30s # 采集间隔port: metric-port # 填写步骤一 yaml 中的 spec.template.spec.containers[0].ports[0].namepath: /metrics # Exporter 的指标采集路径,默认填 /metricsrelabelings:- action: replacesourceLabels:- instanceregex: (.*)targetLabel: instancereplacement: 'ckafka-xxxxxx' # 调整成对应的 Kafka 实例 ID- action: replacesourceLabels:- instanceregex: (.*)targetLabel: ipreplacement: '1.x.x.x' # 调整成对应的 Kafka 实例 IPnamespaceSelector:matchNames:- kafka-demo # 填写 Exporter 所在的 namespaceselector: # 填写要监控 pod 的 Label 值,以定位目标 podmatchLabels:k8s-app: kafka-exporter
Exporter 和 Kafka 部署在不同的服务器上,因此建议通过 Prometheus Relabel 机制将 Kafka 实例的信息放到监控指标中,以便定位问题。

文档反馈