searchusermenu
  • 发布文章
  • 消息中心
点赞
收藏
评论
分享
原创

telegraf学习手册

2023-02-21 02:25:42
21
0

1.启动-需指定配置文件

/usr/bin/telegraf --config /etc/telegraf/cpu.conf

2.配置文件

(1)agent

[agent]
logfile = "/var/log/telegraf/telegraf.log"
logfile_rotation_max_size = "10MB"
logfile_rotation_max_archives = 5
log_with_timezone = "local"
round_interval = true
interval = "1m"
collection_jitter = "15s"
flush_interval = "15s"
flush_jitter = "5s"

collection_jitter: Collection jitter is used to jitter the collection by a random interval. Each plugin will sleep for a random time within jitter before collecting. This can be used to avoid many plugins querying things like sysfs at the same time, which can have a measurable effect on the system.

flush_interval: Default flushing interval for all outputs. Maximum flush_interval will be flush_interval + flush_jitter.

flush_jitter: Default flush jitter for all outputs. This jitters the flush interval by a random amount. This is primarily to avoid large write spikes for users running a large number of telegraf instances. ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s.

(2)global_tags 自定义的全局tags

 

[global_tags]

idc = "xiongan02"
alert_tag = "11.0.96.125"
service_tree="untube_virtual_network_element_elb"

 

 (3)outputs.http 可直接推送到prometheusremote

[[outputs.http]]
#url = "http://13.0.127.248:9091/metrics/job/lb_telegraf_job"
url = "http://11.0.103.248:9090/api/v1/write"

data_format="prometheusremotewrite"

  data_format = "prometheus"

 

(4)[[processors.rename]] 可修改指标名称以及tag

[[processors.replace]]
[[processors.replace.rename]]
measurement = "ping"
measurement_dest = "probe"
field = "result_code"
field_dest = "success"

  [[processors.rename.replace]]
    measurement = "network_interface_throughput"
    dest = "throughput"

  [[processors.rename.replace]]
    tag = "hostname"
    dest = "host"

  [[processors.rename.replace]]
    field = "lower"
    dest = "min"

  [[processors.rename.replace]]
    field = "upper"
    dest = "max"
(5)

[[inputs.mem]]

 fieldpass= ["",]

 

[[inputs.procstat]]
pattern="named"
pid_tag = true

 

[[inputs.procstat]]
pattern="nginx"
pid_tag = true

0条评论
0 / 1000
嘎嘎嘎嘎
15文章数
0粉丝数
嘎嘎嘎嘎
15 文章 | 0 粉丝
原创

telegraf学习手册

2023-02-21 02:25:42
21
0

1.启动-需指定配置文件

/usr/bin/telegraf --config /etc/telegraf/cpu.conf

2.配置文件

(1)agent

[agent]
logfile = "/var/log/telegraf/telegraf.log"
logfile_rotation_max_size = "10MB"
logfile_rotation_max_archives = 5
log_with_timezone = "local"
round_interval = true
interval = "1m"
collection_jitter = "15s"
flush_interval = "15s"
flush_jitter = "5s"

collection_jitter: Collection jitter is used to jitter the collection by a random interval. Each plugin will sleep for a random time within jitter before collecting. This can be used to avoid many plugins querying things like sysfs at the same time, which can have a measurable effect on the system.

flush_interval: Default flushing interval for all outputs. Maximum flush_interval will be flush_interval + flush_jitter.

flush_jitter: Default flush jitter for all outputs. This jitters the flush interval by a random amount. This is primarily to avoid large write spikes for users running a large number of telegraf instances. ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s.

(2)global_tags 自定义的全局tags

 

[global_tags]

idc = "xiongan02"
alert_tag = "11.0.96.125"
service_tree="untube_virtual_network_element_elb"

 

 (3)outputs.http 可直接推送到prometheusremote

[[outputs.http]]
#url = "http://13.0.127.248:9091/metrics/job/lb_telegraf_job"
url = "http://11.0.103.248:9090/api/v1/write"

data_format="prometheusremotewrite"

  data_format = "prometheus"

 

(4)[[processors.rename]] 可修改指标名称以及tag

[[processors.replace]]
[[processors.replace.rename]]
measurement = "ping"
measurement_dest = "probe"
field = "result_code"
field_dest = "success"

  [[processors.rename.replace]]
    measurement = "network_interface_throughput"
    dest = "throughput"

  [[processors.rename.replace]]
    tag = "hostname"
    dest = "host"

  [[processors.rename.replace]]
    field = "lower"
    dest = "min"

  [[processors.rename.replace]]
    field = "upper"
    dest = "max"
(5)

[[inputs.mem]]

 fieldpass= ["",]

 

[[inputs.procstat]]
pattern="named"
pid_tag = true

 

[[inputs.procstat]]
pattern="nginx"
pid_tag = true

文章来自个人专栏
kvm运维
4 文章 | 1 订阅
0条评论
0 / 1000
请输入你的评论
1
1