mirror of
https://github.com/prometheus/node_exporter.git
synced 2025-03-05 21:00:12 -08:00
Merge config changes
This commit is contained in:
parent
2e027c850e
commit
2f4d563976
|
@ -40,12 +40,6 @@ func init() {
|
||||||
registerCollector("arp", defaultEnabled, NewARPCollector)
|
registerCollector("arp", defaultEnabled, NewARPCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type ArpConfig struct {
|
|
||||||
DeviceInclude *string
|
|
||||||
DeviceExclude *string
|
|
||||||
Netlink *bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewARPCollector returns a new Collector exposing ARP stats.
|
// NewARPCollector returns a new Collector exposing ARP stats.
|
||||||
func NewARPCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewARPCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
fs, err := procfs.NewFS(*config.Path.ProcPath)
|
fs, err := procfs.NewFS(*config.Path.ProcPath)
|
||||||
|
|
|
@ -36,10 +36,6 @@ type bcacheCollector struct {
|
||||||
config *NodeCollectorConfig
|
config *NodeCollectorConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
type BcacheConfig struct {
|
|
||||||
PriorityStats *bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewBcacheCollector returns a newly allocated bcacheCollector.
|
// NewBcacheCollector returns a newly allocated bcacheCollector.
|
||||||
// It exposes a number of Linux bcache statistics.
|
// It exposes a number of Linux bcache statistics.
|
||||||
func NewBcacheCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewBcacheCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
|
|
205
collector/config.go
Normal file
205
collector/config.go
Normal file
|
@ -0,0 +1,205 @@
|
||||||
|
// Copyright 2023 The Prometheus Authors
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package collector
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type NodeCollectorConfig struct {
|
||||||
|
Arp ArpConfig
|
||||||
|
Bcache BcacheConfig
|
||||||
|
CPU CPUConfig
|
||||||
|
DiskstatsDeviceFilter DiskstatsDeviceFilterConfig
|
||||||
|
Ethtool EthtoolConfig
|
||||||
|
Filesystem FilesystemConfig
|
||||||
|
HwMon HwMonConfig
|
||||||
|
IPVS IPVSConfig
|
||||||
|
NetClass NetClassConfig
|
||||||
|
NetDev NetDevConfig
|
||||||
|
NetStat NetStatConfig
|
||||||
|
NTP NTPConfig
|
||||||
|
Path PathConfig
|
||||||
|
Perf PerfConfig
|
||||||
|
PowerSupplyClass PowerSupplyClassConfig
|
||||||
|
Qdisc QdiscConfig
|
||||||
|
Rapl RaplConfig
|
||||||
|
Runit RunitConfig
|
||||||
|
Stat StatConfig
|
||||||
|
Supervisord SupervisordConfig
|
||||||
|
Sysctl SysctlConfig
|
||||||
|
Systemd SystemdConfig
|
||||||
|
Tapestats TapestatsConfig
|
||||||
|
TextFile TextFileConfig
|
||||||
|
VmStat VmStatConfig
|
||||||
|
Wifi WifiConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
type WifiConfig struct {
|
||||||
|
Fixtures *string
|
||||||
|
}
|
||||||
|
|
||||||
|
type VmStatConfig struct {
|
||||||
|
Fields *string
|
||||||
|
}
|
||||||
|
|
||||||
|
type TextFileConfig struct {
|
||||||
|
Directory *string
|
||||||
|
}
|
||||||
|
type TapestatsConfig struct {
|
||||||
|
IgnoredDevices *string
|
||||||
|
}
|
||||||
|
|
||||||
|
type SystemdConfig struct {
|
||||||
|
UnitInclude *string
|
||||||
|
UnitIncludeSet bool
|
||||||
|
UnitExclude *string
|
||||||
|
UnitExcludeSet bool
|
||||||
|
OldUnitInclude *string
|
||||||
|
OldUnitExclude *string
|
||||||
|
Private *bool
|
||||||
|
EnableTaskMetrics *bool
|
||||||
|
EnableRestartsMetrics *bool
|
||||||
|
EnableStartTimeMetrics *bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type SysctlConfig struct {
|
||||||
|
Include *[]string
|
||||||
|
IncludeInfo *[]string
|
||||||
|
}
|
||||||
|
|
||||||
|
type SupervisordConfig struct {
|
||||||
|
URL *string
|
||||||
|
}
|
||||||
|
|
||||||
|
type RunitConfig struct {
|
||||||
|
ServiceDir *string
|
||||||
|
}
|
||||||
|
|
||||||
|
type StatConfig struct {
|
||||||
|
Softirq *bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type RaplConfig struct {
|
||||||
|
ZoneLabel *bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type QdiscConfig struct {
|
||||||
|
Fixtures *string
|
||||||
|
DeviceInclude *string
|
||||||
|
OldDeviceInclude *string
|
||||||
|
DeviceExclude *string
|
||||||
|
OldDeviceExclude *string
|
||||||
|
}
|
||||||
|
|
||||||
|
type PowerSupplyClassConfig struct {
|
||||||
|
IgnoredPowerSupplies *string
|
||||||
|
}
|
||||||
|
|
||||||
|
type PerfConfig struct {
|
||||||
|
CPUs *string
|
||||||
|
Tracepoint *[]string
|
||||||
|
NoHwProfiler *bool
|
||||||
|
HwProfiler *[]string
|
||||||
|
NoSwProfiler *bool
|
||||||
|
SwProfiler *[]string
|
||||||
|
NoCaProfiler *bool
|
||||||
|
CaProfilerFlag *[]string
|
||||||
|
}
|
||||||
|
|
||||||
|
type PathConfig struct {
|
||||||
|
ProcPath *string
|
||||||
|
SysPath *string
|
||||||
|
RootfsPath *string
|
||||||
|
UdevDataPath *string
|
||||||
|
}
|
||||||
|
|
||||||
|
type NTPConfig struct {
|
||||||
|
Server *string
|
||||||
|
ServerPort *int
|
||||||
|
ProtocolVersion *int
|
||||||
|
ServerIsLocal *bool
|
||||||
|
IPTTL *int
|
||||||
|
MaxDistance *time.Duration
|
||||||
|
OffsetTolerance *time.Duration
|
||||||
|
}
|
||||||
|
|
||||||
|
type NetStatConfig struct {
|
||||||
|
Fields *string
|
||||||
|
}
|
||||||
|
|
||||||
|
type NetDevConfig struct {
|
||||||
|
DeviceInclude *string
|
||||||
|
OldDeviceInclude *string
|
||||||
|
DeviceExclude *string
|
||||||
|
OldDeviceExclude *string
|
||||||
|
AddressInfo *bool
|
||||||
|
DetailedMetrics *bool
|
||||||
|
Netlink *bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type NetClassConfig struct {
|
||||||
|
IgnoredDevices *string
|
||||||
|
InvalidSpeed *bool
|
||||||
|
Netlink *bool
|
||||||
|
RTNLWithStats *bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArpConfig struct {
|
||||||
|
DeviceInclude *string
|
||||||
|
DeviceExclude *string
|
||||||
|
Netlink *bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type BcacheConfig struct {
|
||||||
|
PriorityStats *bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type CPUConfig struct {
|
||||||
|
EnableCPUGuest *bool
|
||||||
|
EnableCPUInfo *bool
|
||||||
|
FlagsInclude *string
|
||||||
|
BugsInclude *string
|
||||||
|
}
|
||||||
|
|
||||||
|
type DiskstatsDeviceFilterConfig struct {
|
||||||
|
DeviceExclude *string
|
||||||
|
DeviceExcludeSet bool
|
||||||
|
OldDeviceExclude *string
|
||||||
|
DeviceInclude *string
|
||||||
|
}
|
||||||
|
|
||||||
|
type EthtoolConfig struct {
|
||||||
|
DeviceInclude *string
|
||||||
|
DeviceExclude *string
|
||||||
|
IncludedMetrics *string
|
||||||
|
}
|
||||||
|
|
||||||
|
type HwMonConfig struct {
|
||||||
|
ChipInclude *string
|
||||||
|
ChipExclude *string
|
||||||
|
}
|
||||||
|
|
||||||
|
type FilesystemConfig struct {
|
||||||
|
MountPointsExclude *string
|
||||||
|
MountPointsExcludeSet bool
|
||||||
|
OldMountPointsExcluded *string
|
||||||
|
FSTypesExclude *string
|
||||||
|
FSTypesExcludeSet bool
|
||||||
|
OldFSTypesExcluded *string
|
||||||
|
MountTimeout *time.Duration
|
||||||
|
StatWorkerCount *int
|
||||||
|
}
|
||||||
|
|
||||||
|
type IPVSConfig struct {
|
||||||
|
Labels *string
|
||||||
|
}
|
|
@ -1,28 +0,0 @@
|
||||||
// Copyright 2023 The Prometheus Authors
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
//go:build dragonfly || freebsd || netbsd || openbsd || 386
|
|
||||||
// +build dragonfly freebsd netbsd openbsd 386
|
|
||||||
|
|
||||||
package collector
|
|
||||||
|
|
||||||
type NodeCollectorConfig struct {
|
|
||||||
DiskstatsDeviceFilter DiskstatsDeviceFilterConfig
|
|
||||||
Filesystem FilesystemConfig
|
|
||||||
NetDev NetDevConfig
|
|
||||||
NTP NTPConfig
|
|
||||||
Path PathConfig
|
|
||||||
Runit RunitConfig
|
|
||||||
Supervisord SupervisordConfig
|
|
||||||
TextFile TextFileConfig
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
// Copyright 2023 The Prometheus Authors
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package collector
|
|
||||||
|
|
||||||
type NodeCollectorConfig struct {
|
|
||||||
DiskstatsDeviceFilter DiskstatsDeviceFilterConfig
|
|
||||||
Filesystem FilesystemConfig
|
|
||||||
NetDev NetDevConfig
|
|
||||||
NTP NTPConfig
|
|
||||||
Path PathConfig
|
|
||||||
PowerSupplyClass PowerSupplyClassConfig
|
|
||||||
Runit RunitConfig
|
|
||||||
Supervisord SupervisordConfig
|
|
||||||
TextFile TextFileConfig
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
// Copyright 2023 The Prometheus Authors
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package collector
|
|
||||||
|
|
||||||
type NodeCollectorConfig struct {
|
|
||||||
Arp ArpConfig
|
|
||||||
Bcache BcacheConfig
|
|
||||||
CPU CPUConfig
|
|
||||||
DiskstatsDeviceFilter DiskstatsDeviceFilterConfig
|
|
||||||
Ethtool EthtoolConfig
|
|
||||||
Filesystem FilesystemConfig
|
|
||||||
HwMon HwMonConfig
|
|
||||||
IPVS IPVSConfig
|
|
||||||
NetClass NetClassConfig
|
|
||||||
NetDev NetDevConfig
|
|
||||||
NetStat NetStatConfig
|
|
||||||
NTP NTPConfig
|
|
||||||
Path PathConfig
|
|
||||||
Perf PerfConfig
|
|
||||||
PowerSupplyClass PowerSupplyClassConfig
|
|
||||||
Qdisc QdiscConfig
|
|
||||||
Rapl RaplConfig
|
|
||||||
Runit RunitConfig
|
|
||||||
Stat StatConfig
|
|
||||||
Supervisord SupervisordConfig
|
|
||||||
Sysctl SysctlConfig
|
|
||||||
Systemd SystemdConfig
|
|
||||||
Tapestats TapestatsConfig
|
|
||||||
TextFile TextFileConfig
|
|
||||||
VmStat VmStatConfig
|
|
||||||
Wifi WifiConfig
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
// Copyright 2023 The Prometheus Authors
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package collector
|
|
||||||
|
|
||||||
type NodeCollectorConfig struct {
|
|
||||||
NTP NTPConfig
|
|
||||||
Path PathConfig
|
|
||||||
Runit RunitConfig
|
|
||||||
Supervisord SupervisordConfig
|
|
||||||
TextFile TextFileConfig
|
|
||||||
}
|
|
|
@ -92,8 +92,8 @@ func ioctl(fd int, nr int64, typ byte, size uintptr, retptr unsafe.Pointer) erro
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func readSysmonProperties() (sysmonProperties, error) {
|
func readSysmonProperties(p PathConfig) (sysmonProperties, error) {
|
||||||
fd, err := unix.Open(rootfsFilePath("/dev/sysmon"), unix.O_RDONLY, 0777)
|
fd, err := unix.Open(p.rootfsStripPrefix("/dev/sysmon"), unix.O_RDONLY, 0777)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -142,12 +142,12 @@ func convertTemperatures(prop sysmonProperty, res map[int]float64) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCPUTemperatures() (map[int]float64, error) {
|
func getCPUTemperatures(p PathConfig) (map[int]float64, error) {
|
||||||
|
|
||||||
res := make(map[int]float64)
|
res := make(map[int]float64)
|
||||||
|
|
||||||
// Read all properties
|
// Read all properties
|
||||||
props, err := readSysmonProperties()
|
props, err := readSysmonProperties(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
@ -215,6 +215,7 @@ type statCollector struct {
|
||||||
cpu typedDesc
|
cpu typedDesc
|
||||||
temp typedDesc
|
temp typedDesc
|
||||||
logger log.Logger
|
logger log.Logger
|
||||||
|
p PathConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -231,6 +232,7 @@ func NewStatCollector(config *NodeCollectorConfig, logger log.Logger) (Collector
|
||||||
[]string{"cpu"}, nil,
|
[]string{"cpu"}, nil,
|
||||||
), prometheus.GaugeValue},
|
), prometheus.GaugeValue},
|
||||||
logger: logger,
|
logger: logger,
|
||||||
|
p: config.Path,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +255,7 @@ func (c *statCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
cpuTemperatures, err := getCPUTemperatures()
|
cpuTemperatures, err := getCPUTemperatures(c.p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,13 +77,6 @@ var (
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
type DiskstatsDeviceFilterConfig struct {
|
|
||||||
DeviceExclude *string
|
|
||||||
DeviceExcludeSet bool
|
|
||||||
OldDeviceExclude *string
|
|
||||||
DeviceInclude *string
|
|
||||||
}
|
|
||||||
|
|
||||||
func newDiskstatsDeviceFilter(config DiskstatsDeviceFilterConfig, logger log.Logger) (deviceFilter, error) {
|
func newDiskstatsDeviceFilter(config DiskstatsDeviceFilterConfig, logger log.Logger) (deviceFilter, error) {
|
||||||
if *config.OldDeviceExclude != "" {
|
if *config.OldDeviceExclude != "" {
|
||||||
if !config.DeviceExcludeSet {
|
if !config.DeviceExcludeSet {
|
||||||
|
|
|
@ -78,12 +78,6 @@ type ethtoolCollector struct {
|
||||||
logger log.Logger
|
logger log.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
type EthtoolConfig struct {
|
|
||||||
DeviceInclude *string
|
|
||||||
DeviceExclude *string
|
|
||||||
IncludedMetrics *string
|
|
||||||
}
|
|
||||||
|
|
||||||
// makeEthtoolCollector is the internal constructor for EthtoolCollector.
|
// makeEthtoolCollector is the internal constructor for EthtoolCollector.
|
||||||
// This allows NewEthtoolTestCollector to override its .ethtool interface
|
// This allows NewEthtoolTestCollector to override its .ethtool interface
|
||||||
// for testing.
|
// for testing.
|
||||||
|
|
|
@ -19,12 +19,10 @@ package collector
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"regexp"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/go-kit/log"
|
"github.com/go-kit/log"
|
||||||
"github.com/go-kit/log/level"
|
"github.com/go-kit/log/level"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
"regexp"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Arch-dependent implementation must define:
|
// Arch-dependent implementation must define:
|
||||||
|
@ -57,16 +55,6 @@ type filesystemStats struct {
|
||||||
files, filesFree float64
|
files, filesFree float64
|
||||||
ro, deviceError float64
|
ro, deviceError float64
|
||||||
}
|
}
|
||||||
type FilesystemConfig struct {
|
|
||||||
MountPointsExclude *string
|
|
||||||
MountPointsExcludeSet bool
|
|
||||||
OldMountPointsExcluded *string
|
|
||||||
FSTypesExclude *string
|
|
||||||
FSTypesExcludeSet bool
|
|
||||||
OldFSTypesExcluded *string
|
|
||||||
MountTimeout *time.Duration
|
|
||||||
StatWorkerCount *int
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
registerCollector("filesystem", defaultEnabled, NewFilesystemCollector)
|
registerCollector("filesystem", defaultEnabled, NewFilesystemCollector)
|
||||||
|
@ -165,7 +153,7 @@ func NewFilesystemCollector(config *NodeCollectorConfig, logger log.Logger) (Col
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *filesystemCollector) Update(ch chan<- prometheus.Metric) error {
|
func (c *filesystemCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
stats, err := c.GetStats(c.config.Path)
|
stats, err := c.GetStats()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,11 +52,6 @@ type hwMonCollector struct {
|
||||||
config *NodeCollectorConfig
|
config *NodeCollectorConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
type HwMonConfig struct {
|
|
||||||
ChipInclude *string
|
|
||||||
ChipExclude *string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewHwMonCollector returns a new Collector exposing /sys/class/hwmon stats
|
// NewHwMonCollector returns a new Collector exposing /sys/class/hwmon stats
|
||||||
// (similar to lm-sensors).
|
// (similar to lm-sensors).
|
||||||
func NewHwMonCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewHwMonCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
|
|
|
@ -69,10 +69,6 @@ func init() {
|
||||||
registerCollector("ipvs", defaultEnabled, NewIPVSCollector)
|
registerCollector("ipvs", defaultEnabled, NewIPVSCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type IPVSConfig struct {
|
|
||||||
Labels *string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewIPVSCollector sets up a new collector for IPVS metrics. It accepts the
|
// NewIPVSCollector sets up a new collector for IPVS metrics. It accepts the
|
||||||
// "procfs" config parameter to override the default proc location (/proc).
|
// "procfs" config parameter to override the default proc location (/proc).
|
||||||
func NewIPVSCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewIPVSCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
|
|
|
@ -42,13 +42,6 @@ func init() {
|
||||||
registerCollector("netclass", defaultEnabled, NewNetClassCollector)
|
registerCollector("netclass", defaultEnabled, NewNetClassCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type NetClassConfig struct {
|
|
||||||
IgnoredDevices *string
|
|
||||||
InvalidSpeed *bool
|
|
||||||
Netlink *bool
|
|
||||||
RTNLWithStats *bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewNetClassCollector returns a new Collector exposing network class stats.
|
// NewNetClassCollector returns a new Collector exposing network class stats.
|
||||||
func NewNetClassCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewNetClassCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
fs, err := sysfs.NewFS(*config.Path.SysPath)
|
fs, err := sysfs.NewFS(*config.Path.SysPath)
|
||||||
|
|
|
@ -44,16 +44,6 @@ func init() {
|
||||||
registerCollector("netdev", defaultEnabled, NewNetDevCollector)
|
registerCollector("netdev", defaultEnabled, NewNetDevCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type NetDevConfig struct {
|
|
||||||
DeviceInclude *string
|
|
||||||
OldDeviceInclude *string
|
|
||||||
DeviceExclude *string
|
|
||||||
OldDeviceExclude *string
|
|
||||||
AddressInfo *bool
|
|
||||||
DetailedMetrics *bool
|
|
||||||
Netlink *bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewNetDevCollector returns a new Collector exposing network device stats.
|
// NewNetDevCollector returns a new Collector exposing network device stats.
|
||||||
func NewNetDevCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewNetDevCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
if *config.NetDev.OldDeviceInclude != "" {
|
if *config.NetDev.OldDeviceInclude != "" {
|
||||||
|
@ -112,7 +102,7 @@ func (c *netDevCollector) metricDesc(key string) *prometheus.Desc {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *netDevCollector) Update(ch chan<- prometheus.Metric) error {
|
func (c *netDevCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
netDev, err := getNetDevStats(&c.deviceFilter, c.logger)
|
netDev, err := getNetDevStats(c.config, c.config.NetDev.Netlink, &c.deviceFilter, c.logger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("couldn't get netstats: %w", err)
|
return fmt.Errorf("couldn't get netstats: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,10 +44,6 @@ func init() {
|
||||||
registerCollector(netStatsSubsystem, defaultEnabled, NewNetStatCollector)
|
registerCollector(netStatsSubsystem, defaultEnabled, NewNetStatCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type NetStatConfig struct {
|
|
||||||
Fields *string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewNetStatCollector takes and returns
|
// NewNetStatCollector takes and returns
|
||||||
// a new Collector exposing network stats.
|
// a new Collector exposing network stats.
|
||||||
func NewNetStatCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewNetStatCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
|
|
|
@ -48,16 +48,6 @@ func init() {
|
||||||
registerCollector("ntp", defaultDisabled, NewNtpCollector)
|
registerCollector("ntp", defaultDisabled, NewNtpCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type NTPConfig struct {
|
|
||||||
Server *string
|
|
||||||
ServerPort *int
|
|
||||||
ProtocolVersion *int
|
|
||||||
ServerIsLocal *bool
|
|
||||||
IPTTL *int
|
|
||||||
MaxDistance *time.Duration
|
|
||||||
OffsetTolerance *time.Duration
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewNtpCollector returns a new Collector exposing sanity of local NTP server.
|
// NewNtpCollector returns a new Collector exposing sanity of local NTP server.
|
||||||
// Default definition of "local" is:
|
// Default definition of "local" is:
|
||||||
// - collector.ntp.server address is a loopback address (or collector.ntp.server-is-mine flag is turned on)
|
// - collector.ntp.server address is a loopback address (or collector.ntp.server-is-mine flag is turned on)
|
||||||
|
|
|
@ -18,13 +18,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PathConfig struct {
|
|
||||||
ProcPath *string
|
|
||||||
SysPath *string
|
|
||||||
RootfsPath *string
|
|
||||||
UdevDataPath *string
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PathConfig) procFilePath(name string) string {
|
func (p *PathConfig) procFilePath(name string) string {
|
||||||
return filepath.Join(*p.ProcPath, name)
|
return filepath.Join(*p.ProcPath, name)
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,17 +37,6 @@ func init() {
|
||||||
registerCollector(perfSubsystem, defaultDisabled, NewPerfCollector)
|
registerCollector(perfSubsystem, defaultDisabled, NewPerfCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type PerfConfig struct {
|
|
||||||
CPUs *string
|
|
||||||
Tracepoint *[]string
|
|
||||||
NoHwProfiler *bool
|
|
||||||
HwProfiler *[]string
|
|
||||||
NoSwProfiler *bool
|
|
||||||
SwProfiler *[]string
|
|
||||||
NoCaProfiler *bool
|
|
||||||
CaProfilerFlag *[]string
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
perfHardwareProfilerMap = map[string]perf.HardwareProfilerType{
|
perfHardwareProfilerMap = map[string]perf.HardwareProfilerType{
|
||||||
"CpuCycles": perf.CpuCyclesProfiler,
|
"CpuCycles": perf.CpuCyclesProfiler,
|
||||||
|
|
|
@ -36,10 +36,6 @@ func init() {
|
||||||
registerCollector("powersupplyclass", defaultEnabled, NewPowerSupplyClassCollector)
|
registerCollector("powersupplyclass", defaultEnabled, NewPowerSupplyClassCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type PowerSupplyClassConfig struct {
|
|
||||||
IgnoredPowerSupplies *string
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewPowerSupplyClassCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewPowerSupplyClassCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
pattern := regexp.MustCompile(*config.PowerSupplyClass.IgnoredPowerSupplies)
|
pattern := regexp.MustCompile(*config.PowerSupplyClass.IgnoredPowerSupplies)
|
||||||
return &powerSupplyClassCollector{
|
return &powerSupplyClassCollector{
|
||||||
|
|
|
@ -45,14 +45,6 @@ func init() {
|
||||||
registerCollector("qdisc", defaultDisabled, NewQdiscStatCollector)
|
registerCollector("qdisc", defaultDisabled, NewQdiscStatCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type QdiscConfig struct {
|
|
||||||
Fixtures *string
|
|
||||||
DeviceInclude *string
|
|
||||||
OldDeviceInclude *string
|
|
||||||
DeviceExclude *string
|
|
||||||
OldDeviceExclude *string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewQdiscStatCollector returns a new Collector exposing queuing discipline statistics.
|
// NewQdiscStatCollector returns a new Collector exposing queuing discipline statistics.
|
||||||
func NewQdiscStatCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewQdiscStatCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
if *config.Qdisc.OldDeviceInclude != "" {
|
if *config.Qdisc.OldDeviceInclude != "" {
|
||||||
|
|
|
@ -42,10 +42,6 @@ func init() {
|
||||||
registerCollector(raplCollectorSubsystem, defaultEnabled, NewRaplCollector)
|
registerCollector(raplCollectorSubsystem, defaultEnabled, NewRaplCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type RaplConfig struct {
|
|
||||||
ZoneLabel *bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewRaplCollector returns a new Collector exposing RAPL metrics.
|
// NewRaplCollector returns a new Collector exposing RAPL metrics.
|
||||||
func NewRaplCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewRaplCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
fs, err := sysfs.NewFS(*config.Path.SysPath)
|
fs, err := sysfs.NewFS(*config.Path.SysPath)
|
||||||
|
|
|
@ -36,10 +36,6 @@ func init() {
|
||||||
registerCollector("runit", defaultDisabled, NewRunitCollector)
|
registerCollector("runit", defaultDisabled, NewRunitCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type RunitConfig struct {
|
|
||||||
ServiceDir *string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewRunitCollector returns a new Collector exposing runit statistics.
|
// NewRunitCollector returns a new Collector exposing runit statistics.
|
||||||
func NewRunitCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewRunitCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -41,10 +41,6 @@ func init() {
|
||||||
registerCollector("stat", defaultEnabled, NewStatCollector)
|
registerCollector("stat", defaultEnabled, NewStatCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type StatConfig struct {
|
|
||||||
Softirq *bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewStatCollector returns a new Collector exposing kernel/system statistics.
|
// NewStatCollector returns a new Collector exposing kernel/system statistics.
|
||||||
func NewStatCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewStatCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
fs, err := procfs.NewFS(*config.Path.ProcPath)
|
fs, err := procfs.NewFS(*config.Path.ProcPath)
|
||||||
|
|
|
@ -46,10 +46,6 @@ func init() {
|
||||||
registerCollector("supervisord", defaultDisabled, NewSupervisordCollector)
|
registerCollector("supervisord", defaultDisabled, NewSupervisordCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SupervisordConfig struct {
|
|
||||||
URL *string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewSupervisordCollector returns a new Collector exposing supervisord statistics.
|
// NewSupervisordCollector returns a new Collector exposing supervisord statistics.
|
||||||
func NewSupervisordCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewSupervisordCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -37,11 +37,6 @@ func init() {
|
||||||
registerCollector("sysctl", defaultDisabled, NewSysctlCollector)
|
registerCollector("sysctl", defaultDisabled, NewSysctlCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SysctlConfig struct {
|
|
||||||
Include *[]string
|
|
||||||
IncludeInfo *[]string
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewSysctlCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewSysctlCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
fs, err := procfs.NewFS(*config.Path.ProcPath)
|
fs, err := procfs.NewFS(*config.Path.ProcPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -70,19 +70,6 @@ func init() {
|
||||||
registerCollector("systemd", defaultDisabled, NewSystemdCollector)
|
registerCollector("systemd", defaultDisabled, NewSystemdCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SystemdConfig struct {
|
|
||||||
UnitInclude *string
|
|
||||||
UnitIncludeSet bool
|
|
||||||
UnitExclude *string
|
|
||||||
UnitExcludeSet bool
|
|
||||||
OldUnitInclude *string
|
|
||||||
OldUnitExclude *string
|
|
||||||
Private *bool
|
|
||||||
EnableTaskMetrics *bool
|
|
||||||
EnableRestartsMetrics *bool
|
|
||||||
EnableStartTimeMetrics *bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewSystemdCollector returns a new Collector exposing systemd statistics.
|
// NewSystemdCollector returns a new Collector exposing systemd statistics.
|
||||||
func NewSystemdCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewSystemdCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
const subsystem = "systemd"
|
const subsystem = "systemd"
|
||||||
|
|
|
@ -47,10 +47,6 @@ func init() {
|
||||||
registerCollector("tapestats", defaultEnabled, NewTapestatsCollector)
|
registerCollector("tapestats", defaultEnabled, NewTapestatsCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type TapestatsConfig struct {
|
|
||||||
IgnoredDevices *string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewTapestatsCollector returns a new Collector exposing tape device stats.
|
// 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
|
// Docs from https://www.kernel.org/doc/html/latest/scsi/st.html#sysfs-and-statistics-for-tape-devices
|
||||||
func NewTapestatsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewTapestatsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
|
|
|
@ -51,10 +51,6 @@ func init() {
|
||||||
registerCollector("textfile", defaultEnabled, NewTextFileCollector)
|
registerCollector("textfile", defaultEnabled, NewTextFileCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type TextFileConfig struct {
|
|
||||||
Directory *string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewTextFileCollector returns a new Collector exposing metrics read from files
|
// NewTextFileCollector returns a new Collector exposing metrics read from files
|
||||||
// in the given textfile directory.
|
// in the given textfile directory.
|
||||||
func NewTextFileCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewTextFileCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
|
|
|
@ -42,10 +42,6 @@ func init() {
|
||||||
registerCollector(vmStatSubsystem, defaultEnabled, NewvmStatCollector)
|
registerCollector(vmStatSubsystem, defaultEnabled, NewvmStatCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type VmStatConfig struct {
|
|
||||||
Fields *string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewvmStatCollector returns a new Collector exposing vmstat stats.
|
// NewvmStatCollector returns a new Collector exposing vmstat stats.
|
||||||
func NewvmStatCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewvmStatCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
pattern := regexp.MustCompile(*config.VmStat.Fields)
|
pattern := regexp.MustCompile(*config.VmStat.Fields)
|
||||||
|
|
|
@ -52,10 +52,6 @@ func init() {
|
||||||
registerCollector("wifi", defaultDisabled, NewWifiCollector)
|
registerCollector("wifi", defaultDisabled, NewWifiCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
type WifiConfig struct {
|
|
||||||
Fixtures *string
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ wifiStater = &wifi.Client{}
|
var _ wifiStater = &wifi.Client{}
|
||||||
|
|
||||||
// wifiStater is an interface used to swap out a *wifi.Client for end to end tests.
|
// wifiStater is an interface used to swap out a *wifi.Client for end to end tests.
|
||||||
|
|
Loading…
Reference in a new issue