Skip to content

Commit

Permalink
add rocketmq plugin based on rocketmq console (#171)
Browse files Browse the repository at this point in the history
* add rocketmq plugin based on rocketmq console

* refector rocketmq export

* refector to rocketmq_diff

* rename to rocketmq_offset
  • Loading branch information
lsy1990 authored Sep 7, 2022
1 parent 4abd278 commit 2497bff
Show file tree
Hide file tree
Showing 4 changed files with 409 additions and 0 deletions.
1 change: 1 addition & 0 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import (
_ "flashcat.cloud/categraf/inputs/rabbitmq"
_ "flashcat.cloud/categraf/inputs/redis"
_ "flashcat.cloud/categraf/inputs/redis_sentinel"
_ "flashcat.cloud/categraf/inputs/rocketmq_offset"
_ "flashcat.cloud/categraf/inputs/switch_legacy"
_ "flashcat.cloud/categraf/inputs/system"
_ "flashcat.cloud/categraf/inputs/tomcat"
Expand Down
7 changes: 7 additions & 0 deletions conf/input.rocketmq_diff/rocketmq_diff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# # collect interval
# interval = 15

[[instances]]
# rocketmq_console_ip_port=
# ignored_topics=[]

91 changes: 91 additions & 0 deletions inputs/rocketmq_offset/model.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package rocketmq_offset

type TopicListData struct {
TopicList []string `json:"topicList"`
BrokerAddr string `json:"brokerAddr"`
}

type TopicList struct {
Status int `json:"status"`
Data TopicListData `json:"data"`
ErrMsg string `json:"errMsg"`
}

//(2).get consumerList by topic

type ConsumerListByTopic struct {
Status int `json:"status"`
ErrMsg string `json:"errMsg"`
Data map[string]TopicGroup `json:"data"`
}

type TopicGroup struct {
Topic string `json:"topic"`
DiffTotal int `json:"diffTotal"`
LastTimestamp int64 `json:"lastTimestamp"`
QueueStatInfoList []QueueStatInfoList `json:"queueStatInfoList"`
}

type QueueStatInfoList struct {
BrokerName string `json:"brokerName"`
QueueId int `json:"queueId"`
BrokerOffset int64 `json:"brokerOffset"`
ConsumerOffset int64 `json:"consumerOffset"`
ClientInfo string `json:"clientInfo"`
LastTimestamp int64 `json:"lasttimestamp"`
}

//(3).mode for prometheus metrics

type MsgDiff struct {
MsgDiffDetails []*MsgDiffDetail `json:"msg_diff_details"`
MsgDiffTopics map[string]*MsgDiffTopic `json:"msg_diff_topics"`
MsgDiffConsumerGroups map[string]*MsgDiffConsumerGroup `json:"msg_diff_consumergroups"`
MsgDiffTopics_ConsumerGroups map[string]*MsgDiffTopicConsumerGroup `json:"msg_diff_topics_consumergroups"`
MsgDiffBrokers map[string]*MsgDiffBroker `json:"msg_diff_brokers"`
MsgDiffQueues map[string]*MsgDiffQueue `json:"msg_diff_queues"`
MsgDiffClientInfos map[string]*MsgDiffClientInfo `json:"msg_diff_clientinfos"`
}

type MsgDiffDetail struct {
Broker string `json:"broker"`
QueueId int `json:"queueId"`
ConsumerClientIP string `json:"consumerClientIP"`
ConsumerClientPID string `json:"consumerClientPID"`
Diff int `json:"diff"`
Topic string `json:"topic"`
ConsumerGroup string `json:"consumerGroup"`
}

type MsgDiffTopic struct {
Diff int `json:"diff"`
Topic string `json:"topic"`
}

type MsgDiffConsumerGroup struct {
Diff int `json:"diff"`
ConsumerGroup string `json:"consumerGroup"`
}

type MsgDiffTopicConsumerGroup struct {
Diff int `json:"diff"`
Topic string `json:"topic"`
ConsumerGroup string `json:"consumerGroup"`
}

type MsgDiffBroker struct {
Broker string `json:"broker"`
Diff int `json:"diff"`
}

type MsgDiffQueue struct {
Broker string `json:"broker"`
QueueId int `json:"queueId"`
Diff int `json:"diff"`
}

type MsgDiffClientInfo struct {
ConsumerClientIP string `json:"consumerClientIP"`
ConsumerClientPID string `json:"consumerClientPID"`
Diff int `json:"diff"`
}
Loading

0 comments on commit 2497bff

Please sign in to comment.