telegraf监控一台服务器完整配置

telegraf.conf此处时序数据库可选择prometheusinfluxdb

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
[agent]
#https://docs.influxdata.com/telegraf/v1.16/administration/configuration/#agent-configuration
interval = "60s" #60s采集一次
flush_interval = "60s" #60spull一次暴露在路径上
round_interval = true
metric_batch_size = 100000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_jitter = "0s"
precision = ""
hostname = "ip"
omit_hostname = false

# 全局标签可选
[global_tags]
TPNG = "全局标签"

[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = true

# 插件标签必须在前一个监控项后面 (可选)
[inputs.cpu.tags]
addr = "插件标签"

[[inputs.disk]]
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]

[[inputs.diskio]]

[[inputs.kernel]]

[[inputs.mem]]

[[inputs.processes]]

[[inputs.system]]
fielddrop = ["uptime_format"]

[[inputs.net]]
ignore_protocol_stats = true

[[inputs.net]]

[[outputs.prometheus_client]]
# https://github.com/influxdata/telegraf/blob/master/plugins/outputs/prometheus_client/README.md
## Address to listen on.
listen = ":9273"
metric_version = 2
path="/metrics"
string_as_label = true
export_timestamp = true

image-20230525113749505