summaryrefslogtreecommitdiff
blob: 114c6d23423ee9c31c050db2f7536672be8b682a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
Grabbed from https://salsa.debian.org/go-team/packages/prometheus-node-exporter/-/tree/debian/sid/debian/patches
Only thing changed is textFileDirectory default path adapted for Gentoo
##############
Description: Set defaults that make sense for Debian systems.
 We remove the deprecated options completely because they were introduced in
 1.0.0 and were never part of a stable release, and are causing issues with
 the default value setting as it then makes the code consider it a usage and
 errors out when the legacy option is used.
Forwarded: not-needed
---
 collector/filesystem_linux.go |  2 +-
 collector/netdev_common.go    | 22 +---------------------
 collector/systemd_linux.go    | 23 ++---------------------
 collector/textfile.go         |  2 +-
 4 files changed, 5 insertions(+), 44 deletions(-)

--- a/collector/filesystem_linux.go
+++ b/collector/filesystem_linux.go
@@ -33,7 +33,7 @@ import (
 )
 
 const (
-	defMountPointsExcluded = "^/(dev|proc|run/credentials/.+|sys|var/lib/docker/.+|var/lib/containers/storage/.+)($|/)"
+	defMountPointsExcluded = "^/(dev|proc|run|sys|mnt|media|var/lib/docker/.+|var/lib/containers/storage/.+)($|/)"
 	defFSTypesExcluded     = "^(autofs|binfmt_misc|bpf|cgroup2?|configfs|debugfs|devpts|devtmpfs|fusectl|hugetlbfs|iso9660|mqueue|nsfs|overlay|proc|procfs|pstore|rpc_pipefs|securityfs|selinuxfs|squashfs|sysfs|tracefs)$"
 )
 
--- a/collector/netdev_common.go
+++ b/collector/netdev_common.go
@@ -32,9 +32,7 @@ import (
 
 var (
 	netdevDeviceInclude    = kingpin.Flag("collector.netdev.device-include", "Regexp of net devices to include (mutually exclusive to device-exclude).").String()
-	oldNetdevDeviceInclude = kingpin.Flag("collector.netdev.device-whitelist", "DEPRECATED: Use collector.netdev.device-include").Hidden().String()
-	netdevDeviceExclude    = kingpin.Flag("collector.netdev.device-exclude", "Regexp of net devices to exclude (mutually exclusive to device-include).").String()
-	oldNetdevDeviceExclude = kingpin.Flag("collector.netdev.device-blacklist", "DEPRECATED: Use collector.netdev.device-exclude").Hidden().String()
+	netdevDeviceExclude    = kingpin.Flag("collector.netdev.device-exclude", "Regexp of net devices to exclude (mutually exclusive to device-include).").Default("^lo$").String()
 	netdevAddressInfo      = kingpin.Flag("collector.netdev.address-info", "Collect address-info for every device").Bool()
 	netdevDetailedMetrics  = kingpin.Flag("collector.netdev.enable-detailed-metrics", "Use (incompatible) metric names that provide more detailed stats on Linux").Bool()
 )
@@ -55,24 +53,6 @@ func init() {
 
 // NewNetDevCollector returns a new Collector exposing network device stats.
 func NewNetDevCollector(logger log.Logger) (Collector, error) {
-	if *oldNetdevDeviceInclude != "" {
-		if *netdevDeviceInclude == "" {
-			level.Warn(logger).Log("msg", "--collector.netdev.device-whitelist is DEPRECATED and will be removed in 2.0.0, use --collector.netdev.device-include")
-			*netdevDeviceInclude = *oldNetdevDeviceInclude
-		} else {
-			return nil, errors.New("--collector.netdev.device-whitelist and --collector.netdev.device-include are mutually exclusive")
-		}
-	}
-
-	if *oldNetdevDeviceExclude != "" {
-		if *netdevDeviceExclude == "" {
-			level.Warn(logger).Log("msg", "--collector.netdev.device-blacklist is DEPRECATED and will be removed in 2.0.0, use --collector.netdev.device-exclude")
-			*netdevDeviceExclude = *oldNetdevDeviceExclude
-		} else {
-			return nil, errors.New("--collector.netdev.device-blacklist and --collector.netdev.device-exclude are mutually exclusive")
-		}
-	}
-
 	if *netdevDeviceExclude != "" && *netdevDeviceInclude != "" {
 		return nil, errors.New("device-exclude & device-include are mutually exclusive")
 	}
--- a/collector/systemd_linux.go
+++ b/collector/systemd_linux.go
@@ -18,7 +18,6 @@ package collector
 
 import (
 	"context"
-	"errors"
 	"fmt"
 	"math"
 	"regexp"
@@ -47,13 +46,11 @@ var (
 		systemdUnitIncludeSet = true
 		return nil
 	}).String()
-	oldSystemdUnitInclude = kingpin.Flag("collector.systemd.unit-whitelist", "DEPRECATED: Use --collector.systemd.unit-include").Hidden().String()
 	systemdUnitExcludeSet bool
-	systemdUnitExclude    = kingpin.Flag("collector.systemd.unit-exclude", "Regexp of systemd units to exclude. Units must both match include and not match exclude to be included.").Default(".+\\.(automount|device|mount|scope|slice)").PreAction(func(c *kingpin.ParseContext) error {
+	systemdUnitExclude    = kingpin.Flag("collector.systemd.unit-exclude", "Regexp of systemd units to exclude. Units must both match include and not match exclude to be included.").Default(".+\\.(automount|device|mount|scope|slice|target)").PreAction(func(c *kingpin.ParseContext) error {
 		systemdUnitExcludeSet = true
 		return nil
 	}).String()
-	oldSystemdUnitExclude  = kingpin.Flag("collector.systemd.unit-blacklist", "DEPRECATED: Use collector.systemd.unit-exclude").Hidden().String()
 	systemdPrivate         = kingpin.Flag("collector.systemd.private", "Establish a private, direct connection to systemd without dbus (Strongly discouraged since it requires root. For testing purposes only).").Hidden().Bool()
 	enableTaskMetrics      = kingpin.Flag("collector.systemd.enable-task-metrics", "Enables service unit tasks metrics unit_tasks_current and unit_tasks_max").Bool()
 	enableRestartsMetrics  = kingpin.Flag("collector.systemd.enable-restarts-metrics", "Enables service unit metric service_restart_total").Bool()
@@ -83,7 +80,7 @@ type systemdCollector struct {
 var unitStatesName = []string{"active", "activating", "deactivating", "inactive", "failed"}
 
 func init() {
-	registerCollector("systemd", defaultDisabled, NewSystemdCollector)
+	registerCollector("systemd", defaultEnabled, NewSystemdCollector)
 }
 
 // NewSystemdCollector returns a new Collector exposing systemd statistics.
@@ -133,22 +130,6 @@ func NewSystemdCollector(logger log.Logg
 		prometheus.BuildFQName(namespace, subsystem, "version"),
 		"Detected systemd version", []string{"version"}, nil)
 
-	if *oldSystemdUnitExclude != "" {
-		if !systemdUnitExcludeSet {
-			level.Warn(logger).Log("msg", "--collector.systemd.unit-blacklist is DEPRECATED and will be removed in 2.0.0, use --collector.systemd.unit-exclude")
-			*systemdUnitExclude = *oldSystemdUnitExclude
-		} else {
-			return nil, errors.New("--collector.systemd.unit-blacklist and --collector.systemd.unit-exclude are mutually exclusive")
-		}
-	}
-	if *oldSystemdUnitInclude != "" {
-		if !systemdUnitIncludeSet {
-			level.Warn(logger).Log("msg", "--collector.systemd.unit-whitelist is DEPRECATED and will be removed in 2.0.0, use --collector.systemd.unit-include")
-			*systemdUnitInclude = *oldSystemdUnitInclude
-		} else {
-			return nil, errors.New("--collector.systemd.unit-whitelist and --collector.systemd.unit-include are mutually exclusive")
-		}
-	}
 	level.Info(logger).Log("msg", "Parsed flag --collector.systemd.unit-include", "flag", *systemdUnitInclude)
 	systemdUnitIncludePattern := regexp.MustCompile(fmt.Sprintf("^(?:%s)$", *systemdUnitInclude))
 	level.Info(logger).Log("msg", "Parsed flag --collector.systemd.unit-exclude", "flag", *systemdUnitExclude)
--- a/collector/textfile.go
+++ b/collector/textfile.go
@@ -33,7 +33,7 @@ import (
 )
 
 var (
-	textFileDirectory = kingpin.Flag("collector.textfile.directory", "Directory to read text files with metrics from.").Default("").String()
+	textFileDirectory = kingpin.Flag("collector.textfile.directory", "Directory to read text files with metrics from.").Default("/var/lib/node_exporter").String()
 	mtimeDesc         = prometheus.NewDesc(
 		"node_textfile_mtime_seconds",
 		"Unixtime mtime of textfiles successfully read.",