Documentation ¶
Index ¶
- Constants
- Variables
- func DisableUnavailableCollectors(cs map[string]CollectorState)
- func MapCollectorsToFlags(cs map[string]CollectorState) (flags []string)
- func MapConfigToNodeExporterFlags(c *Config) (accepted []string, ignored []string)
- type Collector
- type CollectorState
- type Config
- type Integration
Constants ¶
const ( CollectorARP = "arp" CollectorBCache = "bcache" CollectorBonding = "bonding" CollectorBooTtime = "boottime" CollectorBTRFS = "btrfs" CollectorBuddyInfo = "buddyinfo" CollectorConntrack = "conntrack" CollectorCPU = "cpu" CollectorCPUFreq = "cpufreq" CollectorDevstat = "devstat" CollectorDiskstats = "diskstats" CollectorDRBD = "drbd" CollectorEDAC = "edac" CollectorEntropy = "entropy" CollectorExec = "exec" CollectorFileFD = "filefd" CollectorFilesystem = "filesystem" CollectorHWMon = "hwmon" CollectorInfiniband = "infiniband" CollectorInterrupts = "interrupts" CollectorIPVS = "ipvs" CollectorKSMD = "ksmd" CollectorLoadAvg = "loadavg" CollectorLogind = "logind" CollectorMDADM = "mdadm" CollectorMeminfo = "meminfo" CollectorMeminfoNuma = "meminfo_numa" CollectorMountstats = "mountstats" CollectorNetclass = "netclass" CollectorNetdev = "netdev" CollectorNetstat = "netstat" CollectorNFS = "nfs" CollectorNFSD = "nfsd" CollectorNTP = "ntp" CollectorPerf = "perf" CollectorPowersuppply = "powersupplyclass" CollectorPressure = "pressure" CollectorProcesses = "processes" CollectorQDisc = "qdisc" CollectorRAPL = "rapl" CollectorRunit = "runit" CollectorSchedstat = "schedstat" CollectorSockstat = "sockstat" CollectorSoftnet = "softnet" CollectorStat = "stat" CollectorSupervisord = "supervisord" CollectorSystemd = "systemd" CollectorTCPStat = "tcpstat" CollectorTextfile = "textfile" CollectorThermalzone = "thermal_zone" CollectorTime = "time" CollectorTimex = "timex" CollectorUDPQueues = "udp_queues" CollectorUname = "uname" CollectorVMStat = "vmstat" CollectorWiFi = "wifi" CollectorXFS = "xfs" CollectorZFS = "zfs" )
Collection of collectors defined by node_exporter
Variables ¶
var Collectors = map[string]CollectorState{ CollectorARP: CollectorStateEnabled, CollectorBCache: CollectorStateEnabled, CollectorBonding: CollectorStateEnabled, CollectorBooTtime: CollectorStateEnabled, CollectorBTRFS: CollectorStateEnabled, CollectorBuddyInfo: CollectorStateDisabled, CollectorConntrack: CollectorStateEnabled, CollectorCPU: CollectorStateEnabled, CollectorCPUFreq: CollectorStateEnabled, CollectorDevstat: CollectorStateDisabled, CollectorDiskstats: CollectorStateEnabled, CollectorDRBD: CollectorStateDisabled, CollectorEDAC: CollectorStateEnabled, CollectorEntropy: CollectorStateEnabled, CollectorExec: CollectorStateEnabled, CollectorFileFD: CollectorStateEnabled, CollectorFilesystem: CollectorStateEnabled, CollectorHWMon: CollectorStateEnabled, CollectorInfiniband: CollectorStateEnabled, CollectorInterrupts: CollectorStateDisabled, CollectorIPVS: CollectorStateEnabled, CollectorKSMD: CollectorStateDisabled, CollectorLoadAvg: CollectorStateEnabled, CollectorLogind: CollectorStateDisabled, CollectorMDADM: CollectorStateEnabled, CollectorMeminfo: CollectorStateEnabled, CollectorMeminfoNuma: CollectorStateDisabled, CollectorMountstats: CollectorStateDisabled, CollectorNetclass: CollectorStateEnabled, CollectorNetdev: CollectorStateEnabled, CollectorNetstat: CollectorStateEnabled, CollectorNFS: CollectorStateEnabled, CollectorNFSD: CollectorStateEnabled, CollectorNTP: CollectorStateDisabled, CollectorPerf: CollectorStateDisabled, CollectorPowersuppply: CollectorStateEnabled, CollectorPressure: CollectorStateEnabled, CollectorProcesses: CollectorStateDisabled, CollectorQDisc: CollectorStateDisabled, CollectorRAPL: CollectorStateEnabled, CollectorRunit: CollectorStateDisabled, CollectorSchedstat: CollectorStateEnabled, CollectorSockstat: CollectorStateEnabled, CollectorSoftnet: CollectorStateEnabled, CollectorStat: CollectorStateEnabled, CollectorSupervisord: CollectorStateDisabled, CollectorSystemd: CollectorStateDisabled, CollectorTCPStat: CollectorStateDisabled, CollectorTextfile: CollectorStateEnabled, CollectorThermalzone: CollectorStateEnabled, CollectorTime: CollectorStateEnabled, CollectorTimex: CollectorStateEnabled, CollectorUDPQueues: CollectorStateEnabled, CollectorUname: CollectorStateEnabled, CollectorVMStat: CollectorStateEnabled, CollectorWiFi: CollectorStateDisabled, CollectorXFS: CollectorStateEnabled, CollectorZFS: CollectorStateEnabled, }
Collectors holds a map of known collector names to their default state.
var ( // DefaultConfig holds non-zero default options for the Config when it is // unmarshaled from YAML. DefaultConfig = Config{ ProcFSPath: procfs.DefaultMountPoint, SysFSPath: sysfs.DefaultMountPoint, RootFSPath: "/", DiskStatsIgnoredDevices: "^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$", NetclassIgnoredDevices: "^$", NetstatFields: "^(.*_(InErrors|InErrs)|Ip_Forwarding|Ip(6|Ext)_(InOctets|OutOctets)|Icmp6?_(InMsgs|OutMsgs)|TcpExt_(Listen.*|Syncookies.*|TCPSynRetrans)|Tcp_(ActiveOpens|InSegs|OutSegs|PassiveOpens|RetransSegs|CurrEstab)|Udp6?_(InDatagrams|OutDatagrams|NoPorts|RcvbufErrors|SndbufErrors))$", NTPServer: "127.0.0.1", NTPProtocolVersion: 4, NTPIPTTL: 1, NTPMaxDistance: time.Microsecond * 3466080, NTPLocalOffsetTolerance: time.Millisecond, PowersupplyIgnoredSupplies: "^$", RunitServiceDir: "/etc/service", SupervisordURL: "http://localhost:9001/RPC2", SystemdUnitWhitelist: ".+", SystemdUnitBlacklist: ".+\\.(automount|device|mount|scope|slice)", VMStatFields: "^(oom_kill|pgpg|pswp|pg.*fault).*", } )
Functions ¶
func DisableUnavailableCollectors ¶
func DisableUnavailableCollectors(cs map[string]CollectorState)
DisableUnavailableCollectors disables collectors that are not available on the host machine.
func MapCollectorsToFlags ¶
func MapCollectorsToFlags(cs map[string]CollectorState) (flags []string)
MapCollectorsToFlags takes in a map of collector keys and their states and converts them into flags that node_exporter expects. Collectors that are not defined will be ignored, which will be the case for collectors that are not supported on the host system.
func MapConfigToNodeExporterFlags ¶
MapConfigToNodeExporterFlags takes in a node_exporter Config and converts it to the set of flags that node_exporter usually expects when running as a separate binary.
Types ¶
type CollectorState ¶
type CollectorState bool
CollectorState represents the default state of the collector, where it can either be enabled or disabled
const ( // CollectorStateDisabled represents a disabled collector that will not run // and collect metrics. CollectorStateDisabled CollectorState = false // CollectorStateEnabled represents an enabled collector that _will_ run // and collect metrics. CollectorStateEnabled CollectorState = true )
type Config ¶
type Config struct { CommonConfig config.Common `yaml:",inline"` // Enabled enables the node_exporter integration. Enabled bool `yaml:"enabled"` IncludeExporterMetrics bool `yaml:"include_exporter_metrics"` ProcFSPath string `yaml:"procfs_path"` SysFSPath string `yaml:"sysfs_path"` RootFSPath string `yaml:"rootfs_path"` // Collectors to mark as enabled EnableCollectors flagext.StringSlice `yaml:"enable_collectors"` // Collectors to mark as disabled DisableCollectors flagext.StringSlice `yaml:"disable_collectors"` // Overrides the default set of enabled collectors with the collectors // listed. SetCollectors flagext.StringSlice `yaml:"set_collectors"` // Collector-specific config options CPUEnableCPUInfo bool `yaml:"enable_cpu_info_metric"` DiskStatsIgnoredDevices string `yaml:"diskstats_ignored_devices"` FilesystemIgnoredMountPoints string `yaml:"filesystem_ignored_mount_points"` FilesystemIgnoredFSTypes string `yaml:"filesystem_ignored_fs_types"` NetclassIgnoredDevices string `yaml:"netclass_ignored_devices"` NetdevDeviceBlacklist string `yaml:"netdev_device_blacklist"` NetdevDeviceWhitelist string `yaml:"netdev_device_whitelist"` NetstatFields string `yaml:"netstat_fields"` NTPServer string `yaml:"ntp_server"` NTPProtocolVersion int `yaml:"ntp_protocol_version"` NTPServerIsLocal bool `yaml:"ntp_server_is_local"` NTPIPTTL int `yaml:"ntp_ip_ttl"` NTPMaxDistance time.Duration `yaml:"ntp_max_distance"` NTPLocalOffsetTolerance time.Duration `yaml:"ntp_local_offset_tolerance"` PerfCPUS string `yaml:"perf_cpus"` PerfTracepoint flagext.StringSlice `yaml:"perf_tracepoint"` PowersupplyIgnoredSupplies string `yaml:"powersupply_ignored_supplies"` RunitServiceDir string `yaml:"runit_service_dir"` SupervisordURL string `yaml:"supervisord_url"` SystemdUnitWhitelist string `yaml:"systemd_unit_whitelist"` SystemdUnitBlacklist string `yaml:"systemd_unit_blacklist"` SystemdEnableTaskMetrics bool `yaml:"systemd_enable_task_metrics"` SystemdEnableRestartsMetrics bool `yaml:"systemd_enable_restarts_metrics"` SystemdEnableStartTimeMetrics bool `yaml:"systemd_enable_start_time_metrics"` VMStatFields string `yaml:"vmstat_fields"` TextfileDirectory string `yaml:"textfile_directory"` }
Config controls the node_exporter integration.
func (*Config) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler for Config.
type Integration ¶
type Integration struct {
// contains filtered or unexported fields
}
Integration is the node_exporter integration. The integration scrapes metrics from the host Linux-based system.
func New ¶
func New(log log.Logger, c Config) (*Integration, error)
New creates a new node_exporter integration.
func (*Integration) CommonConfig ¶
func (i *Integration) CommonConfig() config.Common
CommonConfig satisfies Integration.CommonConfig.
func (*Integration) RegisterRoutes ¶
func (i *Integration) RegisterRoutes(r *mux.Router) error
RegisterRoutes satisfies Integration.RegisterRoutes. The mux.Router provided here is expected to be a subrouter, where all registered paths will be registered within that subroute.
func (*Integration) Run ¶
func (i *Integration) Run(ctx context.Context) error
Run satisfies Integration.Run.
func (*Integration) ScrapeConfigs ¶
func (i *Integration) ScrapeConfigs() []config.ScrapeConfig
ScrapeConfigs satisfies Integration.ScrapeConfigs.