# RocketMQ Grafana Dashboard JSON

{
  "dashboard": {
    "title": "RocketMQ 监控面板",
    "uid": "rocketmq-overview",
    "tags": ["rocketmq", "messaging"],
    "timezone": "browser",
    "panels": [
      {
        "id": 1,
        "title": "NameServer 状态",
        "type": "stat",
        "gridPos": {"x": 0, "y": 0, "w": 6, "h": 4},
        "targets": [
          {
            "expr": "up{job=\"rocketmq-namesrv\"}",
            "legendFormat": "{{instance}}"
          }
        ]
      },
      {
        "id": 2,
        "title": "Broker 状态",
        "type": "stat",
        "gridPos": {"x": 6, "y": 0, "w": 6, "h": 4},
        "targets": [
          {
            "expr": "up{job=\"rocketmq-broker\"}",
            "legendFormat": "{{instance}}"
          }
        ]
      },
      {
        "id": 3,
        "title": "生产者 TPS",
        "type": "graph",
        "gridPos": {"x": 0, "y": 4, "w": 12, "h": 8},
        "targets": [
          {
            "expr": "rate(rocketmq_producer_tps[5m])",
            "legendFormat": "{{topic}}"
          }
        ]
      },
      {
        "id": 4,
        "title": "消费者 TPS",
        "type": "graph",
        "gridPos": {"x": 12, "y": 4, "w": 12, "h": 8},
        "targets": [
          {
            "expr": "rate(rocketmq_consumer_tps[5m])",
            "legendFormat": "{{group}}-{{topic}}"
          }
        ]
      },
      {
        "id": 5,
        "title": "消费堆积量",
        "type": "graph",
        "gridPos": {"x": 0, "y": 12, "w": 12, "h": 8},
        "targets": [
          {
            "expr": "rocketmq_consumer_lag",
            "legendFormat": "{{group}}-{{topic}}"
          }
        ]
      },
      {
        "id": 6,
        "title": "发送失败率",
        "type": "graph",
        "gridPos": {"x": 12, "y": 12, "w": 12, "h": 8},
        "targets": [
          {
            "expr": "rate(rocketmq_producer_send_failed_total[5m])",
            "legendFormat": "{{instance}}"
          }
        ]
      }
    ],
    "refresh": "10s",
    "time": {
      "from": "now-1h",
      "to": "now"
    }
  }
}
