Telegraf数据收集 - 如何为输入选择特定字段
标题几乎是我的问题 - 我是Telegraf的新手,慢慢地掌握了如何运行并指定日志文件,归档过程等
。收集的指标。例如,仅收集每个CPU ID的CPU-BUSY。但是,当我运行基本config( telegraf -config telegraf.conf -once )时,它会根据所请求的输入从字面上收集每个字段。
有没有办法告诉Telegraf每个输入只收集特定字段?我的telegraf.conf CPU设置如下:
[[inputs.cpu]]
percpu = false
totalcpu = true
collect_cpu_time = false
report_active = false
core_tags = false
提前欢呼,Vinny
The title is pretty much my question - I'm new to Telegraf and slowly getting to grips with how to run it and specify log files, archiving processes, etc etc.
One of the, IMO very simple, tasks I have is to specify the metrics collected. For example, only to collect CPU-busy per CPU ID. But when I run my basic config (telegraf --config telegraf.conf --once), it collects literally every field per the input requested.
Is there a way to tell Telegraf to only collect specific fields per the input? My Telegraf.conf CPU setup is as below:
[[inputs.cpu]]
percpu = false
totalcpu = true
collect_cpu_time = false
report_active = false
core_tags = false
Cheers very much in advance, Vinny
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Telegraf配置提供了 metric-filtering 。
对于用例,您可以尝试 fieldPass 或 fieldDrop 以有用的为准。
关于: fieldpass 的简短描述
:全球模式字符串的数组。仅发出其字段键匹配此列表中图案的字段。
fieldDrop :fieldPass的倒数。具有匹配其中一种模式的字段键的字段将从该点丢弃。
我认为,在CPU忙碌的情况下,您的意思是用户级别流程的消耗百分比。在这种情况下,您的配置变为:
上面的配置仅通过用户级别进程输出使用。
注意:CPU忙碌,如果您还要收集系统使用量,请在fieldPass数组中添加usage_system,
如果您想报告所有非IDLE CPU状态的总和,则需要设置
report> report> report_active = true
在上面的配置中。要仅报告主动用法(所有非IDLE CPU状态的总和),请在 fieldpass array中传递usage_active
arnay array asfield> fieldpass = [“ usage_active”] < /代码>
如果您希望分别收集每个CPU的统计信息,请设置
percpu = true
Telegraf configuration provides support for metric-filtering.
For your use case, you may try fieldpass or fielddrop whichever is useful.
Short description about:
fieldpass: An array of glob pattern strings. Only fields whose field key matches a pattern in this list are emitted.
fielddrop: The inverse of fieldpass. Fields with a field key matching one of the patterns will be discarded from the point.
I assume that by cpu busy, you mean the percentage consumption by user level processes. In that case, your configuration becomes:
The above configuration will output only the usage by user level processes.
NOTE: By CPU busy, if you mean to collect system usage as well, add usage_system as well to the fieldpass array
If you would like to report the sum of all non-idle CPU states, you need to set
report_active = true
in the above configuration. To report only the active usage (sum of all non-idle CPU states), pass theusage_active
in the fieldpass array asfieldpass = ["usage_active"]
If you wish to collect statistics of each cpu separately, set
percpu = true