json Kafka Jmxtrans配置示例

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了json Kafka Jmxtrans配置示例相关的知识,希望对你有一定的参考价值。

{
  "servers" : [
    {
      "queries" : [
        {
          "resultAlias" : "jvmMemory",
          "obj" : "java.lang:type=Memory",
          "attr" : [
            "HeapMemoryUsage",
            "NonHeapMemoryUsage"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "cmsOldGen",
          "obj" : "java.lang:name=CMS Old Gen,type=MemoryPool",
          "attr" : [
            "Usage"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "collectionCount",
          "obj" : "java.lang:type=GarbageCollector,name=*",
          "attr" : [
            "CollectionCount"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "collectionTime",
          "obj" : "java.lang:type=GarbageCollector,name=*",
          "attr" : [
            "CollectionTime"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "memoryPool",
          "obj" : "java.lang:type=MemoryPool,name=*",
          "attr" : [
            "Usage"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "daemonThreadCount",
          "obj" : "java.lang:type=Threading",
          "attr" : [
            "DaemonThreadCount"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "peakThreadCount",
          "obj" : "java.lang:type=Threading",
          "attr" : [
            "PeakThreadCount"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "threadCount",
          "obj" : "java.lang:type=Threading",
          "attr" : [
            "ThreadCount"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "totalStartThreadCount",
          "obj" : "java.lang:type=Threading",
          "attr" : [
            "TotalStartedThreadCount"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "TotalFetchRequestsPerSec",
          "obj" : "kafka.server:type=BrokerTopicMetrics,name=TotalFetchRequestsPerSec",
          "attr" : [
            "Count",
            "FiveMinuteRate",
            "EventType",
            "RateUnit",
            "MeanRate",
            "OneMinuteRate",
            "FifteenMinuteRate"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "IsrExpandsPerSec",
          "obj" : "kafka.server:type=ReplicaManager,name=IsrExpandsPerSec",
          "attr" : [
            "Count",
            "FiveMinuteRate",
            "EventType",
            "RateUnit",
            "MeanRate",
            "OneMinuteRate",
            "FifteenMinuteRate"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "TotalProduceRequestsPerSec",
          "obj" : "kafka.server:type=BrokerTopicMetrics,name=TotalProduceRequestsPerSec",
          "attr" : [
            "Count",
            "FiveMinuteRate",
            "EventType",
            "RateUnit",
            "MeanRate",
            "OneMinuteRate",
            "FifteenMinuteRate"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "MessagesInPerSec",
          "obj" : "kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec",
          "attr" : [
            "Count",
            "FiveMinuteRate",
            "EventType",
            "RateUnit",
            "MeanRate",
            "OneMinuteRate",
            "FifteenMinuteRate"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "RequestHandlerAvgIdlePercent",
          "obj" : "kafka.server:type=KafkaRequestHandlerPool,name=RequestHandlerAvgIdlePercent",
          "attr" : [
            "Count",
            "FiveMinuteRate",
            "EventType",
            "RateUnit",
            "MeanRate",
            "OneMinuteRate",
            "FifteenMinuteRate"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "IsrShrinksPerSec",
          "obj" : "kafka.server:type=ReplicaManager,name=IsrShrinksPerSec",
          "attr" : [
            "Count",
            "FiveMinuteRate",
            "EventType",
            "RateUnit",
            "MeanRate",
            "OneMinuteRate",
            "FifteenMinuteRate"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "BytesOutPerSec",
          "obj" : "kafka.server:type=BrokerTopicMetrics,name=BytesOutPerSec",
          "attr" : [
            "Count",
            "FiveMinuteRate",
            "EventType",
            "RateUnit",
            "MeanRate",
            "OneMinuteRate",
            "FifteenMinuteRate"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "FailedProduceRequestsPerSec",
          "obj" : "kafka.server:type=BrokerTopicMetrics,name=FailedProduceRequestsPerSec",
          "attr" : [
            "Count",
            "FiveMinuteRate",
            "EventType",
            "RateUnit",
            "MeanRate",
            "OneMinuteRate",
            "FifteenMinuteRate"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "BytesInPerSec",
          "obj" : "kafka.server:type=BrokerTopicMetrics,name=BytesInPerSec",
          "attr" : [
            "Count",
            "FiveMinuteRate",
            "EventType",
            "RateUnit",
            "MeanRate",
            "OneMinuteRate",
            "FifteenMinuteRate"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "BrokerState",
          "obj" : "kafka.server:type=KafkaServer,name=BrokerState",
          "attr" : [
            "Value"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "BytesRejectedPerSec",
          "obj" : "kafka.server:type=BrokerTopicMetrics,name=BytesRejectedPerSec",
          "attr" : [
            "Count",
            "FiveMinuteRate",
            "EventType",
            "RateUnit",
            "MeanRate",
            "OneMinuteRate",
            "FifteenMinuteRate"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "LeaderCount",
          "obj" : "kafka.server:type=ReplicaManager,name=LeaderCount",
          "attr" : [
            "Value"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        },
        {
          "resultAlias" : "FailedFetchRequestsPerSec",
          "obj" : "kafka.server:type=BrokerTopicMetrics,name=FailedFetchRequestsPerSec",
          "attr" : [
            "Count",
            "FiveMinuteRate",
            "EventType",
            "RateUnit",
            "MeanRate",
            "OneMinuteRate",
            "FifteenMinuteRate"
          ],
          "outputWriters" : [
            {
              "username" : "root",
              "password" : "root",
              "resultTags" : [
                "typeName",
                "attributeName"
              ],
              "url" : "http:\/\/192.168.1.158:8086\/",
              "database" : "jvm",
              "@class" : "com.googlecode.jmxtrans.model.output.InfluxDbWriterFactory"
            }
          ]
        }
      ],
      "host" : "192.168.30.10",
      "port" : "9999"
    }
  ]
}

以上是关于json Kafka Jmxtrans配置示例的主要内容,如果未能解决你的问题,请参考以下文章

kafka监控实战(jmxtrans+InfluxDb+Grafana)

json Jmxtrans.json

jmxtrans+InfluxDb+Grafana

Kafka监控方案对比

Centos搭建Jmxtrans服务

docker 配置 kafka+zookeeper,golang接入示例