Skip to content

Add support to Process Collector #2247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wardenjohn
Copy link
Contributor

作用

新增进程采集器ProcessCollector

新增指标

系统级别

  • vm_process_minimum: 多值体系下的系统内进程数最小值
  • vm_process_maximum: 多值体系下的系统内进程数最大值
  • vm_process_average: 多值体系下的系统内进程数平均值
    vm_process:系统内进程数,pid数

进程级别

  • process_cpu_average: 多值体系下的某个进程的cpu利用率平均值
  • process_memory_average: 多值体系下的某个进程的内存利用率平均值
  • process_openfile_average: 多值体系下的某个进程的打开文件数的平均值
  • process_number_average : 多值体系下的某个进程的线程数平均值
  • process_number_maximum: 多值体系下的某个进程的线程数最大值
  • process_number_minimum : 多值体系下的某个进程的线程数最小值
process_expand封装
  • process_expand_cpu_percent: process_expand 封装,某个进程的CPU利用率
  • process_expand_memory_percent: process_expand封装,某个进程的内存利用率
  • process_expand_openfile_number:process_expand封装,某个进程的打开文件数
    tag:
  • name:进程名
  • user: 进程用户
  • path:进程所在路径
  • args:运行参数

指标计算方法

CPU利用率

通过解析/proc/pid/status文件,解析cutime,cstime,utime,stime
user = utime + cutime
sys = stime + cstime
totalTime = user + sys
pid_cpu_percent = totcalCPUDiff/timeDiff;
totcalCPUDiff = (this_cpu_total - prev_cpu_total)/ hz
timeDiff = (本次采样时间-上次采样时间)

内存利用率

解析/proc/pid/statm
Resident = statm_resident * pagesize
pid_mem_percent = Resident / totalMemory

文件数

检查/proc/pid/fd
找出fd文件夹,计数

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant