exec 脚本运行没有值方式输出会产生内存泄漏

Viewed 33

脚本是以前bosun scollector迁移过来,漏改了,1800秒跑一次
问题:机器跑到这个脚本之后内存出现泄漏,categraf进程开始慢慢上涨,最高涨到4G,还有上涨趋势
日志:
2024/01/29 09:35:34 exec.go:144: E! failed to parse command stdout: E! reading text format failed: text format parsing error in line 2: expected float as value, got ""

脚本输出:
smartctl_health_status{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"} 0
smartctl_raw_read_error_rate{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_spin_up_time{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_start_stop_count{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_reallocated_sector_ct{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_seek_error_rate{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_hours_powered_up{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_spin_retry_count{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_power_cycle_count{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_end_to_end_error{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_reported_uncorrect{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_command_timeout{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_high_fly_writes{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_airflow_temperature_cel{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_g_sense_error_rate{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_power_off_retract_count{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_load_cycle_count{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_current_temp{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_hardware_ecc_recovered{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_current_pending_sector{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_offline_uncorrectable{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_udma_crc_error_count{type="nonraid",dev_or_raidid="/dev/sda",sn="",hw_type="SATA"}
smartctl_health_status{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"} 0
smartctl_raw_read_error_rate{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_spin_up_time{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_start_stop_count{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_reallocated_sector_ct{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_seek_error_rate{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_hours_powered_up{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_spin_retry_count{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_power_cycle_count{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_end_to_end_error{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_reported_uncorrect{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_command_timeout{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_high_fly_writes{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_airflow_temperature_cel{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_g_sense_error_rate{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_power_off_retract_count{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_load_cycle_count{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_current_temp{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_hardware_ecc_recovered{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_current_pending_sector{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_offline_uncorrectable{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}
smartctl_udma_crc_error_count{type="nonraid",dev_or_raidid="/dev/sdb",sn="",hw_type="SATA"}

1 Answers

我用你这个数据测试,1s跑一次,虽然一直有报错,不过没有内存泄露,内存在我的机器上是稳定的:

image.png

又跑了一段时间,上图:

image.png