前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >kafka-exporter如何区分不同ns空间的告警?

kafka-exporter如何区分不同ns空间的告警?

原创
作者头像
不学会go不打王者
发布2022-07-14 12:30:34
5770
发布2022-07-14 12:30:34
举报
文章被收录于专栏:prometheus问题prometheus问题

apiVersion: monitoring.coreos.com/v1

kind: ServiceMonitor

metadata:

name: kafka-exporte

labels:

prometheus: kube-prometheus

app: kafka-exporte

namespace: monitoring

spec:

endpoints:

- port: metrics

interval: 30s

scrapeTimeout: 30s

path: /metrics

namespaceSelector:

any: true

#namespaceSelector:

# matchNames:

# - kafka

selector:

matchLabels:

app: kafka-exporte

targetLabels:

- ns

已经加了ns = xxx 的标签
已经加了ns = xxx 的标签

kafka-rule.yaml

apiVersion: monitoring.coreos.com/v1

kind: PrometheusRule

metadata:

name: kafka-rules

namespace: monitoring

labels:

prometheus: k8s

role: alert-rules

spec:

groups:

- name: kafka.rules

rules:

- alert: KafkaTopicsReplicas

expr: sum(kafka_topic_partition_in_sync_replica) by (topic) < 1

for: 5m

labels:

severity: critical

annotations:

summary: Kafka topics replicas (instance {{ $labels.instance }})

description: "Kafka topic in-sync partition\n VALUE = {{ $value }}\n LABELS = {{ $labels }}\n NS = {{ $labels.ns }}"

- alert: KafkaConsumersGroup

expr: sum(kafka_consumergroup_lag) by (consumergroup) > 100000

for: 1m

labels:

severity: critical

annotations:

summary: Kafka consumers group (instance {{ $labels.instance }})

description: "Kafka consumers group\n VALUE = {{ $value }}\n LABELS = {{ $labels }}\n NS = {{ $labels.ns }}"

- alert: Kafka InstanceDown

expr: sum(kafka_brokers) < 2

for: 15s

labels:

severity: critical

annotations:

summary: "Instance {{ $labels.instance }}"

description: "kafka of cluster has been down for more than 15 second\n VALUE = {{ $value }}\n LABELS = {{ $labels }}\n NS = {{ $labels.ns }}"

告警信息如下:但告警无法区分是哪个NS的kafa,请问如何解决?

告警类型: KafkaConsumersGroup

告警级别: critical

告警详情: Kafka consumers group

VALUE = 6969

LABELS = map[consumergroup:logstash]

NS = ;Kafka consumers group (instance )

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档