node_exporter

package
v1.3.191 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectorARP          = "arp"
	CollectorBCache       = "bcache"
	CollectorBTRFS        = "btrfs"
	CollectorBonding      = "bonding"
	CollectorBootTime     = "boottime"
	CollectorBuddyInfo    = "buddyinfo"
	CollectorCPU          = "cpu"
	CollectorCPUFreq      = "cpufreq"
	CollectorConntrack    = "conntrack"
	CollectorDMI          = "dmi"
	CollectorDRBD         = "drbd"
	CollectorDRM          = "drm"
	CollectorDevstat      = "devstat"
	CollectorDiskstats    = "diskstats"
	CollectorEDAC         = "edac"
	CollectorEntropy      = "entropy"
	CollectorEthtool      = "ethtool"
	CollectorExec         = "exec"
	CollectorFibrechannel = "fibrechannel"
	CollectorFileFD       = "filefd"
	CollectorFilesystem   = "filesystem"
	CollectorHWMon        = "hwmon"
	CollectorIPVS         = "ipvs"
	CollectorInfiniband   = "infiniband"
	CollectorInterrupts   = "interrupts"
	CollectorKSMD         = "ksmd"
	CollectorLnstat       = "lnstat"
	CollectorLoadAvg      = "loadavg"
	CollectorLogind       = "logind"
	CollectorMDADM        = "mdadm"
	CollectorMeminfo      = "meminfo"
	CollectorMeminfoNuma  = "meminfo_numa"
	CollectorMountstats   = "mountstats"
	CollectorNFS          = "nfs"
	CollectorNFSD         = "nfsd"
	CollectorNTP          = "ntp"
	CollectorNVME         = "nvme"
	CollectorNetclass     = "netclass"
	CollectorNetdev       = "netdev"
	CollectorNetstat      = "netstat"
	CollectorNetworkRoute = "network_route"
	CollectorOS           = "os"
	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"
	CollectorTapestats    = "tapestats"
	CollectorTextfile     = "textfile"
	CollectorThermal      = "thermal"
	CollectorThermalzone  = "thermal_zone"
	CollectorTime         = "time"
	CollectorTimex        = "timex"
	CollectorUDPQueues    = "udp_queues"
	CollectorUname        = "uname"
	CollectorVMStat       = "vmstat"
	CollectorWiFi         = "wifi"
	CollectorXFS          = "xfs"
	CollectorZFS          = "zfs"
	CollectorZoneinfo     = "zoneinfo"
)

Collection of collectors defined by node_exporter

Variables

View Source
var Collectors = map[string]CollectorState{
	CollectorARP:          CollectorStateEnabled,
	CollectorBCache:       CollectorStateEnabled,
	CollectorBTRFS:        CollectorStateEnabled,
	CollectorBonding:      CollectorStateEnabled,
	CollectorBootTime:     CollectorStateEnabled,
	CollectorBuddyInfo:    CollectorStateDisabled,
	CollectorCPU:          CollectorStateEnabled,
	CollectorCPUFreq:      CollectorStateEnabled,
	CollectorConntrack:    CollectorStateEnabled,
	CollectorDMI:          CollectorStateEnabled,
	CollectorDRBD:         CollectorStateDisabled,
	CollectorDRM:          CollectorStateDisabled,
	CollectorDevstat:      CollectorStateDisabled,
	CollectorDiskstats:    CollectorStateEnabled,
	CollectorEDAC:         CollectorStateEnabled,
	CollectorEntropy:      CollectorStateEnabled,
	CollectorEthtool:      CollectorStateDisabled,
	CollectorExec:         CollectorStateEnabled,
	CollectorFibrechannel: CollectorStateEnabled,
	CollectorFileFD:       CollectorStateEnabled,
	CollectorFilesystem:   CollectorStateEnabled,
	CollectorHWMon:        CollectorStateEnabled,
	CollectorIPVS:         CollectorStateEnabled,
	CollectorInfiniband:   CollectorStateEnabled,
	CollectorInterrupts:   CollectorStateDisabled,
	CollectorKSMD:         CollectorStateDisabled,
	CollectorLnstat:       CollectorStateDisabled,
	CollectorLoadAvg:      CollectorStateEnabled,
	CollectorLogind:       CollectorStateDisabled,
	CollectorMDADM:        CollectorStateEnabled,
	CollectorMeminfo:      CollectorStateEnabled,
	CollectorMeminfoNuma:  CollectorStateDisabled,
	CollectorMountstats:   CollectorStateDisabled,
	CollectorNFS:          CollectorStateEnabled,
	CollectorNFSD:         CollectorStateEnabled,
	CollectorNTP:          CollectorStateDisabled,
	CollectorNVME:         CollectorStateEnabled,
	CollectorNetclass:     CollectorStateEnabled,
	CollectorNetdev:       CollectorStateEnabled,
	CollectorNetstat:      CollectorStateEnabled,
	CollectorNetworkRoute: CollectorStateDisabled,
	CollectorOS:           CollectorStateEnabled,
	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,
	CollectorTapestats:    CollectorStateEnabled,
	CollectorTextfile:     CollectorStateEnabled,
	CollectorThermal:      CollectorStateEnabled,
	CollectorThermalzone:  CollectorStateEnabled,
	CollectorTime:         CollectorStateEnabled,
	CollectorTimex:        CollectorStateEnabled,
	CollectorUDPQueues:    CollectorStateEnabled,
	CollectorUname:        CollectorStateEnabled,
	CollectorVMStat:       CollectorStateEnabled,
	CollectorWiFi:         CollectorStateDisabled,
	CollectorXFS:          CollectorStateEnabled,
	CollectorZFS:          CollectorStateEnabled,
	CollectorZoneinfo:     CollectorStateDisabled,
}

Collectors holds a map of known collector names to their default state.

View Source
var (
	// DefaultConfig holds non-zero default options for the Config when it is
	// unmarshaled from YAML.
	//
	// DefaultConfig's defaults are populated from init functions in this package.
	// See the init function here and in node_exporter_linux.go.
	DefaultConfig = Config{
		ProcFSPath: procfs.DefaultMountPoint,
		RootFSPath: "/",

		DiskStatsIgnoredDevices: "^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$",

		EthtoolMetricsInclude: ".*",

		FilesystemMountTimeout: 5 * time.Second,

		NTPIPTTL:                1,
		NTPLocalOffsetTolerance: time.Millisecond,
		NTPMaxDistance:          time.Microsecond * 3466080,
		NTPProtocolVersion:      4,
		NTPServer:               "127.0.0.1",

		NetclassIgnoredDevices: "^$",
		NetstatFields:          "^(.*_(InErrors|InErrs)|Ip_Forwarding|Ip(6|Ext)_(InOctets|OutOctets)|Icmp6?_(InMsgs|OutMsgs)|TcpExt_(Listen.*|Syncookies.*|TCPSynRetrans|TCPTimeouts)|Tcp_(ActiveOpens|InSegs|OutSegs|OutRsts|PassiveOpens|RetransSegs|CurrEstab)|Udp6?_(InDatagrams|OutDatagrams|NoPorts|RcvbufErrors|SndbufErrors))$",

		PowersupplyIgnoredSupplies: "^$",

		RunitServiceDir: "/etc/service",

		SupervisordURL: "http://localhost:9001/RPC2",

		SystemdUnitExclude: ".+\\.(automount|device|mount|scope|slice)",
		SystemdUnitInclude: ".+",

		TapestatsIgnoredDevices: "^$",

		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

func MapConfigToNodeExporterFlags(c *Config) (accepted []string, ignored []string)

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 Collector

type Collector string

Collector is a specific collector that node_exporter runs.

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 {
	IncludeExporterMetrics bool `yaml:"include_exporter_metrics,omitempty"`

	ProcFSPath string `yaml:"procfs_path,omitempty"`
	SysFSPath  string `yaml:"sysfs_path,omitempty"`
	RootFSPath string `yaml:"rootfs_path,omitempty"`

	// Collectors to mark as enabled
	EnableCollectors flagext.StringSlice `yaml:"enable_collectors,omitempty"`

	// Collectors to mark as disabled
	DisableCollectors flagext.StringSlice `yaml:"disable_collectors,omitempty"`

	// Overrides the default set of enabled collectors with the collectors
	// listed.
	SetCollectors flagext.StringSlice `yaml:"set_collectors,omitempty"`

	// Collector-specific config options
	BcachePriorityStats              bool                `yaml:"enable_bcache_priority_stats,omitempty"`
	CPUBugsInclude                   string              `yaml:"cpu_bugs_include,omitempty"`
	CPUEnableCPUGuest                bool                `yaml:"enable_cpu_guest_seconds_metric,omitempty"`
	CPUEnableCPUInfo                 bool                `yaml:"enable_cpu_info_metric,omitempty"`
	CPUFlagsInclude                  string              `yaml:"cpu_flags_include,omitempty"`
	DiskStatsIgnoredDevices          string              `yaml:"diskstats_ignored_devices,omitempty"`
	EthtoolDeviceExclude             string              `yaml:"ethtool_device_exclude,omitempty"`
	EthtoolDeviceInclude             string              `yaml:"ethtool_device_include,omitempty"`
	EthtoolMetricsInclude            string              `yaml:"ethtool_metrics_include,omitempty"`
	FilesystemFSTypesExclude         string              `yaml:"filesystem_fs_types_exclude,omitempty"`
	FilesystemMountPointsExclude     string              `yaml:"filesystem_mount_points_exclude,omitempty"`
	FilesystemMountTimeout           time.Duration       `yaml:"filesystem_mount_timeout,omitempty"`
	IPVSBackendLabels                []string            `yaml:"ipvs_backend_labels,omitempty"`
	NTPIPTTL                         int                 `yaml:"ntp_ip_ttl,omitempty"`
	NTPLocalOffsetTolerance          time.Duration       `yaml:"ntp_local_offset_tolerance,omitempty"`
	NTPMaxDistance                   time.Duration       `yaml:"ntp_max_distance,omitempty"`
	NTPProtocolVersion               int                 `yaml:"ntp_protocol_version,omitempty"`
	NTPServer                        string              `yaml:"ntp_server,omitempty"`
	NTPServerIsLocal                 bool                `yaml:"ntp_server_is_local,omitempty"`
	NetclassIgnoreInvalidSpeedDevice bool                `yaml:"netclass_ignore_invalid_speed_device,omitempty"`
	NetclassIgnoredDevices           string              `yaml:"netclass_ignored_devices,omitempty"`
	NetdevAddressInfo                bool                `yaml:"netdev_address_info,omitempty"`
	NetdevDeviceExclude              string              `yaml:"netdev_device_exclude,omitempty"`
	NetdevDeviceInclude              string              `yaml:"netdev_device_include,omitempty"`
	NetstatFields                    string              `yaml:"netstat_fields,omitempty"`
	PerfCPUS                         string              `yaml:"perf_cpus,omitempty"`
	PerfTracepoint                   flagext.StringSlice `yaml:"perf_tracepoint,omitempty"`
	PowersupplyIgnoredSupplies       string              `yaml:"powersupply_ignored_supplies,omitempty"`
	RunitServiceDir                  string              `yaml:"runit_service_dir,omitempty"`
	SupervisordURL                   string              `yaml:"supervisord_url,omitempty"`
	SystemdEnableRestartsMetrics     bool                `yaml:"systemd_enable_restarts_metrics,omitempty"`
	SystemdEnableStartTimeMetrics    bool                `yaml:"systemd_enable_start_time_metrics,omitempty"`
	SystemdEnableTaskMetrics         bool                `yaml:"systemd_enable_task_metrics,omitempty"`
	SystemdUnitExclude               string              `yaml:"systemd_unit_exclude,omitempty"`
	SystemdUnitInclude               string              `yaml:"systemd_unit_include,omitempty"`
	TapestatsIgnoredDevices          string              `yaml:"tapestats_ignored_devices,omitempty"`
	TextfileDirectory                string              `yaml:"textfile_directory,omitempty"`
	VMStatFields                     string              `yaml:"vmstat_fields,omitempty"`

	UnmarshalWarnings []string `yaml:"-"`
}

Config controls the node_exporter integration.

func (*Config) InstanceKey added in v0.21.0

func (c *Config) InstanceKey(agentKey string) (string, error)

InstanceKey returns the hostname:port of the agent process.

func (*Config) Name added in v0.10.0

func (c *Config) Name() string

Name returns the name of the integration that this config represents.

func (*Config) NewIntegration added in v0.10.0

func (c *Config) NewIntegration(l log.Logger) (integrations.Integration, error)

NewIntegration converts this config into an instance of an integration.

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

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) MetricsHandler added in v0.14.0

func (i *Integration) MetricsHandler() (http.Handler, error)

MetricsHandler implements Integration.

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.

Jump to

Keyboard shortcuts

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