Documentation ¶
Index ¶
- Constants
- Variables
- func NewCreator() metric.Collector
- type CPUStats
- type CollectInfo
- type DiskIOStats
- type DiskStats
- type DiskioCollectInfo
- type Kernel
- type KernelVmstat
- type LinuxSystemStats
- type MemStats
- type MockPS
- func (m *MockPS) CPUTimes(perCPU, totalCPU bool) ([]cpu.TimesStat, error)
- func (m *MockPS) DiskIO(names []string) (map[string]disk.IOCountersStat, error)
- func (m *MockPS) DiskUsage(mountPointFilter []string, fstypeExclude []string) ([]*disk.UsageStat, []*disk.PartitionStat, error)
- func (m *MockPS) LoadAvg() (*load.AvgStat, error)
- func (m *MockPS) NetConnections() ([]net.ConnectionStat, error)
- func (m *MockPS) NetIO() ([]net.IOCountersStat, error)
- func (m *MockPS) NetProto() ([]net.ProtoCountersStat, error)
- func (m *MockPS) SwapStat() (*mem.SwapMemoryStat, error)
- func (m *MockPS) VMStat() (*mem.VirtualMemoryStat, error)
- type MockPSDisk
- func (s MockPSDisk) CPUTimes(perCPU, totalCPU bool) ([]cpu.TimesStat, error)
- func (s MockPSDisk) DiskIO(names []string) (map[string]disk.IOCountersStat, error)
- func (s MockPSDisk) DiskUsage(mountPointFilter []string, fstypeExclude []string) ([]*disk.UsageStat, []*disk.PartitionStat, error)
- func (s MockPSDisk) NetConnections() ([]net.ConnectionStat, error)
- func (s MockPSDisk) NetIO() ([]net.IOCountersStat, error)
- func (s MockPSDisk) NetProto() ([]net.ProtoCountersStat, error)
- func (s MockPSDisk) SwapStat() (*mem.SwapMemoryStat, error)
- func (s MockPSDisk) VMStat() (*mem.VirtualMemoryStat, error)
- type NetIOStats
- type NetStats
- type PS
- type PSDiskDeps
- type ProcessInfo
- type Processes
- type Procstat
- func (p *Procstat) Collect() (datas []map[string]interface{}, err error)
- func (p *Procstat) Config() map[string]interface{}
- func (p *Procstat) Name() string
- func (p *Procstat) PCpuTop10(process map[string]*ProcessInfo, processExist map[string]bool) (err error)
- func (p *Procstat) PMemTop10(process map[string]*ProcessInfo, processExist map[string]bool) (err error)
- func (p *Procstat) SupervisordStat(process map[string]*ProcessInfo, processExist map[string]bool) (err error)
- func (p *Procstat) SyncConfig(config map[string]interface{}, meta *reader.Meta) error
- func (p *Procstat) Tags() []string
- func (p *Procstat) Usages() string
- type SwapStats
- type SysctlFS
- type SystemStats
Constants ¶
View Source
const ( TypeMetricCpu = "cpu" MetricCpuUsages = "CPU(Cpu)" // TypeMetricCpu 信息中的字段 // CPU 总量 CpuTimeUser = "cpu_time_user" CpuTimeSystem = "cpu_time_system" CpuTimeIdle = "cpu_time_idle" CpuTimeNice = "cpu_time_nice" CpuTimeIowait = "cpu_time_iowait" CpuTimeIrq = "cpu_time_irq" CpuTimeSoftirq = "cpu_time_softirq" CpuTimeSteal = "cpu_time_steal" CpuTimeGuest = "cpu_time_guest" CpuTimeGuestNice = "cpu_time_guest_nice" CpuTimeCPU = "cpu_time_cpu" // CPU 用量 CpuUsageUser = "cpu_usage_user" CpuUsageSystem = "cpu_usage_system" CpuUsageIdle = "cpu_usage_idle" CpuUsageNice = "cpu_usage_nice" CpuUsageIowait = "cpu_usage_iowait" CpuUsageIrq = "cpu_usage_irq" CpuUsageSoftirq = "cpu_usage_softirq" CpuUsageSteal = "cpu_usage_steal" CpuUsageGuest = "cpu_usage_guest" CpuUsageGuestNice = "cpu_usage_guest_nice" CpuUsageCPU = "cpu_usage_cpu" // Config 中的字段 CpuConfigPerCpu = "per_cpu" CpuConfigTotalCpu = "total_cpu" CpuConfigCollectCpuTime = "collect_cpu_time" )
View Source
const ( TypeMetricDisk = "disk" MetricDiskUsages = "磁盘(disk)" // TypeMetricDisk 信息中的字段 KeyDiskPath = "disk_path" KeyDiskDevice = "disk_device" KeyDiskFstype = "disk_fstype" KeyDiskTotal = "disk_total" KeyDiskFree = "disk_free" KeyDiskUsed = "disk_used" KeyDiskUsedPercent = "disk_used_percent" KeyDiskInodesTotal = "disk_inodes_total" KeyDiskInodesFree = "disk_inodes_fress" KeyDiskInodesUsed = "disk_inodes_used" // Config 中的字段 ConfigDiskIgnoreFs = "ignore_fs" ConfigDiskMountPoints = "mount_points" )
View Source
const ( TypeMetricDiskio = "diskio" MetricDiskioUsages = "磁盘IO(diskIo)" // TypeMetricDiskio 信息中的字段 KeyDiskioReads = "diskio_reads" KeyDiskioWrites = "diskio_writes" KeyDiskioReadsPerSec = "diskio_reads_per_sec" KeyDiskioWritesPerSec = "diskio_writes_per_sec" KeyDiskioMergedReadCount = "diskio_merged_read_count" KeyDiskioMergedWriteCount = "diskio_merged_write_count" KeyDiskioMergedReadCountPerSec = "diskio_merged_read_count_per_sec" KeyDiskioMergedWriteCountPerSec = "diskio_merged_write_count_per_sec" KeyDiskioReadBytes = "diskio_read_bytes" KeyDiskioWriteBytes = "diskio_write_bytes" KeyDiskioReadBytesPerSec = "diskio_read_bytes_per_sec" KeyDiskioWriteBytesPerSec = "diskio_write_bytes_per_sec" KeyDiskioReadTime = "diskio_read_time" KeyDiskioWriteTime = "diskio_write_time" KeyDiskioReadAWait = "diskio_read_await" KeyDiskioWriteAWait = "diskio_write_await" KeyDiskioAWait = "diskio_await" KeyDiskioIoTime = "diskio_io_time" KeyDiskioIoUtil = "diskio_io_util" KeyDiskioIopsInProgress = "diskio_iops_in_progress" KeyDiskioName = "diskio_name" KeyDiskioSerial = "diskio_serial" // Config 字段 ConfigDiskioDevices = "devices" ConfigDiskioDeviceTags = "device_tags" ConfigDiskioNameTemplates = "name_templates" ConfigDiskioSkipSerialNumber = "skip_serial_number" )
View Source
const ( TypeMetricKernel = "kernel" MetricKernelUsages = "内核(kernel)" // TypeMetricKernel 信息中的字段 KernelInterrupts = "kernel_interrupts" KernelContextSwitches = "kernel_context_switches" KernelProcessesForked = "kernel_processes_forked" KernelBootTime = "kernel_boot_time" KernelDiskPagesIn = "kernel_disk_pages_in" KernelDiskPagesOut = "kernel_disk_pages_out" )
View Source
const ( TypeMetricKernelVmstat = "kernel_vmstat" MetricKernelVmstatUsages = "内核(kernel_vmstat)" )
View Source
const ( TypeLinuxSysctlFs = "linux_sysctl_fs" MetricLinuxSysctlFsUsage = "linux内核信息(linux_sysctl_fs)" KeyLinuxSysctlFsAioNr = "aio-nr" KeyLinuxSysctlFsAioMaxNr = "aio-max-nr" KeyLinuxSysctlFsDquotNr = "dquot-nr" KeyLinuxSysctlFsDquotMax = "dquot-max" KeyLinuxSysctlFsSuperNr = "super-nr" KeyLinuxSysctlFsSuperMax = "super-max" KeyLinuxSysctlFsInodeNr = "inode-nr" KeyLinuxSysctlFsInodeFreeNr = "inode-free-nr" KeyLinuxSysctlFsInodePreNr = "inode-preshrink-nr" KeyLinuxSysctlFsDentryNr = "dentry-nr" KeyLinuxSysctlFsDentryUnNr = "dentry-unused-nr" KeyLinuxSysctlFsDetryAgeLimit = "dentry-age-limit" KeyLinuxSysctlFsDentryWantPages = "dentry-want-pages" KeyLinuxSysctlFsFileNr = "file-nr" KeyLinuxSysctlFsFileMax = "file-max" )
View Source
const ( TypeMetricMem = "mem" MetricMemUsages = "内存(mem)" // TypeMetricMem 信息中的字段 KeyMemTotal = "mem_total" KeyMemAvailable = "mem_available" KeyMemUsed = "mem_used" KeyMemFree = "mem_free" KeyMemCached = "mem_cached" KeyMemBuffered = "mem_buffered" KeyMemActive = "mem_active" KeyMemInactive = "mem_inactive" KeyMemUsedPercent = "mem_used_percent" KeyMemAvailablePercent = "mem_available_percent" )
View Source
const ( TypeMetricSwap = "swap" MetricSwapUsages = "内存(Swap)" // TypeMetricSwap 中的字段 KeySwapTotal = "swap_total" KeySwapUsed = "swap_used" KeySwapFree = "swap_free" KeySwapIn = "swap_in" KeySwapOut = "swap_out" KeySwapUsedPercent = "swap_used_percent" )
View Source
const ( TypeMetricNet = "net" MetricNetUsages = "网络设备状态(net)" // TypeMetricNet 信息中的字段 KeyNetBytesSent = "net_bytes_sent" KeyNetBytesSentPerSec = "net_bytes_sent_per_sec" KeyNetBytesRecv = "net_bytes_recv" KeyNetBytesRecvPerSec = "net_bytes_recv_per_sec" KeyNetPacketsSent = "net_packets_sent" KeyNetPacketsSentPerSec = "net_packets_sent_per_sec" KeyNetPacketsRecv = "net_packets_recv" KeyNetPacketsRecvPerSec = "net_packets_recv_per_sec" KeyNetErrIn = "net_err_in" KeyNetErrOut = "net_err_out" KeyNetDropIn = "net_drop_in" KeyNetDropOut = "net_drop_out" KeyNetInterface = "net_interface" KeyNetHWAddr = "net_hw_addr" )
View Source
const ( TypeMetricNetstat = "netstat" MetricNetstatUsages = "网络连接情况(netstat)" // TypeMetricNetstat 信息中的字段 KeyNetstatTcpEstablished = "netstat_tcp_established" KeyNetstatTcpSynSent = "netstat_tcp_syn_sent" KeyNetstatTcpSynRecv = "netstat_tcp_syn_recv" KeyNetstatTcpFinWait1 = "netstat_tcp_fin_wait1" KeyNetstatTcpFinWait2 = "netstat_tcp_fin_wait2" KeyNetstatTcpTimeWait = "netstat_tcp_time_wait" KeyNetstatTcpClose = "netstat_tcp_close" KeyNetstatTcpCloseWait = "netstat_tcp_close_wait" KeyNetstatTcpLastAck = "netstat_tcp_last_ack" KeyNetstatTcpListen = "netstat_tcp_listen" KeyNetstatTcpClosing = "netstat_tcp_closing" KeyNetstatTcpNone = "netstat_tcp_none" KeyNetstatUdpSocket = "netstat_udp_socket" )
View Source
const ( TypeMetricProcesses = "processes" MetricProcessesUsage = "系统进程(processes)" // TypeMetricProcesses 信息中的字段 KeyProcessesBlocked = "processes_blocked" KeyProcessesZombies = "processes_zombies" KeyProcessesStopped = "processes_stopped" KeyProcessesRunning = "processes_running" KeyProcessesSleeping = "processes_sleeping" KeyProcessesTotal = "processes_total" KeyProcessesUnknown = "processes_unknown" KeyProcessesIdle = "processes_idle" KeyProcessesWait = "processes_wait" KeyProcessesDead = "processes_dead" KeyProcessesPaging = "processes_paging" KeyProcessesTotalThreads = "processes_total_threads" )
View Source
const ( TypeMetricProcstat = "procstat" MetricProcstatUsage = "详细进程信息(procstat)" // TypeMetricProcstat 信息中的字段 KeyProcstatProcessName = "procstat_process_name" KeyProcstatPid = "procstat_pid" KeyProcstatStatus = "procstat_status" KeyProcstatThreadsNum = "procstat_threads_num" KeyProcstatFdsNum = "procstat_fds_num" KeyProcstatVolConSwitches = "procstat_voluntary_context_switches" KeyProcstatInVolConSwitches = "procstat_involuntary_context_switches" KeyProcstatReadCount = "procstat_read_count" KeyProcstatWriteCount = "procstat_write_count" KeyProcstatReadBytes = "procstat_read_bytes" KeyProcstatWriteBytes = "procstat_write_bytes" KeyProcstatCpuTime = "procstat_cpu_time" KeyProcstatCpuUsage = "procstat_cpu_usage" KeyProcstatCpuTimeUser = "procstat_cpu_time_user" KeyProcstatCpuTimeSystem = "procstat_cpu_time_system" KeyProcstatCpuTimeIdle = "procstat_cpu_time_idle" KeyProcstatCpuTimeNice = "procstat_cpu_time_nice" KeyProcstatCpuTimeIoWait = "procstat_cpu_time_iowait" KeyProcstatCpuTimeIrq = "procstat_cpu_time_irq" KeyProcstatCpuTimeSoftirq = "procstat_cpu_time_softirq" KeyProcstatCpuTimeSteal = "procstat_cpu_time_steal" KeyProcstatCpuTimeStolen = "procstat_cpu_time_stolen" KeyProcstatCpuTimeGuest = "procstat_cpu_time_guest" KeyProcstatCpuTimeGuestNice = "procstat_cpu_time_guest_nice" KeyProcstatMemRss = "procstat_mem_rss" KeyProcstatMemVms = "procstat_mem_vms" KeyProcstatMemSwap = "procstat_mem_swap" KeyProcstatMemData = "procstat_mem_data" KeyProcstatMemStack = "procstat_mem_stack" KeyProcstatMemLocked = "procstat_mem_locked" KeyProcstatFileLocks = "procstat_file_locks" KeyProcstatSignalsPending = "procstat_signals_pending" KeyProcstatNicePriority = "procstat_nice_priority" KeyProcstatRealtimePriority = "procstat_realtime_priority" KeyProcstatRlimitCpuTimeSoft = "procstat_rlimit_cpu_time_soft" KeyProcstatRlimitMemRssSoft = "procstat_rlimit_mem_rss_soft" KeyProcstatRlimitMemVmsSoft = "procstat_rlimit_mem_vms_soft" KeyProcstatRlimitFdsNumSoft = "procstat_rlimit_mem_swap_soft" KeyProcstatRlimitMemDataSoft = "procstat_rlimit_mem_data_soft" KeyProcstatRlimitMemStackSoft = "procstat_rlimit_mem_stack_soft" KeyProcstatRlimitMemLockedSoft = "procstat_rlimit_mem_locked_soft" KeyProcstatRlimitSignalsPendingSoft = "procstat_rlimit_signals_pending_soft" KeyProcstatRlimitFileLocksSoft = "procstat_rlimit_file_locks_soft" KeyProcstatRlimitNicePrioritySoft = "procstat_rlimit_nice_priority_soft" KeyProcstatRlimitRealtimePrioritySoft = "procstat_rlimit_realtime_priority_soft" KeyProcstatRlimitCpuTimeHard = "procstat_rlimit_cpu_time_hard" KeyProcstatRlimitMemRssHard = "procstat_rlimit_mem_rss_hard" KeyProcstatRlimitMemVmsHard = "procstat_rlimit_mem_vms_hard" KeyProcstatRlimitFdsNumHard = "procstat_rlimit_mem_swap_hard" KeyProcstatRlimitMemDataHard = "procstat_rlimit_mem_data_hard" KeyProcstatRlimitMemStackHard = "procstat_rlimit_mem_stack_hard" KeyProcstatRlimitMemLockedHard = "procstat_rlimit_mem_locked_hard" KeyProcstatRlimitSignalsPendingHard = "procstat_rlimit_signals_pending_hard" KeyProcstatRlimitFileLocksHard = "procstat_rlimit_file_locks_hard" KeyProcstatRlimitNicePriorityHard = "procstat_rlimit_nice_priority_hard" KeyProcstatRlimitRealtimePriorityHard = "procstat_rlimit_realtime_priority_hard" )
View Source
const ( GoOSMac = "Darwin" GoOSLinux = "Linux" GoOSWindows = "windows" )
View Source
const ( MemRelated = "mem_related" IoRelated = "io_related" CtxSwitRelated = "context_switch_related" ThreadsRelated = "threads_related" FileDescRelated = "file_descriptor_related" CpuTimeRelated = "cpu_time_related" CpuUsageRelated = "cpu_usage_related" ResourceLimits = "resource_limits" CpuTop10 = "cpu_top_10" MemTop10 = "mem_top_10" Supervisord = "supervisord" DaemonTools = "daemon_tools" PidFile = "pid_file" Exe = "exe" Self = "self" Pattern = "pattern" User = "user" SystemdUnit = "system_unit" CGroup = "cgroup" )
View Source
const ( TypeMetricSystem = "system" MetricSystemUsage = "系统概览(system)" // TypeMetricSystem 信息中的字段 KeySystemLoad1 = "system_load1" KeySystemLoad5 = "system_load5" KeySystemLoad15 = "system_load15" KeySystemNUsers = "system_n_users" KeySystemNCpus = "system_n_cpus" KeySystemUptime = "system_uptime" KeySystemUptimeFormat = "system_uptime_format" KeySystemNNetCards = "system_n_net_cards" KeySystemNDisks = "system_n_disks" KeySystemNServices = "system_n_services" )
Variables ¶
View Source
var ConfigCpuUsages = KeyValueSlice{ {CpuConfigPerCpu, "是否收集每个 cpu 的统计数据(" + CpuConfigPerCpu + ")", ""}, {CpuConfigTotalCpu, "是否收集整个系统的 cpu 统计信息(" + CpuConfigTotalCpu + ")", ""}, {CpuConfigCollectCpuTime, "是否收集 cpu 时间统计信息(" + CpuConfigCollectCpuTime + ")", ""}, }
ConfigCpuUsages TypeMetricCpu 配置项的描述
View Source
var ConfigDiskUsages = KeyValueSlice{ {ConfigDiskIgnoreFs, "忽略的挂载点,用','分隔(" + ConfigDiskIgnoreFs + ")", ""}, {ConfigDiskMountPoints, "收集特定挂载点信息,默认收集所有挂载点,用','分隔(" + ConfigDiskMountPoints + ")", ""}, }
ConfigDiskUsages TypeMetricDisk config 中的字段描述
View Source
var ConfigDiskioUsages = KeyValueSlice{ {ConfigDiskioDevices, "获取特定设备的信息,用','隔开(" + ConfigDiskioDevices + ")", ""}, {ConfigDiskioDeviceTags, "采集磁盘某些tag的信息,用','隔开(" + ConfigDiskioDeviceTags + ")", ""}, {ConfigDiskioNameTemplates, "一些尝试加入设备的模板列表,用','隔开(" + ConfigDiskioNameTemplates + ")", ""}, {ConfigDiskioSkipSerialNumber, "是否忽略磁盘序列号(" + ConfigDiskioSkipSerialNumber + ")", ""}, }
ConfigDiskioUsages TypeMetricDiskio 配置项描述
View Source
var ConfigProcUsages = []models.Option{ { KeyName: "cpu_usage_related", Element: models.Radio, ChooseOnly: true, ChooseOptions: []interface{}{"true", "false"}, Default: "true", Description: "收集Cpu用量相关的信息(cpu_usage_related)", Type: metric.ConfigTypeBool, }, { KeyName: "mem_related", Element: models.Radio, ChooseOnly: true, ChooseOptions: []interface{}{"true", "false"}, Default: "true", Description: "收集内存相关的信息(mem_related)", Type: metric.ConfigTypeBool, }, { KeyName: "cpu_time_related", Element: models.Radio, ChooseOnly: true, ChooseOptions: []interface{}{"false", "true"}, Default: "false", Description: "收集CPU时间相关的信息(cpu_time_related)", Type: metric.ConfigTypeBool, }, { KeyName: "io_related", Element: models.Radio, ChooseOnly: true, ChooseOptions: []interface{}{"true", "false"}, Default: "true", Description: "收集IO相关的信息(io_related)", Type: metric.ConfigTypeBool, }, { KeyName: "threads_related", Element: models.Radio, ChooseOnly: true, ChooseOptions: []interface{}{"false", "true"}, Default: "false", Description: "收集线程数量(threads_related)", Type: metric.ConfigTypeBool, }, { KeyName: "context_switch_related", Element: models.Radio, ChooseOnly: true, ChooseOptions: []interface{}{"false", "true"}, Default: "false", Description: "收集内核上下文切换次数(context_switch_related)", Type: metric.ConfigTypeBool, }, { KeyName: "file_descriptor_related", Element: models.Radio, ChooseOnly: true, ChooseOptions: []interface{}{"false", "true"}, Default: "false", Description: "收集文件描述相关信息(file_descriptor_related)", Type: metric.ConfigTypeBool, }, { KeyName: "resource_limits", Element: models.Radio, ChooseOnly: true, ChooseOptions: []interface{}{"false", "true"}, Default: "false", Description: "收集资源限制相关的信息(resource_limits)", Type: metric.ConfigTypeBool, }, { KeyName: "cpu_top_10", Element: models.Radio, ChooseOnly: true, ChooseOptions: []interface{}{"true", "false"}, Default: "true", Description: "收集CPU利用率前10的进程(cpu_top_10)", Type: metric.ConfigTypeBool, }, { KeyName: "mem_top_10", Element: models.Radio, ChooseOnly: true, ChooseOptions: []interface{}{"true", "false"}, Default: "true", Description: "收集内存占用前10的进程(mem_top_10)", Type: metric.ConfigTypeBool, }, { KeyName: "supervisord", Element: models.Radio, ChooseOnly: true, ChooseOptions: []interface{}{"true", "false"}, Default: "true", Description: "收集supervisord管理的进程(supervisord)", Type: metric.ConfigTypeBool, }, { KeyName: "daemon_tools", Element: models.Radio, ChooseOnly: true, ChooseOptions: []interface{}{"false", "true"}, Default: "false", Description: "收集daemontools管理的进程(daemon_tools)", Type: metric.ConfigTypeBool, }, { KeyName: "self", Element: models.Radio, ChooseOnly: true, ChooseOptions: []interface{}{"false", "true"}, Default: "false", Description: "监控logkit自身进程(self)", Type: metric.ConfigTypeBool, }, { KeyName: "pid_file", DefaultNoUse: false, ChooseOnly: false, Default: "", Description: "填写 pid 文件路径(pid_file)", }, { KeyName: "exe", DefaultNoUse: false, ChooseOnly: false, Default: "", Description: "填写可执行文件名称(pgrep xx)(exe)", }, { KeyName: "pattern", DefaultNoUse: false, ChooseOnly: false, Default: "", Description: "填写命令行表达式(pgrep -f xx)(pattern)", }, { KeyName: "user", DefaultNoUse: false, ChooseOnly: false, Default: "", Description: "填写用户名(pgrep -u xx)(user)", }, { KeyName: "system_unit", DefaultNoUse: false, ChooseOnly: false, Default: "", Description: "填写 system unit 名称(systemctl show xx)(system_unit)", }, { KeyName: "cgroup", DefaultNoUse: false, ChooseOnly: false, Default: "", Description: "填写 cgroup name/path(cgroup)", }, }
ConfigProcUsages TypeMetricProc 配置项的描述
View Source
var KeyCpuUsages = KeyValueSlice{ {CpuTimeUser, "用户进程用时", ""}, {CpuTimeSystem, "系统内核用时", ""}, {CpuTimeIdle, "空闲CPU用时", ""}, {CpuTimeNice, "优先级调度用时", ""}, {CpuTimeIowait, "iowait用时", ""}, {CpuTimeIrq, "中断用时", ""}, {CpuTimeSoftirq, "软中断用时", ""}, {CpuTimeSteal, "Steal用时", ""}, {CpuTimeGuest, "Guest用时", ""}, {CpuTimeGuestNice, "GuestNice用时", ""}, {CpuTimeCPU, "CPU序号名称", ""}, {CpuUsageUser, "用户用量百分比(0~100)", ""}, {CpuUsageSystem, "系统用量百分比(0~100)", ""}, {CpuUsageIdle, "空闲百分比(0~100)", ""}, {CpuUsageNice, "优先级调度程序用量百分比(0~100)", ""}, {CpuUsageIowait, "IOwait时间占比(0~100)", ""}, {CpuUsageIrq, "中断时间占比(0~100)", ""}, {CpuUsageSoftirq, "软中断时间占比(0~100)", ""}, {CpuUsageSteal, "虚拟CPU的竞争等待时间占比(0~100)", ""}, {CpuUsageGuest, "虚拟进程的CPU用时占比(0~100)", ""}, {CpuUsageGuestNice, "虚拟进程CPU调度用时占比(0~100)", ""}, {CpuUsageCPU, "CPU序号名称", ""}, }
KeyCpuUsages TypeMetricCpu 中的字段名称
View Source
var KeyDiskUsages = KeyValueSlice{ {KeyDiskPath, "磁盘路径", ""}, {KeyDiskDevice, "磁盘设备名", ""}, {KeyDiskFstype, "文件系统类型", ""}, {KeyDiskTotal, "磁盘总大小", ""}, {KeyDiskFree, "磁盘剩余大小", ""}, {KeyDiskUsed, "磁盘用量", ""}, {KeyDiskUsedPercent, "磁盘已用百分比", ""}, {KeyDiskInodesTotal, "总inode数量", ""}, {KeyDiskInodesFree, "空闲的inode数量", ""}, {KeyDiskInodesUsed, "使用的inode数量", ""}, }
KeyDiskUsages TypeMetricDisk 字段名称
View Source
var KeyDiskioUsages = KeyValueSlice{ {KeyDiskioReads, "磁盘被读的总次数", ""}, {KeyDiskioWrites, "磁盘被写的总次数", ""}, {KeyDiskioReadsPerSec, "每秒磁盘被读的次数", ""}, {KeyDiskioWritesPerSec, "每秒磁盘被写的次数", ""}, {KeyDiskioMergedReadCount, "磁盘合并读总次数", ""}, {KeyDiskioMergedWriteCount, "磁盘合并写的总次数", ""}, {KeyDiskioMergedReadCountPerSec, "每秒磁盘合并读次数", ""}, {KeyDiskioMergedWriteCountPerSec, "每秒磁盘合并写的次数", ""}, {KeyDiskioReadBytes, "读取的总数据量", ""}, {KeyDiskioWriteBytes, "写入的总数据量", ""}, {KeyDiskioReadBytesPerSec, "每秒读取的数据量(bytes/s)", ""}, {KeyDiskioWriteBytesPerSec, "每秒写入的数据量(bytes/s)", ""}, {KeyDiskioReadTime, "磁盘读取总用时", ""}, {KeyDiskioWriteTime, "磁盘写入总用时", ""}, {KeyDiskioReadAWait, "每个读操作平均所需的时间", ""}, {KeyDiskioWriteAWait, "每个写操作平均所需的时间", ""}, {KeyDiskioAWait, "每个I/O平均所需的时间", ""}, {KeyDiskioIoTime, "io总时间", ""}, {KeyDiskioIoUtil, "设备的繁忙比率", ""}, {KeyDiskioIopsInProgress, "运行中的每秒IO数据量", ""}, {KeyDiskioName, "磁盘名称", ""}, {KeyDiskioSerial, "磁盘序列号", ""}, }
KeyDiskioUsages TypeMetricDiskio 中的字段名称
View Source
var KeyKernelUsages = KeyValueSlice{ {KernelInterrupts, "内核中断次数", ""}, {KernelContextSwitches, "内核上下文切换次数", ""}, {KernelProcessesForked, "fork的进程数", ""}, {KernelBootTime, "内核启动时间", ""}, {KernelDiskPagesIn, "磁盘换入数量", ""}, {KernelDiskPagesOut, "磁盘换出数量", ""}, }
KeyKernelUsages TypeMetricKernel 中的字段名称
View Source
var KeyLinuxSysctlFsUsage = KeyValueSlice{ {KeySysctlFsFieldNameMap[KeyLinuxSysctlFsAioNr], "当前 aio 请求数", ""}, {KeySysctlFsFieldNameMap[KeyLinuxSysctlFsAioMaxNr], "最大允许的 aio 请求", ""}, {KeySysctlFsFieldNameMap[KeyLinuxSysctlFsDquotNr], "分配的磁盘配额项及空余项", ""}, {KeySysctlFsFieldNameMap[KeyLinuxSysctlFsDquotMax], "缓存的磁盘配额的最大值", ""}, {KeySysctlFsFieldNameMap[KeyLinuxSysctlFsSuperNr], "已分配的 super block 数", ""}, {KeySysctlFsFieldNameMap[KeyLinuxSysctlFsSuperMax], "系统能够分配的 super block 数", ""}, {KeySysctlFsFieldNameMap[KeyLinuxSysctlFsInodeNr], "分配的 inode 数", ""}, {KeySysctlFsFieldNameMap[KeyLinuxSysctlFsInodeFreeNr], "空闲的 inode 数", ""}, {KeySysctlFsFieldNameMap[KeyLinuxSysctlFsInodePreNr], "inode 预缩减数", ""}, {KeySysctlFsFieldNameMap[KeyLinuxSysctlFsDentryNr], "当前分配的 dentry 缓存数", ""}, {KeySysctlFsFieldNameMap[KeyLinuxSysctlFsDentryUnNr], "未使用的 dentry 缓存数", ""}, {KeySysctlFsFieldNameMap[KeyLinuxSysctlFsDetryAgeLimit], "dentry 缓存被创建以来的时长", ""}, {KeySysctlFsFieldNameMap[KeyLinuxSysctlFsDentryWantPages], "系统需要的页面数", ""}, {KeySysctlFsFieldNameMap[KeyLinuxSysctlFsFileNr], "已分配、使用的和最大的文件句柄数", ""}, {KeySysctlFsFieldNameMap[KeyLinuxSysctlFsFileMax], "内核支持的最大file handle数量", ""}, }
View Source
var KeyMemUsages = KeyValueSlice{ {KeyMemTotal, "内存总数", ""}, {KeyMemAvailable, "可用内存数", ""}, {KeyMemUsed, "已用内存数", ""}, {KeyMemFree, "空闲内存", ""}, {KeyMemCached, "用于缓存的内存", ""}, {KeyMemBuffered, "文件buffer内存", ""}, {KeyMemActive, "活跃使用的内存总数(包括cache和buffer内存)", ""}, {KeyMemInactive, "空闲的内存数(包括free和avalible的内存)", ""}, {KeyMemUsedPercent, "内存已用百分比(0~100)", ""}, {KeyMemAvailablePercent, "内存剩余百分比(0~100)", ""}, }
KeyMemUsages TypeMetricMem 中的字段名称
View Source
var KeyNetStatUsages = KeyValueSlice{ {KeyNetstatTcpEstablished, "ESTABLISHED状态的网络链接数", ""}, {KeyNetstatTcpSynSent, "SYN_SENT状态的网络链接数", ""}, {KeyNetstatTcpSynRecv, "SYN_RECV状态的网络链接数", ""}, {KeyNetstatTcpFinWait1, "FIN_WAIT1状态的网络链接数", ""}, {KeyNetstatTcpFinWait2, "FIN_WAIT2状态的网络链接数", ""}, {KeyNetstatTcpTimeWait, "TIME_WAIT状态的网络链接数", ""}, {KeyNetstatTcpClose, "CLOSE状态的网络链接数", ""}, {KeyNetstatTcpCloseWait, "CLOSE_WAIT状态的网络链接数", ""}, {KeyNetstatTcpLastAck, "LAST_ACK状态的网络链接数", ""}, {KeyNetstatTcpListen, "LISTEN状态的网络链接数", ""}, {KeyNetstatTcpClosing, "CLOSING状态的网络链接数", ""}, {KeyNetstatTcpNone, "NONE状态的网络链接数", ""}, {KeyNetstatUdpSocket, "UDP状态的网络链接数", ""}, }
KeyNetStatUsages TypeMetricNetstat 的字段名称
View Source
var KeyNetUsages = KeyValueSlice{ {KeyNetBytesSent, "网卡发包总数(bytes)", ""}, {KeyNetBytesSentPerSec, "网卡发包速率(bytes/s)", ""}, {KeyNetBytesRecv, "网卡收包总数(bytes)", ""}, {KeyNetBytesRecvPerSec, "网卡收包速率(bytes/s)", ""}, {KeyNetPacketsSent, "网卡发包数量", ""}, {KeyNetPacketsSentPerSec, "每秒网卡发包数量", ""}, {KeyNetPacketsRecv, "网卡收包数量", ""}, {KeyNetPacketsRecvPerSec, "每秒网卡收包数量", ""}, {KeyNetErrIn, "网卡收包错误数量", ""}, {KeyNetErrOut, "网卡发包错误数量", ""}, {KeyNetDropIn, "网卡收 丢包数量", ""}, {KeyNetDropOut, "网卡发 丢包数量", ""}, {KeyNetInterface, "网卡设备名称", ""}, {KeyNetHWAddr, "网卡设备地址", ""}, }
KeyNetUsages TypeMetricNet 中的字段名称
View Source
var KeyProcUsages = models.KeyValueSlice{}
KeyProcUsages TypeMetricProc 中的字段名称
View Source
var KeyProcessesUsages = KeyValueSlice{ {KeyProcessesBlocked, "不可中断的睡眠状态下的进程数('U','D','L')", ""}, {KeyProcessesZombies, "僵尸态进程数('Z')", ""}, {KeyProcessesStopped, "暂停状态进程数('T')", ""}, {KeyProcessesRunning, "运行中的进程数('R')", ""}, {KeyProcessesSleeping, "可中断进程数('S')", ""}, {KeyProcessesTotal, "总进程数", ""}, {KeyProcessesIdle, "挂起的空闲进程数('I')", ""}, {KeyProcessesWait, "等待中的进程数('W')", ""}, {KeyProcessesDead, "回收中的进程数('X')", ""}, {KeyProcessesPaging, "分页进程数('P')", ""}, {KeyProcessesTotalThreads, "总线程数", ""}, {KeyProcessesUnknown, "未知状态进程数", ""}, }
KeyProcessesUsages TypeMetricProcesses 的字段名称
View Source
var KeySwapUsages = KeyValueSlice{ {KeySwapTotal, "Swap空间总量", ""}, {KeySwapUsed, "Swap已使用空间", ""}, {KeySwapFree, "Swap空闲空间", ""}, {KeySwapUsedPercent, "Swap使用空间占比", ""}, {KeySwapIn, "Swap空间换入数据量", ""}, {KeySwapOut, "Swap空间换出数据量", ""}, }
KeySwapUsages TypeMetricSwap 中的字段名称
View Source
var KeySysctlFsFieldNameMap = map[string]string{ KeyLinuxSysctlFsAioNr: "linux_sysctl_fs_aio_nr", KeyLinuxSysctlFsAioMaxNr: "linux_sysctl_fs_aio_max_nr", KeyLinuxSysctlFsDquotNr: "linux_sysctl_fs_dquot_nr", KeyLinuxSysctlFsDquotMax: "linux_sysctl_fs_dquot_max", KeyLinuxSysctlFsSuperNr: "linux_sysctl_fs_super_nr", KeyLinuxSysctlFsSuperMax: "linux_sysctl_fs_super_max", KeyLinuxSysctlFsInodeNr: "linux_sysctl_fs_inode_nr", KeyLinuxSysctlFsInodeFreeNr: "linux_sysctl_fs_inode_free_nr", KeyLinuxSysctlFsInodePreNr: "linux_sysctl_fs_inode_preshrink_nr", KeyLinuxSysctlFsDentryNr: "linux_sysctl_fs_dentry_nr", KeyLinuxSysctlFsDentryUnNr: "linux_sysctl_fs_dentry_unused_nr", KeyLinuxSysctlFsDetryAgeLimit: "linux_sysctl_fs_dentry_age_limit", KeyLinuxSysctlFsDentryWantPages: "linux_sysctl_fs_dentry_want_pages", KeyLinuxSysctlFsFileNr: "linux_sysctl_fs_file_nr", KeyLinuxSysctlFsFileMax: "linux_sysctl_fs_file_max", }
View Source
var KeySystemUsages = KeyValueSlice{ {KeySystemLoad1, "1分钟平均load值", ""}, {KeySystemLoad5, "5分钟平均load值", ""}, {KeySystemLoad15, "15分钟平均load值", ""}, {KeySystemNUsers, "用户数", ""}, {KeySystemNCpus, "CPU核数", ""}, {KeySystemUptime, "系统启动时间", ""}, {KeySystemUptimeFormat, "格式化的系统启动时间", ""}, {KeySystemNNetCards, "网卡数", ""}, {KeySystemNDisks, "磁盘数", ""}, {KeySystemNServices, "总服务数", ""}, }
KeySystemUsages TypeMetricSystem的字段名称
Functions ¶
func NewCreator ¶
Types ¶
type CPUStats ¶
type CollectInfo ¶
type DiskIOStats ¶
type DiskIOStats struct { Devices []string `json:"devices"` DeviceTags []string `json:"device_tags"` NameTemplates []string `json:"name_templates"` SkipSerialNumber bool `json:"skip_serial_number"` // contains filtered or unexported fields }
func (*DiskIOStats) Collect ¶
func (s *DiskIOStats) Collect() (datas []map[string]interface{}, err error)
func (*DiskIOStats) Config ¶
func (*DiskIOStats) Config() map[string]interface{}
func (*DiskIOStats) Name ¶
func (*DiskIOStats) Name() string
func (*DiskIOStats) Tags ¶
func (*DiskIOStats) Tags() []string
func (*DiskIOStats) Usages ¶
func (*DiskIOStats) Usages() string
type DiskStats ¶
type DiskStats struct { MountPoints []string `json:"mount_points"` IgnoreFS []string `json:"ignore_fs"` // contains filtered or unexported fields }
type DiskioCollectInfo ¶
type KernelVmstat ¶
type KernelVmstat struct {
// contains filtered or unexported fields
}
func (*KernelVmstat) Collect ¶
func (k *KernelVmstat) Collect() (datas []map[string]interface{}, err error)
func (*KernelVmstat) Config ¶
func (k *KernelVmstat) Config() map[string]interface{}
func (*KernelVmstat) Name ¶
func (k *KernelVmstat) Name() string
func (*KernelVmstat) Tags ¶
func (k *KernelVmstat) Tags() []string
func (*KernelVmstat) Usages ¶
func (k *KernelVmstat) Usages() string
type LinuxSystemStats ¶
type LinuxSystemStats struct {
SystemStats
}
func (*LinuxSystemStats) Collect ¶
func (s *LinuxSystemStats) Collect() (datas []map[string]interface{}, err error)
type MockPS ¶
type MockPS struct { mock.Mock PSDiskDeps }
func (*MockPS) NetConnections ¶
func (m *MockPS) NetConnections() ([]net.ConnectionStat, error)
type MockPSDisk ¶
func (MockPSDisk) DiskIO ¶
func (s MockPSDisk) DiskIO(names []string) (map[string]disk.IOCountersStat, error)
func (MockPSDisk) NetConnections ¶
func (s MockPSDisk) NetConnections() ([]net.ConnectionStat, error)
func (MockPSDisk) NetIO ¶
func (s MockPSDisk) NetIO() ([]net.IOCountersStat, error)
func (MockPSDisk) NetProto ¶
func (s MockPSDisk) NetProto() ([]net.ProtoCountersStat, error)
func (MockPSDisk) SwapStat ¶
func (s MockPSDisk) SwapStat() (*mem.SwapMemoryStat, error)
func (MockPSDisk) VMStat ¶
func (s MockPSDisk) VMStat() (*mem.VirtualMemoryStat, error)
type NetIOStats ¶
type NetIOStats struct { SkipProtoState bool `json:"skip_protocols_state"` Interfaces []string `json:"interfaces"` InterfacesMap map[string]net.Interface // contains filtered or unexported fields }
func (*NetIOStats) Collect ¶
func (s *NetIOStats) Collect() (datas []map[string]interface{}, err error)
func (*NetIOStats) Config ¶
func (*NetIOStats) Config() map[string]interface{}
func (*NetIOStats) Name ¶
func (*NetIOStats) Name() string
func (*NetIOStats) Tags ¶
func (*NetIOStats) Tags() []string
func (*NetIOStats) Usages ¶
func (*NetIOStats) Usages() string
type PS ¶
type PS interface { CPUTimes(perCPU, totalCPU bool) ([]cpu.TimesStat, error) DiskUsage(mountPointFilter []string, fstypeExclude []string) ([]*disk.UsageStat, []*disk.PartitionStat, error) NetIO() ([]net.IOCountersStat, error) NetProto() ([]net.ProtoCountersStat, error) DiskIO(names []string) (map[string]disk.IOCountersStat, error) VMStat() (*mem.VirtualMemoryStat, error) SwapStat() (*mem.SwapMemoryStat, error) NetConnections() ([]net.ConnectionStat, error) }
type PSDiskDeps ¶
type ProcessInfo ¶
type ProcessInfo struct { Pid PID Status int Process // contains filtered or unexported fields }
func (*ProcessInfo) Name ¶
func (p *ProcessInfo) Name() (string, error)
linux 和 mac 使用原来的会截断,例如 java 和 python 脚本程序只会显示java和python 现在top 和 supervised的程序会自己设置name,没有再走原来的逻辑
type Processes ¶
type Processes struct {
// contains filtered or unexported fields
}
type Procstat ¶
type Procstat struct { PidTag bool Prefix string ProcessName string MemRelated bool `json:"mem_related"` IoRelated bool `json:"io_related"` CtxSwitRelated bool `json:"context_switch_related"` ThreadsRelated bool `json:"threads_related"` FileDescRelated bool `json:"file_descriptor_related"` CpuTimeRelated bool `json:"cpu_time_related"` CpuUsageRelated bool `json:"cpu_usage_related"` ResourceLimits bool `json:"resource_limits"` CpuTop10 bool `json:"cpu_top_10"` MemTop10 bool `json:"mem_top_10"` Supervisord bool `json:"supervisord"` DaemonTools bool `json:"daemon_tools"` PidFile string `json:"pid_file"` Exe string `json:"exe"` Self bool `json:"self"` Pattern string `json:"pattern"` User string `json:"user"` SystemdUnit string `json:"system_unit"` CGroup string `json:"cgroup"` // contains filtered or unexported fields }
func (*Procstat) SupervisordStat ¶
func (*Procstat) SyncConfig ¶
type SwapStats ¶
type SwapStats struct {
// contains filtered or unexported fields
}
type SysctlFS ¶
type SysctlFS struct {
// contains filtered or unexported fields
}
type SystemStats ¶
type SystemStats struct { }
func (*SystemStats) Collect ¶
func (s *SystemStats) Collect() (datas []map[string]interface{}, err error)
func (*SystemStats) Config ¶
func (s *SystemStats) Config() map[string]interface{}
func (*SystemStats) Name ¶
func (*SystemStats) Name() string
func (*SystemStats) Tags ¶
func (*SystemStats) Tags() []string
func (*SystemStats) Usages ¶
func (*SystemStats) Usages() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.