问题原文
原帖链接 · Matheus Portela · CC BY-SA 3.0
I'm using JMX to monitor an Apache Kafka cluster with collectd's GenericJMX plugin. However, I'm not sure what some of the MBean parameters mean.
Particularly, I have one metric called kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec, showing the number of messages per second received by one machine. This is my configuration file for this MBean:
<MBean "kafka-all-messages">
ObjectName "kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec"
InstancePrefix "all"
<Value>
InstancePrefix "kafka-messages-in"
Type "counter"
Table false
Attribute "MeanRate"
</Value>
</MBean>
I don't know which Type is the correct one for this measurement, such as gauge, counter or another one. I've tried reading this documentation on collectd by couldn't really understand where I should apply each measurement type.
Could someone explain me it?
已采纳解答
原帖链接 · Matheus Portela · CC BY-SA 4.0
I finally manage to get it working. Pretty much all Kafka metrics in JMX have multiple attributes. For instance, this kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec contains the following attributes:
CountEventTypeFifteenMinuteRateFiveMinuteRateMeanRateOneMinuteRateRateUnit
When selecting the Type, you must choose whether you want it to retrieve the value as is or its difference for the interval collectd is configured to report metrics. Hence, gauge is the value and counter is the difference.
The most flexible way to report Kafka's JMX metrics is to simply use the Count attribute, a monotonically increasing counter that is incremented whenever a new message arrives, and report it as a counter. If collectd is configured to report every 60 seconds, this will be the number of messages coming in per minute. If it is reporting every 10 minutes, the value will be the number of messages per 10 minutes.
<MBean "kafka-all-messages">
ObjectName "kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec"
InstancePrefix "all"
<Value>
InstancePrefix "kafka-messages-in"
Type "counter"
Table false
Attribute "Count"
</Value>
</MBean>
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
