node_exporter

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
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.

View Source
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

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 {
	Common config.Common `yaml:",inline"`

	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
	CPUEnableCPUInfo              bool                `yaml:"enable_cpu_info_metric,omitempty"`
	DiskStatsIgnoredDevices       string              `yaml:"diskstats_ignored_devices,omitempty"`
	FilesystemIgnoredMountPoints  string              `yaml:"filesystem_ignored_mount_points,omitempty"`
	FilesystemIgnoredFSTypes      string              `yaml:"filesystem_ignored_fs_types,omitempty"`
	NetclassIgnoredDevices        string              `yaml:"netclass_ignored_devices,omitempty"`
	NetdevDeviceBlacklist         string              `yaml:"netdev_device_blacklist,omitempty"`
	NetdevDeviceWhitelist         string              `yaml:"netdev_device_whitelist,omitempty"`
	NetstatFields                 string              `yaml:"netstat_fields,omitempty"`
	NTPServer                     string              `yaml:"ntp_server,omitempty"`
	NTPProtocolVersion            int                 `yaml:"ntp_protocol_version,omitempty"`
	NTPServerIsLocal              bool                `yaml:"ntp_server_is_local,omitempty"`
	NTPIPTTL                      int                 `yaml:"ntp_ip_ttl,omitempty"`
	NTPMaxDistance                time.Duration       `yaml:"ntp_max_distance,omitempty"`
	NTPLocalOffsetTolerance       time.Duration       `yaml:"ntp_local_offset_tolerance,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"`
	SystemdUnitWhitelist          string              `yaml:"systemd_unit_whitelist,omitempty"`
	SystemdUnitBlacklist          string              `yaml:"systemd_unit_blacklist,omitempty"`
	SystemdEnableTaskMetrics      bool                `yaml:"systemd_enable_task_metrics,omitempty"`
	SystemdEnableRestartsMetrics  bool                `yaml:"systemd_enable_restarts_metrics,omitempty"`
	SystemdEnableStartTimeMetrics bool                `yaml:"systemd_enable_start_time_metrics,omitempty"`
	VMStatFields                  string              `yaml:"vmstat_fields,omitempty"`
	TextfileDirectory             string              `yaml:"textfile_directory,omitempty"`
}

Config controls the node_exporter integration.

func (*Config) CommonConfig

func (c *Config) CommonConfig() config.Common

CommonConfig returns the common configs that are shared across all integrations.

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