telegraf output input 配置用法
使用場景:
作為數(shù)據(jù)中轉(zhuǎn)層,簡單處理數(shù)據(jù)。支持多種方式輸入數(shù)據(jù),同時支持多種方式輸出數(shù)據(jù),具體可參考https://github.com/influxdata/telegraf
輸入數(shù)據(jù)組件:
使用statsd,使用場景為收集監(jiān)控數(shù)據(jù),為了保證不影響業(yè)務(wù)性能,固采用不需要建立連接的UDP協(xié)議收集數(shù)據(jù)。
# Statsd UDP/TCP Server [[inputs.statsd]]## Protocol, must be "tcp", "udp", "udp4" or "udp6" (default=udp)protocol = "udp"## Address and port to host UDP listener onservice_address = ":8125"## The following configuration options control when telegraf clears it's cache## of previous values. If set to false, then telegraf will only clear it's## cache when the daemon is restarted.## Reset gauges every interval (default=true)delete_gauges = true## Reset counters every interval (default=true)delete_counters = false## Reset sets every interval (default=true)delete_sets = false## Reset timings & histograms every interval (default=true)delete_timings = false## Percentiles to calculate for timing & histogram statspercentiles = [50,75,95,99]## separator to use between elements of a statsd metricmetric_separator = "_"配置項介紹:
protocol="udp"? 表示接收數(shù)據(jù)使用協(xié)議類型,支持tcp/udp
service_address=":8125"? 表示statsd服務(wù)啟動的監(jiān)聽端口
delete_gauges=true 表示每周期從statsd查詢完數(shù)據(jù),是否清空gauge類型數(shù)據(jù),true表示刪除,false表示不刪除,其他delete字段同理,由于其他字段都是累計值,輸出數(shù)據(jù)組件prometheus client不支持計算數(shù)據(jù),所以不可刪除。
percentiles = [50,75,95,99]? 表示timings數(shù)據(jù)類型,50% 75% 95% 99%的時間都大于某個時間值。
metric_seqarator="_",表示對于metrics名里面的特殊字符,默認(rèn)轉(zhuǎn)換為"_"。
輸出數(shù)據(jù)組件:
使用prometheus,簡單配置如下:
[[outputs.prometheus_client]]## Address to listen on.listen = ":9273"## Expiration interval for each metric. 0 == no expirationexpiration_interval = "65s"配置項介紹:
listen = ":9273"? 表示啟動的client監(jiān)聽的端口為9273,
expiration_interval = "65s"? 表示所有metrics項的過期時間都為65s,過期自動刪除。
總結(jié)
以上是生活随笔為你收集整理的telegraf output input 配置用法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 贪心算法区间调度问题思路代码证明
- 下一篇: php语言使用statsd统计指标模板