Windows server 2012操作系统;
使用telegraf 采集系统数据,进程占用内存一直增大;
配置采集系统cpu、磁盘的conf文件,1分钟采集一次输出一次;
[global_tags]
region='123'
type='456'
[agent]
interval = "60s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "60s"
flush_jitter = "0s"
precision = "0s"
debug = true
hostname = ""
omit_hostname = true
#cpu
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
core_tags = false
fieldpass = ["*usage*"]
#内存
[[inputs.mem]]
# fieldpass = ["used_percent"]
#磁盘
[[inputs.disk]]
#磁盘io吞吐
[[inputs.diskio]]
#fieldpass = ["reads","writes","read_bytes","write_bytes"]
#网卡
[[inputs.net]]
ignore_protocol_stats = true
#系统运行时间
[[inputs.system]]
fieldpass = ["uptime*"]
#网速?
# [[inputs.internet_speed]]
[[aggregators.merge]]
drop_original = true
[[outputs.file]]
files = ["stdout"]
data_format = "json"
把执行的采集命令写到test.bat文件中:
@echo off
cd C:\telegraf\telegraf-1.29.5_windows_amd64\telegraf-1.29.5
.\telegraf.exe --config .\work-telegraf.conf >> test.log 2>>&1
然后在powershell中后台执行这个bat脚本
Start-Process -WindowStyle Hidden -FilePath "test.bat"
最后使用tasklist命令查看进程内存占用情况
tasklist | findstr telegraf
发现内存占用虽然增长的慢,但却是曲线增大的,通过任务管理器发现大概率是内存(专用工作集)增大引起的。
现在不知道该怎么控制不断增大的内存?