我们刚刚开始使用iptables telegraf输入收集iptables指标并将其发送到graphite输出。问题是,生成的Graphite标签/字段层次结构与配置不匹配。
我们正尝试使用以下配置选项对其进行控制:
[[outputs.graphite]]
prefix = "telegraf"
template = "host.tags.measurement.field"
这是完整的配置:
[global_tags]
location = "dc1"
tier = "live"
role = "intfw"
lsbdistdescription = "wheezy"
[agent]
hostname = "intfw1-test"
[[processors.regex]]
namepass = ["iptables"]
[[processors.regex.tags]]
key = "ruleid"
pattern = "[:.,\\s]"
replacement = "_"
[[outputs.graphite]]
prefix = "telegraf"
template = "host.tags.measurement.field"
[[inputs.iptables]]
table = "filter"
chains = ["INPUT","FORWARD","OUTPUT"]
由于这种配置,我们期望石墨场的层次结构如下:
telegraf ( == outputs.graphite prefix )
└── intfw1-test ( == host from outputs.graphite template )
└── dc1 ( == first global tag from outputs.graphite template tags (global_tags.location))
└── live ( == global_tags.tier)
└── intfw ( == global_tags.role)
└── wheezy ( == global_tags.lsbdistdescription )
└── iptables ( == measurment(inputs.iptables))
└── filter ( == first tag from inputs.iptables, table)
└── INPUT( == 2nd tag from inputs.iptables, chain)
└── allow_monitoring ( == 3rd tag from inputs.iptables, ruleid)
└── pkts.wsp (field)
但是,实际上,我们得到了以下结构:
telegraf
└── intfw1-test
└── INPUT
└── dc1
└── wheezy
└── intfw
└── allow_monitoring
└── filter
└── live
└── iptables
└── pkts.wsp
即global_tags和tags from iptables.input以某种奇怪的方式混合在一起。有没有机会通过telegraf配置来控制这种层次结构?