system

package
v1.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2018 License: Apache-2.0 Imports: 28 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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"
	KeyDiskioReadBytes      = "diskio_read_bytes"
	KeyDiskioWriteBytes     = "diskio_write_bytes"
	KeyDiskioReadTime       = "diskio_read_time"
	KeyDiskioWriteTime      = "diskio_write_time"
	KeyDiskioIoTime         = "diskio_io_time"
	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 = "CPU(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"
	KeyNetBytesRecv   = "net_bytes_recv"
	KeyNetPacketsSent = "net_packets_sent"
	KeyNetPacketsRecv = "net_packets_recv"
	KeyNetErrIn       = "net_err_in"
	KeyNetErrOut      = "net_err_out"
	KeyNetDropIn      = "net_drop_in"
	KeyNetDropOut     = "net_drop_out"
	KeyNetInterface   = "net_interface"
)
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_tcp_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"
	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 (
	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_update_format"
)

Variables

View Source
var ConfigCpuUsages = []KeyValue{
	{CpuConfigPerCpu, "是否收集每个 cpu 的统计数据(" + CpuConfigPerCpu + ")"},
	{CpuConfigTotalCpu, "是否收集整个系统的 cpu 统计信息(" + CpuConfigTotalCpu + ")"},
	{CpuConfigCollectCpuTime, "是否收集 cpu 时间统计信息(" + CpuConfigCollectCpuTime + ")"},
}

ConfigCpuUsages TypeMetricCpu 配置项的描述

View Source
var ConfigDiskUsages = []KeyValue{
	{ConfigDiskIgnoreFs, "忽略的挂载点,用','分隔(" + ConfigDiskIgnoreFs + ")"},
	{ConfigDiskMountPoints, "收集特定挂载点信息,默认收集所有挂载点,用','分隔(" + ConfigDiskMountPoints + ")"},
}

ConfigDiskUsages TypeMetricDisk config 中的字段描述

View Source
var ConfigDiskioUsages = []KeyValue{
	{ConfigDiskioDevices, "获取特定设备的信息,用','隔开(" + ConfigDiskioDevices + ")"},
	{ConfigDiskioDeviceTags, "采集磁盘某些tag的信息,用','隔开(" + ConfigDiskioDeviceTags + ")"},
	{ConfigDiskioNameTemplates, "一些尝试加入设备的模板列表,用','隔开(" + ConfigDiskioNameTemplates + ")"},
	{ConfigDiskioSkipSerialNumber, "是否忽略磁盘序列号(" + ConfigDiskioSkipSerialNumber + ")"},
}

ConfigDiskioUsages TypeMetricDiskio 配置项描述

View Source
var ConfigProcUsages = []models.Option{
	{
		KeyName:       "cpu_usage_related",
		ChooseOnly:    true,
		ChooseOptions: []interface{}{"true", "false"},
		Default:       "true",
		Description:   "收集Cpu用量相关的信息(cpu_usage_related)",
		Type:          metric.ConfigTypeBool,
	},
	{
		KeyName:       "mem_related",
		ChooseOnly:    true,
		ChooseOptions: []interface{}{"true", "false"},
		Default:       "true",
		Description:   "收集内存相关的信息(mem_related)",
		Type:          metric.ConfigTypeBool,
	},
	{
		KeyName:       "cpu_time_related",
		ChooseOnly:    true,
		ChooseOptions: []interface{}{"false", "true"},
		Default:       "false",
		Description:   "收集CPU时间相关的信息(cpu_time_related)",
		Type:          metric.ConfigTypeBool,
	},
	{
		KeyName:       "io_related",
		ChooseOnly:    true,
		ChooseOptions: []interface{}{"true", "false"},
		Default:       "true",
		Description:   "收集IO相关的信息(io_related)",
		Type:          metric.ConfigTypeBool,
	},
	{
		KeyName:       "threads_related",
		ChooseOnly:    true,
		ChooseOptions: []interface{}{"false", "true"},
		Default:       "false",
		Description:   "收集线程数量(threads_related)",
		Type:          metric.ConfigTypeBool,
	},
	{
		KeyName:       "context_switch_related",
		ChooseOnly:    true,
		ChooseOptions: []interface{}{"false", "true"},
		Default:       "false",
		Description:   "收集内核上下文切换次数(context_switch_related)",
		Type:          metric.ConfigTypeBool,
	},
	{
		KeyName:       "file_descriptor_related",
		ChooseOnly:    true,
		ChooseOptions: []interface{}{"false", "true"},
		Default:       "false",
		Description:   "收集文件描述相关信息(file_descriptor_related)",
		Type:          metric.ConfigTypeBool,
	},
	{
		KeyName:       "resource_limits",
		ChooseOnly:    true,
		ChooseOptions: []interface{}{"false", "true"},
		Default:       "false",
		Description:   "收集资源限制相关的信息(resource_limits)",
		Type:          metric.ConfigTypeBool,
	},
	{
		KeyName:       "cpu_top_10",
		ChooseOnly:    true,
		ChooseOptions: []interface{}{"false", "true"},
		Default:       "false",
		Description:   "收集CPU利用率前10的进程(cpu_top_10)",
		Type:          metric.ConfigTypeBool,
	},
	{
		KeyName:       "mem_top_10",
		ChooseOnly:    true,
		ChooseOptions: []interface{}{"false", "true"},
		Default:       "false",
		Description:   "收集内存占用前10的进程(mem_top_10)",
		Type:          metric.ConfigTypeBool,
	},
	{
		KeyName:       "supervisord",
		ChooseOnly:    true,
		ChooseOptions: []interface{}{"false", "true"},
		Default:       "false",
		Description:   "收集supervisord管理的进程(supervisord)",
		Type:          metric.ConfigTypeBool,
	},
	{
		KeyName:       "daemon_tools",
		ChooseOnly:    true,
		ChooseOptions: []interface{}{"false", "true"},
		Default:       "false",
		Description:   "收集daemontools管理的进程(daemon_tools)",
		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 = []KeyValue{

	{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 = []KeyValue{
	{KeyDiskPath, "磁盘路径"},
	{KeyDiskDevice, "磁盘设备名"},
	{KeyDiskFstype, "文件系统类型"},
	{KeyDiskTotal, "磁盘总大小"},
	{KeyDiskFree, "磁盘剩余大小"},
	{KeyDiskUsed, "磁盘用量"},
	{KeyDiskUsedPercent, "磁盘已用百分比"},
	{KeyDiskInodesTotal, "总inode数量"},
	{KeyDiskInodesFree, "空闲的inode数量"},
	{KeyDiskInodesUsed, "适用的inode数量"},
}

KeyDiskUsages TypeMetricDisk 字段名称

View Source
var KeyDiskioUsages = []KeyValue{
	{KeyDiskioReads, "磁盘被读的总次数"},
	{KeyDiskioWrites, "磁盘被写的总次数"},
	{KeyDiskioReadBytes, "读取的总数据量"},
	{KeyDiskioWriteBytes, "写入的总数据量"},
	{KeyDiskioReadTime, "磁盘读取总用时"},
	{KeyDiskioWriteTime, "磁盘写入总用时"},
	{KeyDiskioIoTime, "io总时间"},
	{KeyDiskioIopsInProgress, "运行中的每秒IO数据量"},
	{KeyDiskioName, "磁盘名称"},
}

KeyDiskioUsages TypeMetricDiskio 中的字段名称

View Source
var KeyKernelUsages = []KeyValue{
	{KernelInterrupts, "内核中断次数"},
	{KernelContextSwitches, "内核上下文切换次数"},
	{KernelProcessesForked, "fork的进程数"},
	{KernelBootTime, "内核启动时间"},
	{KernelDiskPagesIn, "磁盘换入数量"},
	{KernelDiskPagesOut, "磁盘换出数量"},
}

KeyKernelUsages TypeMetricKernel 中的字段名称

View Source
var KeyLinuxSysctlFsUsage = []KeyValue{
	{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 = []KeyValue{
	{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 = []KeyValue{
	{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 = []KeyValue{
	{KeyNetBytesSent, "网卡发包总数(bytes)"},
	{KeyNetBytesRecv, "网卡收包总数(bytes)"},
	{KeyNetPacketsSent, "网卡发包数量"},
	{KeyNetPacketsRecv, "网卡收包数量"},
	{KeyNetErrIn, "网卡收包错误数量"},
	{KeyNetErrOut, "网卡发包错误数量"},
	{KeyNetDropIn, "网卡收 丢包数量"},
	{KeyNetDropOut, "网卡发 丢包数量"},
	{KeyNetInterface, "网卡设备名称"},
}

KeyNetUsages TypeMetricNet 中的字段名称

View Source
var KeyProcUsages = []models.KeyValue{}

KeyProcUsages TypeMetricProc 中的字段名称

View Source
var KeyProcessesUsages = []KeyValue{
	{KeyProcessesBlocked, "不可中断的睡眠状态下的进程数('U','D','L')"},
	{KeyProcessesZombies, "僵尸态进程数('Z')"},
	{KeyProcessesStopped, "暂停状态进程数('T')"},
	{KeyProcessesRunning, "运行中的进程数('R')"},
	{KeyProcessesSleeping, "可中断进程数('S')"},
	{KeyProcessesTotal, "总进程数"},
	{KeyProcessesIdle, "挂起的空闲进程数('I')"},
	{KeyProcessesWait, "等待中的进程数('W')"},
	{KeyProcessesDead, "回收中的进程数('X')"},
	{KeyProcessesPaging, "等待中的进程数('W')"},
	{KeyProcessesTotalThreads, "总线程数"},
	{KeyProcessesUnknown, "未知状态进程数"},
}

KeyProcessesUsages TypeMetricProcesses 的字段名称

View Source
var KeySwapUsages = []KeyValue{
	{KeySwapTotal, "Swap空间总量"},
	{KeySwapUsed, "Swap已使用空间"},
	{KeySwapFree, "Swap空闲空间"},
	{KeySwapUsedPercent, "used percent"},
	{KeySwapIn, "swap in"},
	{KeySwapOut, "swap out"},
}

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 = []KeyValue{
	{KeySystemLoad1, "1分钟平均load值"},
	{KeySystemLoad5, "5分钟平均load值"},
	{KeySystemLoad15, "15分钟平均load值"},
	{KeySystemNUsers, "用户数"},
	{KeySystemNCpus, "CPU核数"},
	{KeySystemUptime, "系统启动时间"},
	{KeySystemUptimeFormat, "格式化的系统启动时间"},
}

KeySystemUsages TypeMetricSystem的字段名称

Functions

This section is empty.

Types

type CPUStats

type CPUStats struct {
	PerCPU         bool `json:"per_cpu"`
	TotalCPU       bool `json:"total_cpu"`
	CollectCPUTime bool `json:"collect_cpu_time"`
	// contains filtered or unexported fields
}

func (*CPUStats) Collect

func (s *CPUStats) Collect() (datas []map[string]interface{}, err error)

func (*CPUStats) Config added in v1.3.6

func (_ *CPUStats) Config() map[string]interface{}

func (*CPUStats) Name

func (_ *CPUStats) Name() string

func (*CPUStats) Tags added in v1.4.0

func (_ *CPUStats) Tags() []string

func (*CPUStats) Usages added in v1.3.6

func (_ *CPUStats) Usages() string

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 added in v1.3.6

func (_ *DiskIOStats) Config() map[string]interface{}

func (*DiskIOStats) Name

func (_ *DiskIOStats) Name() string

func (*DiskIOStats) Tags added in v1.4.0

func (_ *DiskIOStats) Tags() []string

func (*DiskIOStats) Usages added in v1.3.6

func (_ *DiskIOStats) Usages() string

type DiskStats

type DiskStats struct {
	MountPoints []string `json:"mount_points"`
	IgnoreFS    []string `json:"ignore_fs"`
	// contains filtered or unexported fields
}

func (*DiskStats) Collect

func (s *DiskStats) Collect() (datas []map[string]interface{}, err error)

func (*DiskStats) Config added in v1.3.6

func (_ *DiskStats) Config() map[string]interface{}

func (*DiskStats) Name

func (_ *DiskStats) Name() string

func (*DiskStats) Tags added in v1.4.0

func (_ *DiskStats) Tags() []string

func (*DiskStats) Usages added in v1.3.6

func (_ *DiskStats) Usages() string

type Kernel

type Kernel struct {
	// contains filtered or unexported fields
}

func (*Kernel) Collect

func (k *Kernel) Collect() (datas []map[string]interface{}, err error)

func (*Kernel) Config added in v1.3.6

func (k *Kernel) Config() map[string]interface{}

func (*Kernel) Name

func (k *Kernel) Name() string

func (*Kernel) Tags added in v1.4.0

func (_ *Kernel) Tags() []string

func (*Kernel) Usages added in v1.3.6

func (k *Kernel) Usages() string

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 added in v1.3.6

func (k *KernelVmstat) Config() map[string]interface{}

func (*KernelVmstat) Name

func (k *KernelVmstat) Name() string

func (*KernelVmstat) Tags added in v1.4.0

func (k *KernelVmstat) Tags() []string

func (*KernelVmstat) Usages added in v1.3.6

func (k *KernelVmstat) Usages() string

type MemStats

type MemStats struct {
	// contains filtered or unexported fields
}

func (*MemStats) Collect

func (s *MemStats) Collect() (datas []map[string]interface{}, err error)

func (*MemStats) Config added in v1.3.6

func (_ *MemStats) Config() map[string]interface{}

func (*MemStats) Name

func (_ *MemStats) Name() string

func (*MemStats) Tags added in v1.4.0

func (_ *MemStats) Tags() []string

func (*MemStats) Usages added in v1.3.6

func (_ *MemStats) Usages() string

type MockPS

type MockPS struct {
	mock.Mock
	PSDiskDeps
}

func (*MockPS) CPUTimes

func (m *MockPS) CPUTimes(perCPU, totalCPU bool) ([]cpu.TimesStat, error)

func (*MockPS) DiskIO

func (m *MockPS) DiskIO(names []string) (map[string]disk.IOCountersStat, error)

func (*MockPS) DiskUsage

func (m *MockPS) DiskUsage(mountPointFilter []string, fstypeExclude []string) ([]*disk.UsageStat, []*disk.PartitionStat, error)

func (*MockPS) LoadAvg

func (m *MockPS) LoadAvg() (*load.AvgStat, error)

func (*MockPS) NetConnections

func (m *MockPS) NetConnections() ([]net.ConnectionStat, error)

func (*MockPS) NetIO

func (m *MockPS) NetIO() ([]net.IOCountersStat, error)

func (*MockPS) NetProto

func (m *MockPS) NetProto() ([]net.ProtoCountersStat, error)

func (*MockPS) SwapStat

func (m *MockPS) SwapStat() (*mem.SwapMemoryStat, error)

func (*MockPS) VMStat

func (m *MockPS) VMStat() (*mem.VirtualMemoryStat, error)

type MockPSDisk

type MockPSDisk struct {
	*mock.Mock
	// contains filtered or unexported fields
}

func (MockPSDisk) CPUTimes

func (s MockPSDisk) CPUTimes(perCPU, totalCPU bool) ([]cpu.TimesStat, error)

func (MockPSDisk) DiskIO

func (s MockPSDisk) DiskIO(names []string) (map[string]disk.IOCountersStat, error)

func (MockPSDisk) DiskUsage

func (s MockPSDisk) DiskUsage(
	mountPointFilter []string,
	fstypeExclude []string,
) ([]*disk.UsageStat, []*disk.PartitionStat, 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 {
	Interfaces []string `json:"interfaces"`
	// contains filtered or unexported fields
}

func (*NetIOStats) Collect

func (s *NetIOStats) Collect() (datas []map[string]interface{}, err error)

func (*NetIOStats) Config added in v1.3.6

func (_ *NetIOStats) Config() map[string]interface{}

func (*NetIOStats) Name

func (_ *NetIOStats) Name() string

func (*NetIOStats) Tags added in v1.4.0

func (_ *NetIOStats) Tags() []string

func (*NetIOStats) Usages added in v1.3.6

func (_ *NetIOStats) Usages() string

type NetStats

type NetStats struct {
	// contains filtered or unexported fields
}

func (*NetStats) Collect

func (s *NetStats) Collect() (datas []map[string]interface{}, err error)

func (*NetStats) Config added in v1.3.6

func (_ *NetStats) Config() map[string]interface{}

func (*NetStats) Name

func (_ *NetStats) Name() string

func (*NetStats) Tags added in v1.4.0

func (_ *NetStats) Tags() []string

func (*NetStats) Usages added in v1.3.6

func (_ *NetStats) 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 PSDiskDeps interface {
	Partitions(all bool) ([]disk.PartitionStat, error)
	OSGetenv(key string) string
	OSStat(name string) (os.FileInfo, error)
	PSDiskUsage(path string) (*disk.UsageStat, error)
}

type Processes

type Processes struct {
	// contains filtered or unexported fields
}

func (*Processes) Collect

func (p *Processes) Collect() (datas []map[string]interface{}, err error)

func (*Processes) Config added in v1.3.6

func (_ *Processes) Config() map[string]interface{}

func (*Processes) Name

func (p *Processes) Name() string

func (*Processes) Tags added in v1.4.0

func (_ *Processes) Tags() []string

func (*Processes) Usages added in v1.3.6

func (p *Processes) Usages() string

type Procstat added in v1.4.3

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"`
	Pattern     string `json:"pattern"`
	User        string `json:"user"`
	SystemdUnit string `json:"system_unit"`
	CGroup      string `json:"cgroup"`
	// contains filtered or unexported fields
}

func (*Procstat) Collect added in v1.4.3

func (p *Procstat) Collect() (datas []map[string]interface{}, err error)

func (*Procstat) Config added in v1.4.3

func (p *Procstat) Config() map[string]interface{}

func (*Procstat) Name added in v1.4.3

func (p *Procstat) Name() string

func (*Procstat) PCpuTop10 added in v1.4.3

func (p *Procstat) PCpuTop10() (pids []PID, err error)

func (*Procstat) PMemTop10 added in v1.4.3

func (p *Procstat) PMemTop10() (pids []PID, err error)

func (*Procstat) Tags added in v1.4.3

func (p *Procstat) Tags() []string

func (*Procstat) Usages added in v1.4.3

func (p *Procstat) Usages() string

type SwapStats

type SwapStats struct {
	// contains filtered or unexported fields
}

func (*SwapStats) Collect

func (s *SwapStats) Collect() (datas []map[string]interface{}, err error)

func (*SwapStats) Config added in v1.3.6

func (_ *SwapStats) Config() map[string]interface{}

func (*SwapStats) Name

func (_ *SwapStats) Name() string

func (*SwapStats) Tags added in v1.4.0

func (_ *SwapStats) Tags() []string

func (*SwapStats) Usages added in v1.3.6

func (_ *SwapStats) Usages() string

type SysctlFS

type SysctlFS struct {
	// contains filtered or unexported fields
}

https://www.kernel.org/doc/Documentation/sysctl/fs.txt

func (*SysctlFS) Collect

func (sfs *SysctlFS) Collect() (datas []map[string]interface{}, err error)

func (*SysctlFS) Config added in v1.3.6

func (_ *SysctlFS) Config() map[string]interface{}

func (*SysctlFS) Name

func (_ *SysctlFS) Name() string

func (*SysctlFS) Tags added in v1.4.0

func (_ *SysctlFS) Tags() []string

func (*SysctlFS) Usages added in v1.3.6

func (_ *SysctlFS) Usages() string

type SystemStats

type SystemStats struct {
}

func (*SystemStats) Collect

func (_ *SystemStats) Collect() (datas []map[string]interface{}, err error)

func (*SystemStats) Config added in v1.3.6

func (s *SystemStats) Config() map[string]interface{}

func (*SystemStats) Name

func (_ *SystemStats) Name() string

func (*SystemStats) Tags added in v1.4.0

func (_ *SystemStats) Tags() []string

func (*SystemStats) Usages added in v1.3.6

func (_ *SystemStats) Usages() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL