Documentation ¶
Overview ¶
Package collector includes all individual collectors to gather and export system metrics.
Index ¶
- Constants
- Variables
- func DisableDefaultCollectors()
- func HandleProcessAction(requestParamBuff []byte) (isCheck bool, err error)
- func InitMonitorLogger(logger log.Logger)
- func IsNoDataError(err error) bool
- func LogKeyWordLoadConfig()
- func LogKeywordHttpHandle(w http.ResponseWriter, r *http.Request)
- func LogMetricLoadConfig()
- func LogMetricMonitorHandleAction(requestParamBuff []byte) error
- func LogMetricMonitorHttpHandle(w http.ResponseWriter, r *http.Request)
- func LogMetricSaveConfig(requestParamBuff []byte)
- func LogMonitorRowsHttpHandle(w http.ResponseWriter, r *http.Request)
- func PcreCompile(pattern string, flags int) (Regexp, *CompileError)
- func ProcessHttpHandle(w http.ResponseWriter, r *http.Request)
- func StartCalcLogMetricCron()
- func StartProcessMonitorCron()
- type Collector
- func LogMetricMonitorCollector(logger log.Logger) (Collector, error)
- 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 NewConntrackCollector(logger log.Logger) (Collector, error)
- func NewDiskstatsCollector(logger log.Logger) (Collector, error)
- func NewEdacCollector(logger log.Logger) (Collector, error)
- func NewEntropyCollector(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 NewLoadavgCollector(logger log.Logger) (Collector, error)
- func NewLogMonitorCollector(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 NewNetClassCollector(logger log.Logger) (Collector, error)
- func NewNetDevCollector(logger log.Logger) (Collector, error)
- func NewNetStatCollector(logger log.Logger) (Collector, error)
- func NewNfsCollector(logger log.Logger) (Collector, error)
- func NewNtpCollector(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 NewProcessMonitorCollector(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 NewSockStatCollector(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 NewSystemdCollector(logger log.Logger) (Collector, error)
- func NewTCPStatCollector(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 NewWifiCollector(logger log.Logger) (Collector, error)
- func NewXFSCollector(logger log.Logger) (Collector, error)
- func NewZFSCollector(logger log.Logger) (Collector, error)
- func NewvmStatCollector(logger log.Logger) (Collector, error)
- type CompileError
- type LogMetricConfigTag
- type Matcher
- func (m *Matcher) Group(group int) []byte
- func (m *Matcher) GroupString(group int) string
- func (m *Matcher) Groups() int
- func (m *Matcher) Match(subject []byte, flags int) bool
- func (m *Matcher) MatchString(subject string, flags int) bool
- func (m *Matcher) Matches() bool
- func (m *Matcher) Named(group string) []byte
- func (m *Matcher) NamedPresent(group string) bool
- func (m *Matcher) NamedString(group string) string
- func (m *Matcher) Present(group int) bool
- func (m *Matcher) Reset(re Regexp, subject []byte, flags int)
- func (m *Matcher) ResetString(re Regexp, subject string, flags int)
- type NodeCollector
- type Regexp
- func (re *Regexp) FindAllIndex(bytes []byte, flags int) (r [][]int)
- func (re *Regexp) FindIndex(bytes []byte, flags int) []int
- func (re Regexp) Groups() int
- func (re Regexp) Matcher(subject []byte, flags int) (m *Matcher)
- func (re Regexp) MatcherString(subject string, flags int) (m *Matcher)
- func (re Regexp) ReplaceAll(bytes, repl []byte, flags int) []byte
Constants ¶
const ( ANCHORED = C.PCRE_ANCHORED BSR_ANYCRLF = C.PCRE_BSR_ANYCRLF BSR_UNICODE = C.PCRE_BSR_UNICODE NEWLINE_ANY = C.PCRE_NEWLINE_ANY NEWLINE_ANYCRLF = C.PCRE_NEWLINE_ANYCRLF NEWLINE_CR = C.PCRE_NEWLINE_CR NEWLINE_CRLF = C.PCRE_NEWLINE_CRLF NEWLINE_LF = C.PCRE_NEWLINE_LF NO_UTF8_CHECK = C.PCRE_NO_UTF8_CHECK )
Flags for Compile and Match functions.
const ( CASELESS = C.PCRE_CASELESS DOLLAR_ENDONLY = C.PCRE_DOLLAR_ENDONLY DOTALL = C.PCRE_DOTALL DUPNAMES = C.PCRE_DUPNAMES EXTENDED = C.PCRE_EXTENDED EXTRA = C.PCRE_EXTRA FIRSTLINE = C.PCRE_FIRSTLINE JAVASCRIPT_COMPAT = C.PCRE_JAVASCRIPT_COMPAT MULTILINE = C.PCRE_MULTILINE NO_AUTO_CAPTURE = C.PCRE_NO_AUTO_CAPTURE UNGREEDY = C.PCRE_UNGREEDY UTF8 = C.PCRE_UTF8 )
Flags for Compile functions
const ( NOTBOL = C.PCRE_NOTBOL NOTEOL = C.PCRE_NOTEOL NOTEMPTY = C.PCRE_NOTEMPTY NOTEMPTY_ATSTART = C.PCRE_NOTEMPTY_ATSTART NO_START_OPTIMIZE = C.PCRE_NO_START_OPTIMIZE PARTIAL_HARD = C.PCRE_PARTIAL_HARD PARTIAL_SOFT = C.PCRE_PARTIAL_SOFT )
Flags for Match functions
Variables ¶
var ErrNoData = errors.New("collector returned no data")
ErrNoData indicates the collector found no data to collect, but had no other error.
var ProcessJob processMonitorJob
Functions ¶
func DisableDefaultCollectors ¶ added in v1.8.0
func DisableDefaultCollectors()
DisableDefaultCollectors sets the collector state to false for all collectors which have not been explicitly enabled on the command line.
func HandleProcessAction ¶
func InitMonitorLogger ¶
func IsNoDataError ¶ added in v1.8.0
func LogKeyWordLoadConfig ¶
func LogKeyWordLoadConfig()
func LogKeywordHttpHandle ¶
func LogKeywordHttpHandle(w http.ResponseWriter, r *http.Request)
func LogMetricLoadConfig ¶
func LogMetricLoadConfig()
func LogMetricMonitorHttpHandle ¶
func LogMetricMonitorHttpHandle(w http.ResponseWriter, r *http.Request)
func LogMetricSaveConfig ¶
func LogMetricSaveConfig(requestParamBuff []byte)
func LogMonitorRowsHttpHandle ¶ added in v1.8.0
func LogMonitorRowsHttpHandle(w http.ResponseWriter, r *http.Request)
func PcreCompile ¶
func PcreCompile(pattern string, flags int) (Regexp, *CompileError)
Try to compile the pattern. If an error occurs, the second return value is non-nil.
func ProcessHttpHandle ¶
func ProcessHttpHandle(w http.ResponseWriter, r *http.Request)
func StartCalcLogMetricCron ¶
func StartCalcLogMetricCron()
func StartProcessMonitorCron ¶
func StartProcessMonitorCron()
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 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 ¶ added in v1.8.0
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 NewConntrackCollector ¶
NewConntrackCollector returns a new Collector exposing conntrack stats.
func NewDiskstatsCollector ¶
NewDiskstatsCollector returns a new Collector exposing disk device stats. Docs from https://www.kernel.org/doc/Documentation/iostats.txt
func NewEdacCollector ¶
NewEdacCollector returns a new Collector exposing edac stats.
func NewEntropyCollector ¶
NewEntropyCollector returns a new Collector exposing entropy 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 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 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 NewPerfCollector ¶
NewPerfCollector returns a new perf based collector, it creates a profiler per CPU.
func NewPowerSupplyClassCollector ¶ added in v1.8.0
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 ¶ added in v1.8.0
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 NewSockStatCollector ¶
NewSockStatCollector returns a new Collector exposing socket stats.
func NewSoftnetCollector ¶ added in v1.8.0
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 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 ¶ added in v1.8.0
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.
type CompileError ¶
A compilation error, as returned by the Compile function. The offset is the byte position in the pattern string at which the error was detected.
func (*CompileError) String ¶
func (e *CompileError) String() string
type LogMetricConfigTag ¶
type Matcher ¶
type Matcher struct {
// contains filtered or unexported fields
}
Matcher objects provide a place for storing match results. They can be created by the Matcher and MatcherString functions, or they can be initialized with Reset or ResetString.
func (*Matcher) Group ¶
Returns the numbered capture group of the last match (performed by Matcher, MatcherString, Reset, ResetString, Match, or MatchString). Group 0 is the part of the subject which matches the whole pattern; the first actual capture group is numbered 1. Capture groups which are not present return a nil slice.
func (*Matcher) GroupString ¶
Returns the numbered capture group as a string. Group 0 is the part of the subject which matches the whole pattern; the first actual capture group is numbered 1. Capture groups which are not present return an empty string.
func (*Matcher) Match ¶
Tries to match the speficied byte array slice to the current pattern. Returns true if the match succeeds.
func (*Matcher) MatchString ¶
Tries to match the speficied subject string to the current pattern. Returns true if the match succeeds.
func (*Matcher) Matches ¶
Returns true if a previous call to Matcher, MatcherString, Reset, ResetString, Match or MatchString succeeded.
func (*Matcher) Named ¶
Returns the value of the named capture group. This is a nil slice if the capture group is not present. Panics if the name does not refer to a group.
func (*Matcher) NamedPresent ¶
Returns true if the named capture group is present. Panics if the name does not refer to a group.
func (*Matcher) NamedString ¶
Returns the value of the named capture group, or an empty string if the capture group is not present. Panics if the name does not refer to a group.
func (*Matcher) Present ¶
Returns true if the numbered capture group is present in the last match (performed by Matcher, MatcherString, Reset, ResetString, Match, or MatchString). Group numbers start at 1. A capture group can be present and match the empty string.
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 Regexp ¶
type Regexp struct {
// contains filtered or unexported fields
}
A reference to a compiled regular expression. Use Compile or MustCompile to create such objects.
func MustPcreCompile ¶
Compile the pattern. If compilation fails, panic.
func (*Regexp) FindIndex ¶
Return the start and end of the first match, or nil if no match. loc[0] is the start and loc[1] is the end.
func (Regexp) MatcherString ¶
Returns a new matcher object, with the specified subject string.
Source Files ¶
- arp_linux.go
- bcache_linux.go
- bonding_linux.go
- btrfs_linux.go
- buddyinfo.go
- collector.go
- conntrack_linux.go
- cpu_common.go
- cpu_linux.go
- cpufreq_linux.go
- diskstats_common.go
- diskstats_linux.go
- drbd_linux.go
- edac_linux.go
- entropy_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
- loadavg.go
- loadavg_linux.go
- logind_linux.go
- mdadm_linux.go
- meminfo.go
- meminfo_linux.go
- meminfo_numa_linux.go
- monitor_log_keyword_linux.go
- monitor_log_metric_linux.go
- monitor_process_linux.go
- mountstats_linux.go
- netclass_linux.go
- netdev_common.go
- netdev_linux.go
- netstat_linux.go
- nfs_linux.go
- nfsd_linux.go
- ntp.go
- paths.go
- pcre.go
- perf_linux.go
- powersupplyclass.go
- pressure_linux.go
- processes_linux.go
- qdisc_linux.go
- rapl_linux.go
- runit.go
- schedstat_linux.go
- sockstat_linux.go
- softnet_linux.go
- stat_linux.go
- supervisord.go
- systemd_linux.go
- tcpstat_linux.go
- textfile.go
- thermal_zone_linux.go
- time.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