0

我们正在尝试使用 Jolokia 和 telegraf 收集数据库指标。这是电报的输出。有没有一种方法可以格式化输出以在每个指标的一行中获得结果

实际输出:

> cassandra_ThreadPools,host=hostname,jolokia_agent_url=http://1.2.3.4:8778/jolokia,name=ActiveTasks,path=request,scope=CounterMutationStage ActiveTasks_Value=0 1628529367000000000
> cassandra_ThreadPools,host=hostname,jolokia_agent_url=http://1.2.3.4:8778/jolokia,name=MaxPoolSize,path=request,scope=MutationStage MaxPoolSize_Value=32 1628529367000000000
> cassandra_ThreadPools,host=hostname,jolokia_agent_url=http://1.2.3.4:8778/jolokia,name=PendingTasks,path=request,scope=CounterMutationStage PendingTasks_Value=0 1628529367000000000
> cassandra_ThreadPools,host=hostname,jolokia_agent_url=http://1.2.3.4:8778/jolokia,name=CurrentlyBlockedTasks,path=internal,scope=PendingRangeCalculator CurrentlyBlockedTasks_Count=0 1628529367000000000
> cassandra_ThreadPools,host=hostname,jolokia_agent_url=http://1.2.3.4:8778/jolokia,name=PendingTasks,path=internal,scope=MiscStage PendingTasks_Value=0 1628529367000000000
> cassandra_ThreadPools,host=hostname,jolokia_agent_url=http://1.2.3.4:8778/jolokia,name=CurrentlyBlockedTasks,path=transport,scope=Native-Transport-Requests CurrentlyBlockedTasks_Count=0 1628529367000000000
> cassandra_ThreadPools,host=hostname,jolokia_agent_url=http://1.2.3.4:8778/jolokia,name=TotalBlockedTasks,path=internal,scope=Sampler TotalBlockedTasks_Count=0 1628529367000000000
> cassandra_ThreadPools,host=hostname,jolokia_agent_url=http://1.2.3.4:8778/jolokia,name=PendingTasks,path=internal,scope=CompactionExecutor PendingTasks_Value=0 1628529367000000000


> cassandra_CQL,host=hostname,jolokia_agent_url=http://1.2.3.4:8778/jolokia,name=RegularStatementsExecuted RegularStatementsExecuted_Count=393 1628529367000000000
> cassandra_CQL,host=hostname,jolokia_agent_url=http://1.2.3.4:8778/jolokia,name=PreparedStatementsCount PreparedStatementsCount_Value=6 1628529367000000000
> cassandra_CQL,host=hostname,jolokia_agent_url=http://1.2.3.4:8778/jolokia,name=PreparedStatementsExecuted PreparedStatementsExecuted_Count=119446812 1628529367000000000
> cassandra_CQL,host=hostname,jolokia_agent_url=http://1.2.3.4:8778/jolokia,name=PreparedStatementsEvicted PreparedStatementsEvicted_Count=0 1628529367000000000

期望的输出:

cassandra_ThreadPools,host=hostname,jolokia_agent_url=http://1.2.3.4:8778/jolokia,name=PendingTasks,path=internal,scope=CompactionExecutor PendingTasks_Value=0 ,name=MaxPoolSize,path=request,scope=MutationStage MaxPoolSize_Value=32 ,name=PendingTasks,path=request,scope=CounterMutationStage PendingTasks_Value=0 , ....
cassandra_CQL,host=hostname,jolokia_agent_url=http://1.2.3.4:8778/jolokia, name=RegularStatementsExecuted RegularStatementsExecuted_Count=393,name=PreparedStatementsCount PreparedStatementsCount_Value=6 ,name=PreparedStatementsExecuted PreparedStatementsExecuted_Count=119446812,name=PreparedStatementsEvicted PreparedStatementsEvicted_Count=0 1628529367000000000

配置文件

  [[inputs.jolokia2_agent.metric]]
    name  = "ThreadPools"
    mbean = "org.apache.cassandra.metrics:name=*,path=*,scope=*,type=ThreadPools"
    tag_keys = ["name", "path", "scope"]
    field_prefix = "$1_"

合并聚合插件

# # Merge metrics into multifield metrics by series key
[[aggregators.merge]]
 #tag_keys = ["host"]
#   ## If true, the original metric will be dropped by the
#   ## aggregator and will not get sent to the output plugins.
   drop_original = true


4

0 回答 0