kube-prometheus监控RabbitMQ 指标
本文最后更新于 484 天前,其中的信息可能已经有所发展或是发生改变。

kube-prometheus监控RabbitMQ 指标

方案

通过 Prometheus 找到 Exporter 可以对第三方服务导出为 Prometheus 指标。

也可以使用 RabbitMQ官网方案插件进行监控,本次记录是按照RabbitMQ官网方案进行。

操作步骤

开启 RabbitMQ_Prometheus 插件

如果 rabbitmq_prometheus已经开启可以跳过这一步,执行:rabbitmq-plugins enable rabbitmq_prometheus

查看RabbitMQ Prometheus 指标

具体指标的查看 RabbitMQ 指标 官网详细介绍

http://localhost:15692/metrics

因k8s部署,只开放了15672/5672未对15692开放端口,因此需要对其开放

apiVersion: v1
kind: Service
metadata:
  name: rabbitmq-export-svc
  namespace: tools
  labels:
    type: rabittmq-exporter
spec:
  type: ClusterIP
  ports:
    - name: http-metrics
      protocol: TCP
      port: 15692
      targetPort: 15692
  selector:
    app: rabbitmq-single
    name: rabbitmq-single

配置 Prometheus Service Monitor

rabbitmq-sm.yaml

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  labels:
    app: rabbitmq-sm
  name: rabbitmq-sm
  namespace: monitoring
spec:
  endpoints:
    - port: http-metrics
      interval: 30s
  namespaceSelector:
    any: true
  selector:
    matchLabels:
      type: rabittmq-exporter

查看 Prometheus Status Targets

说明已经成功监听到 RabbitMQ Exporter了。

image-20230922101557024

配置 Grafana Dashboard 页面

参考:https://github.com/rabbitmq/rabbitmq-server/tree/main/deps/rabbitmq_prometheus/docker/grafana/dashboards

或者使用:https://grafana.com/grafana/dashboards/10991-rabbitmq-overview/

告警规则配置

参考:https://www.rabbitmq.com/prometheus.html#detailed-endpoint后续进行细化项告警

rabbitmq-rules.yaml

apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  labels:
    prometheus: k8s
    role: alert-rules
  name: redis-rules
  namespace: monitoring
spec:
  groups:
    - name: RabbitMQAlerts
      rules:
        - alert: RabbitMQTooManyConnections
          expr: rabbitmq_connections > 500
          for: 5m
          labels:
            severity: critical
          annotations:
            summary: "RabbitMQ has too many connections"
            description: "The RabbitMQ server has {{ $value }} connections, which is above the threshold of 500 connections."
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇