diff options
author | Rahil Bhimjiani <rahil3108@gmail.com> | 2023-10-01 22:09:42 +0530 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-11-23 12:38:29 +0000 |
commit | e08275b72c23fd6ab1b4c4a9960a4e8b46105301 (patch) | |
tree | 48b11419c46c8e07911615d6dea0cea048055978 /app-metrics/node_exporter/files | |
parent | app-containers/skopeo: add live & 1.14.0 (diff) | |
download | gentoo-e08275b72c23fd6ab1b4c4a9960a4e8b46105301.tar.gz gentoo-e08275b72c23fd6ab1b4c4a9960a4e8b46105301.tar.bz2 gentoo-e08275b72c23fd6ab1b4c4a9960a4e8b46105301.zip |
app-metrics/node_exporter: add 1.7.0 and live
1. Added a patch from debian which removes deprecated legacy pre-1.0
era stuff
2. Added logrotate config
3. added systemd unit file with improvements
4. new use flag - systemd. When enabled it enables systemd collector by
default
5. install manpage (which was not the case before)
6. Add essential docs and examples
7. split LICENSE
8. follow skel.ebuild for {R,,B}DEPEND
[sam: Maintainer timeout after pings on IRC and in the bug.]
Closes: https://bugs.gentoo.org/915505
Signed-off-by: Rahil Bhimjiani <rahil3108@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-metrics/node_exporter/files')
3 files changed, 163 insertions, 0 deletions
diff --git a/app-metrics/node_exporter/files/01-default-settings-1.7.0.patch b/app-metrics/node_exporter/files/01-default-settings-1.7.0.patch new file mode 100644 index 000000000000..114c6d23423e --- /dev/null +++ b/app-metrics/node_exporter/files/01-default-settings-1.7.0.patch @@ -0,0 +1,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.", diff --git a/app-metrics/node_exporter/files/node_exporter-1.7.0.logrotate b/app-metrics/node_exporter/files/node_exporter-1.7.0.logrotate new file mode 100644 index 000000000000..82cad3ace322 --- /dev/null +++ b/app-metrics/node_exporter/files/node_exporter-1.7.0.logrotate @@ -0,0 +1,9 @@ +/var/log/node_exporter/node_exporter.log { + weekly + rotate 10 + copytruncate + compress + delaycompress + notifempty + missingok +} diff --git a/app-metrics/node_exporter/files/node_exporter-1.7.0.service b/app-metrics/node_exporter/files/node_exporter-1.7.0.service new file mode 100644 index 000000000000..e704c809b8e5 --- /dev/null +++ b/app-metrics/node_exporter/files/node_exporter-1.7.0.service @@ -0,0 +1,21 @@ +[Unit] +Description=Prometheus exporter for machine metrics +Documentation=https://github.com/prometheus/node_exporter +Requires=network-online.target +After=network-online.target + +[Service] +User=node_exporter +Group=node_exporter +Restart=on-failure +Type=exec +ExecStart=/usr/sbin/node_exporter +ExecReload=/usr/bin/kill -HUP $MAINPID +TimeoutStopSec=20s +SendSIGKILL=no +NoNewPrivileges=true +ProtectHome=read-only +ProtectSystem=strict + +[Install] +WantedBy=multi-user.target |