Documentation ¶
Overview ¶
Package collector includes all individual collectors to gather and export system metrics.
Index ¶
- Constants
- Variables
- func DisableDefaultCollectors()
- func IsNoDataError(err error) bool
- func SanitizeMetricName(metricName string) string
- type Collector
- func GetAllCollector() []Collector
- func NewARPCollector(logger log.Logger) (Collector, error)
- func NewBcacheCollector(logger log.Logger) (Collector, error)
- func NewBondingCollector(logger log.Logger) (Collector, error)
- func NewBtrfsCollector(logger log.Logger) (Collector, error)
- func NewBuddyinfoCollector(logger log.Logger) (Collector, error)
- func NewCPUCollector(logger log.Logger) (Collector, error)
- func NewCPUFreqCollector(logger log.Logger) (Collector, error)
- func NewCgroupSummaryCollector(logger log.Logger) (Collector, error)
- func NewConntrackCollector(logger log.Logger) (Collector, error)
- func NewDMICollector(logger log.Logger) (Collector, error)
- func NewDiskstatsCollector(logger log.Logger) (Collector, error)
- func NewDrmCollector(logger log.Logger) (Collector, error)
- func NewEdacCollector(logger log.Logger) (Collector, error)
- func NewEntropyCollector(logger log.Logger) (Collector, error)
- func NewEthtoolCollector(logger log.Logger) (Collector, error)
- func NewFibreChannelCollector(logger log.Logger) (Collector, error)
- func NewFileFDStatCollector(logger log.Logger) (Collector, error)
- func NewFilesystemCollector(logger log.Logger) (Collector, error)
- func NewHwMonCollector(logger log.Logger) (Collector, error)
- func NewIPVSCollector(logger log.Logger) (Collector, error)
- func NewInfiniBandCollector(logger log.Logger) (Collector, error)
- func NewInterruptsCollector(logger log.Logger) (Collector, error)
- func NewKsmdCollector(logger log.Logger) (Collector, error)
- func NewLnstatCollector(logger log.Logger) (Collector, error)
- func NewLoadavgCollector(logger log.Logger) (Collector, error)
- func NewLogindCollector(logger log.Logger) (Collector, error)
- func NewMdadmCollector(logger log.Logger) (Collector, error)
- func NewMeminfoCollector(logger log.Logger) (Collector, error)
- func NewMeminfoNumaCollector(logger log.Logger) (Collector, error)
- func NewMountStatsCollector(logger log.Logger) (Collector, error)
- func NewNFSdCollector(logger log.Logger) (Collector, error)
- func NewNVMeCollector(logger log.Logger) (Collector, error)
- func NewNetClassCollector(logger log.Logger) (Collector, error)
- func NewNetDevCollector(logger log.Logger) (Collector, error)
- func NewNetStatCollector(logger log.Logger) (Collector, error)
- func NewNetworkRouteCollector(logger log.Logger) (Collector, error)
- func NewNfsCollector(logger log.Logger) (Collector, error)
- func NewNtpCollector(logger log.Logger) (Collector, error)
- func NewOSCollector(logger log.Logger) (Collector, error)
- func NewPerfCollector(logger log.Logger) (Collector, error)
- func NewPowerSupplyClassCollector(logger log.Logger) (Collector, error)
- func NewPressureStatsCollector(logger log.Logger) (Collector, error)
- func NewProcessStatCollector(logger log.Logger) (Collector, error)
- func NewQdiscStatCollector(logger log.Logger) (Collector, error)
- func NewRaplCollector(logger log.Logger) (Collector, error)
- func NewRunitCollector(logger log.Logger) (Collector, error)
- func NewSchedstatCollector(logger log.Logger) (Collector, error)
- func NewSelinuxCollector(logger log.Logger) (Collector, error)
- func NewSlabinfoCollector(logger log.Logger) (Collector, error)
- func NewSockStatCollector(logger log.Logger) (Collector, error)
- func NewSoftirqsCollector(logger log.Logger) (Collector, error)
- func NewSoftnetCollector(logger log.Logger) (Collector, error)
- func NewStatCollector(logger log.Logger) (Collector, error)
- func NewSupervisordCollector(logger log.Logger) (Collector, error)
- func NewSysctlCollector(logger log.Logger) (Collector, error)
- func NewSystemdCollector(logger log.Logger) (Collector, error)
- func NewTCPStatCollector(logger log.Logger) (Collector, error)
- func NewTapestatsCollector(logger log.Logger) (Collector, error)
- func NewTextFileCollector(logger log.Logger) (Collector, error)
- func NewThermalZoneCollector(logger log.Logger) (Collector, error)
- func NewTimeCollector(logger log.Logger) (Collector, error)
- func NewTimexCollector(logger log.Logger) (Collector, error)
- func NewUDPqueuesCollector(logger log.Logger) (Collector, error)
- func NewVulnerabilitySysfsCollector(logger log.Logger) (Collector, error)
- func NewWifiCollector(logger log.Logger) (Collector, error)
- func NewXFSCollector(logger log.Logger) (Collector, error)
- func NewZFSCollector(logger log.Logger) (Collector, error)
- func NewZoneinfoCollector(logger log.Logger) (Collector, error)
- func NewvmStatCollector(logger log.Logger) (Collector, error)
- type DesignedProcessInfo
- type Dict
- type Ethtool
- type FileCheckCollector
- type FileCheckInfo
- type InetDiagMsg
- type InetDiagReqV2
- type InetDiagSockID
- type NetworkCollector
- type NetworkInfo
- type NodeCollector
- type Plist
- type ProcessCollector
- type ProcessInfo
- type ShellConfig
- type Shell_Script
Constants ¶
const ( DT_All = iota DT_Add DT_Changed DT_Delete )
定义数据变化值
const ( NET_Listen = iota NET_Income NET_Outcome )
连接的方向
Variables ¶
var ErrNoData = errors.New("collector returned no data")
ErrNoData indicates the collector found no data to collect, but had no other error.
Functions ¶
func DisableDefaultCollectors ¶
func DisableDefaultCollectors()
DisableDefaultCollectors sets the collector state to false for all collectors which have not been explicitly enabled on the command line.
func IsNoDataError ¶
func SanitizeMetricName ¶
SanitizeMetricName sanitize the given metric name by replacing invalid characters by underscores.
OpenMetrics and the Prometheus exposition format require the metric name to consist only of alphanumericals and "_", ":" and they must not start with digits. Since colons in MetricFamily are reserved to signal that the MetricFamily is the result of a calculation or aggregation of a general purpose monitoring system, colons will be replaced as well.
Note: If not subsequently prepending a namespace and/or subsystem (e.g., with prometheus.BuildFQName), the caller must ensure that the supplied metricName does not begin with a digit.
Types ¶
type Collector ¶
type Collector interface { // Get new metrics and expose them via prometheus registry. Update(ch chan<- prometheus.Metric) error }
Collector is the interface a collector has to implement.
func GetAllCollector ¶
func GetAllCollector() []Collector
func NewARPCollector ¶
NewARPCollector returns a new Collector exposing ARP stats.
func NewBcacheCollector ¶
NewBcacheCollector returns a newly allocated bcacheCollector. It exposes a number of Linux bcache statistics.
func NewBondingCollector ¶
NewBondingCollector returns a newly allocated bondingCollector. It exposes the number of configured and active slave of linux bonding interfaces.
func NewBtrfsCollector ¶
NewBtrfsCollector returns a new Collector exposing Btrfs statistics.
func NewBuddyinfoCollector ¶
NewBuddyinfoCollector returns a new Collector exposing buddyinfo stats.
func NewCPUCollector ¶
NewCPUCollector returns a new Collector exposing kernel/system statistics.
func NewCPUFreqCollector ¶
NewCPUFreqCollector returns a new Collector exposing kernel/system statistics.
func NewCgroupSummaryCollector ¶
NewCgroupSummaryCollector returns a new Collector exposing a summary of cgroups.
func NewConntrackCollector ¶
NewConntrackCollector returns a new Collector exposing conntrack stats.
func NewDMICollector ¶
NewDMICollector returns a new Collector exposing DMI information.
func NewDiskstatsCollector ¶
NewDiskstatsCollector returns a new Collector exposing disk device stats. Docs from https://www.kernel.org/doc/Documentation/iostats.txt
func NewDrmCollector ¶
NewDrmCollector returns a new Collector exposing /sys/class/drm/card?/device stats.
func NewEdacCollector ¶
NewEdacCollector returns a new Collector exposing edac stats.
func NewEntropyCollector ¶
NewEntropyCollector returns a new Collector exposing entropy stats.
func NewEthtoolCollector ¶
NewEthtoolCollector returns a new Collector exposing ethtool stats.
func NewFibreChannelCollector ¶
NewFibreChannelCollector returns a new Collector exposing FibreChannel stats.
func NewFileFDStatCollector ¶
NewFileFDStatCollector returns a new Collector exposing file-nr stats.
func NewFilesystemCollector ¶
NewFilesystemCollector returns a new Collector exposing filesystems stats.
func NewHwMonCollector ¶
NewHwMonCollector returns a new Collector exposing /sys/class/hwmon stats (similar to lm-sensors).
func NewIPVSCollector ¶
NewIPVSCollector sets up a new collector for IPVS metrics. It accepts the "procfs" config parameter to override the default proc location (/proc).
func NewInfiniBandCollector ¶
NewInfiniBandCollector returns a new Collector exposing InfiniBand stats.
func NewInterruptsCollector ¶
NewInterruptsCollector returns a new Collector exposing interrupts stats.
func NewKsmdCollector ¶
NewKsmdCollector returns a new Collector exposing kernel/system statistics.
func NewLoadavgCollector ¶
NewLoadavgCollector returns a new Collector exposing load average stats.
func NewLogindCollector ¶
NewLogindCollector returns a new Collector exposing logind statistics.
func NewMdadmCollector ¶
NewMdadmCollector returns a new Collector exposing raid statistics.
func NewMeminfoCollector ¶
NewMeminfoCollector returns a new Collector exposing memory stats.
func NewMeminfoNumaCollector ¶
NewMeminfoNumaCollector returns a new Collector exposing memory stats.
func NewMountStatsCollector ¶
NewMountStatsCollector returns a new Collector exposing NFS statistics.
func NewNFSdCollector ¶
NewNFSdCollector returns a new Collector exposing /proc/net/rpc/nfsd statistics.
func NewNVMeCollector ¶
NewNVMeCollector returns a new Collector exposing NVMe stats.
func NewNetClassCollector ¶
NewNetClassCollector returns a new Collector exposing network class stats.
func NewNetDevCollector ¶
NewNetDevCollector returns a new Collector exposing network device stats.
func NewNetStatCollector ¶
NewNetStatCollector takes and returns a new Collector exposing network stats.
func NewNetworkRouteCollector ¶
NewNetworkRouteCollector returns a new Collector exposing systemd statistics.
func NewNfsCollector ¶
NewNfsCollector returns a new Collector exposing NFS statistics.
func NewNtpCollector ¶
NewNtpCollector returns a new Collector exposing sanity of local NTP server. Default definition of "local" is: - collector.ntp.server address is a loopback address (or collector.ntp.server-is-mine flag is turned on) - the server is reachable with outgoin IP_TTL = 1
func NewOSCollector ¶
NewOSCollector returns a new Collector exposing os-release information.
func NewPerfCollector ¶
NewPerfCollector returns a new perf based collector, it creates a profiler per CPU.
func NewPressureStatsCollector ¶
NewPressureStatsCollector returns a Collector exposing pressure stall information
func NewProcessStatCollector ¶
NewProcessStatCollector returns a new Collector exposing process data read from the proc filesystem.
func NewQdiscStatCollector ¶
NewQdiscStatCollector returns a new Collector exposing queuing discipline statistics.
func NewRaplCollector ¶
NewRaplCollector returns a new Collector exposing RAPL metrics.
func NewRunitCollector ¶
NewRunitCollector returns a new Collector exposing runit statistics.
func NewSchedstatCollector ¶
NewSchedstatCollector returns a new Collector exposing task scheduler statistics
func NewSelinuxCollector ¶
NewSelinuxCollector returns a new Collector exposing SELinux statistics.
func NewSockStatCollector ¶
NewSockStatCollector returns a new Collector exposing socket stats.
func NewSoftirqsCollector ¶
NewSoftirqsCollector returns a new Collector exposing softirq stats.
func NewSoftnetCollector ¶
NewSoftnetCollector returns a new Collector exposing softnet metrics.
func NewStatCollector ¶
NewStatCollector returns a new Collector exposing kernel/system statistics.
func NewSupervisordCollector ¶
NewSupervisordCollector returns a new Collector exposing supervisord statistics.
func NewSystemdCollector ¶
NewSystemdCollector returns a new Collector exposing systemd statistics.
func NewTCPStatCollector ¶
NewTCPStatCollector returns a new Collector exposing network stats.
func NewTapestatsCollector ¶
NewTapestatsCollector returns a new Collector exposing tape device stats. Docs from https://www.kernel.org/doc/html/latest/scsi/st.html#sysfs-and-statistics-for-tape-devices
func NewTextFileCollector ¶
NewTextFileCollector returns a new Collector exposing metrics read from files in the given textfile directory.
func NewThermalZoneCollector ¶
NewThermalZoneCollector returns a new Collector exposing kernel/system statistics.
func NewTimeCollector ¶
NewTimeCollector returns a new Collector exposing the current system time in seconds since epoch.
func NewTimexCollector ¶
NewTimexCollector returns a new Collector exposing adjtime(3) stats.
func NewUDPqueuesCollector ¶
NewUDPqueuesCollector returns a new Collector exposing network udp queued bytes.
func NewWifiCollector ¶
NewWifiCollector returns a new Collector exposing Wifi statistics.
func NewXFSCollector ¶
NewXFSCollector returns a new Collector exposing XFS statistics.
func NewZFSCollector ¶
NewZFSCollector returns a new Collector exposing ZFS statistics.
func NewZoneinfoCollector ¶
NewZoneinfoCollector returns a new Collector exposing zone stats.
type DesignedProcessInfo ¶ added in v1.6.14
type DesignedProcessInfo struct {
// contains filtered or unexported fields
}
type FileCheckCollector ¶ added in v1.6.16
type FileCheckCollector struct {
// contains filtered or unexported fields
}
func (*FileCheckCollector) Update ¶ added in v1.6.16
func (collector *FileCheckCollector) Update(ch chan<- prometheus.Metric) error
type FileCheckInfo ¶ added in v1.6.16
type FileCheckInfo struct {
// contains filtered or unexported fields
}
type InetDiagMsg ¶
type InetDiagReqV2 ¶
type InetDiagReqV2 struct { Family uint8 Protocol uint8 Ext uint8 Pad uint8 States uint32 ID InetDiagSockID }
InetDiagReqV2 (inet_diag_req_v2) is used to request diagnostic data. https://github.com/torvalds/linux/blob/v4.0/include/uapi/linux/inet_diag.h#L37
func (*InetDiagReqV2) Len ¶
func (req *InetDiagReqV2) Len() int
func (*InetDiagReqV2) Serialize ¶
func (req *InetDiagReqV2) Serialize() []byte
type InetDiagSockID ¶
type InetDiagSockID struct { SourcePort [2]byte DestPort [2]byte SourceIP [4][4]byte DestIP [4][4]byte Interface uint32 Cookie [2]uint32 }
InetDiagSockID (inet_diag_sockid) contains the socket identity. https://github.com/torvalds/linux/blob/v4.0/include/uapi/linux/inet_diag.h#L13
type NetworkCollector ¶
type NetworkCollector struct {
// contains filtered or unexported fields
}
定义Shell类
func (*NetworkCollector) Update ¶
func (collector *NetworkCollector) Update(ch chan<- prometheus.Metric) error
type NodeCollector ¶
type NodeCollector struct { Collectors map[string]Collector // contains filtered or unexported fields }
NodeCollector implements the prometheus.Collector interface.
func NewNodeCollector ¶
func NewNodeCollector(logger log.Logger, filters ...string) (*NodeCollector, error)
NewNodeCollector creates a new NodeCollector.
func (NodeCollector) Collect ¶
func (n NodeCollector) Collect(ch chan<- prometheus.Metric)
Collect implements the prometheus.Collector interface.
func (NodeCollector) Describe ¶
func (n NodeCollector) Describe(ch chan<- *prometheus.Desc)
Describe implements the prometheus.Collector interface.
type ProcessCollector ¶
type ProcessCollector struct {
// contains filtered or unexported fields
}
定义Process收集类,enable为0表示不做采集,1表示全量采集,2表示指定进程采集,3表示全量+指定进程;designedType表示采集方式,false表示指定进程不做新老进程比较,true表示只返回变化较大的指定进程
func (*ProcessCollector) Update ¶
func (collector *ProcessCollector) Update(ch chan<- prometheus.Metric) error
每隔一段时间更新全量的数据,否正根据规则只更新变更的数据
type ProcessInfo ¶
type ProcessInfo struct {
// contains filtered or unexported fields
}
保存的进程信息,processType为0表示全量进程,为1表示指定进程
type ShellConfig ¶
定义shell脚本配置
type Shell_Script ¶
type Shell_Script struct {
// contains filtered or unexported fields
}
定义Shell类
func (*Shell_Script) Update ¶
func (collector *Shell_Script) Update(ch chan<- prometheus.Metric) error
Source Files ¶
- Plugin.go
- arp_linux.go
- bcache_linux.go
- bonding_linux.go
- btrfs_linux.go
- buddyinfo.go
- cgroups_linux.go
- collector.go
- conntrack_linux.go
- cpu_common.go
- cpu_linux.go
- cpu_vulnerabilities_linux.go
- cpufreq_common.go
- cpufreq_linux.go
- device_filter.go
- diskstats_common.go
- diskstats_linux.go
- dmi.go
- drbd_linux.go
- drm_linux.go
- edac_linux.go
- entropy_linux.go
- ethtool_linux.go
- fibrechannel_linux.go
- file_check_linux.go
- filefd_linux.go
- filesystem_common.go
- filesystem_linux.go
- helper.go
- hwmon_linux.go
- infiniband_linux.go
- interrupts_common.go
- interrupts_linux.go
- ipvs_linux.go
- ksmd_linux.go
- lnstat_linux.go
- loadavg.go
- loadavg_linux.go
- logind_linux.go
- mdadm_linux.go
- meminfo.go
- meminfo_linux.go
- meminfo_numa_linux.go
- mountstats_linux.go
- netclass_linux.go
- netclass_rtnl_linux.go
- netdev_common.go
- netdev_linux.go
- netstat_linux.go
- network_linux.go
- network_route_linux.go
- nfs_linux.go
- nfsd_linux.go
- ntp.go
- nvme_linux.go
- os_release.go
- paths.go
- perf_linux.go
- powersupplyclass.go
- powersupplyclass_linux.go
- pressure_linux.go
- process_linux.go
- processes_linux.go
- qdisc_linux.go
- rapl_linux.go
- runit.go
- schedstat_linux.go
- selinux_linux.go
- shellscript_linux.go
- slabinfo_linux.go
- sockstat_linux.go
- softirq_linux.go
- softirqs_common.go
- softnet_linux.go
- stat_linux.go
- supervisord.go
- sysctl_linux.go
- systemd_linux.go
- tapestats_linux.go
- tcpstat_linux.go
- textfile.go
- thermal_zone_linux.go
- time.go
- time_linux.go
- timex.go
- udp_queues_linux.go
- uname.go
- uname_linux.go
- vmstat_linux.go
- wifi_linux.go
- xfs_linux.go
- zfs.go
- zfs_linux.go
- zoneinfo_linux.go