nixpkgs/nixos/modules/services/monitoring
Martin Weinelt 12c26aca1f
prometheus.exporters.smartctl: Fix autodiscovery
When no devices are given the exporter tries to autodiscover available
disks. The previous DevicePolicy was however preventing the exporter
from accessing any device at all, since only explicitly mentioned ones
were allowed.

This commit adds an allow rule for several device classes that I could
find on my machines, that gets set when no devices are explicitly
configured.

There is an existing problem with nvme devices, that expose a character
device at `/dev/nvme0`, and a (namespaced) block device at
`/dev/nvme0n1`. The character device does not come with permissions that
we could give to the exporter without further impacting the hardening.

  crw------- 1 root root 247, 0 27. Jan 03:10 /dev/nvme0
  brw-rw---- 1 root disk 259, 0 27. Jan 03:10 /dev/nvme0n1

The autodiscovery only finds the character device, which the exporter
unfortunately does not have access to.

However a simple udev rule can be used to resolve this:

  services.udev.extraRules = ''
    SUBSYSTEM=="nvme", KERNEL=="nvme[0-9]*", GROUP="disk"
  '';

Unfortunately I'm not fully aware of the security implications this
change carries and we should question upstream (systemd) why they did
not include such a rule.
The disk group has no members on any of my machines.

  ❯ getent group disk
  disk6:
2022-01-27 17:33:27 +01:00
..
dd-agent nixos/modules: remove trailing whitespace 2020-08-07 14:45:39 +01:00
prometheus prometheus.exporters.smartctl: Fix autodiscovery 2022-01-27 17:33:27 +01:00
alerta.nix nixos: fixes after #136909 2021-10-05 12:48:43 +02:00
apcupsd.nix treewide: fix double quoted strings in meta.description 2021-01-24 19:56:59 +07:00
arbtt.nix nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
bosun.nix nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
cadvisor.nix nixos/cadvisor: add zfs to path when zfs enabled 2021-11-17 20:47:44 +02:00
collectd.nix nixos/collectd: validate config file syntax at build time 2021-12-23 00:08:43 +01:00
das_watchdog.nix
datadog-agent.nix nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
do-agent.nix nixos/do-agent: use .service from upstream 2020-07-23 19:30:01 +08:00
fusion-inventory.nix
grafana-image-renderer.nix nixos/grafana-image-renderer: typo fix 2021-01-18 18:44:58 +01:00
grafana-reporter.nix nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
grafana.nix treewide: add defaultText for options with simple interpolation defaults 2021-12-09 01:13:48 +01:00
graphite.nix Merge pull request #148785 from pennae/more-option-doc-staticizing 2021-12-17 11:14:08 -05:00
hdaps.nix
heapster.nix nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
incron.nix nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
kapacitor.nix nixos: fixes after #136909 2021-10-05 12:48:43 +02:00
loki.nix nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
longview.nix
mackerel-agent.nix nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
metricbeat.nix nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
monit.nix nixos/monit: add ryantm as maintainer 2020-09-18 22:09:22 -07:00
munin.nix nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
nagios.nix nixos/*: add trivial defaultText for options with simple defaults 2021-12-02 22:35:04 +01:00
netdata.nix nixos/netdata: expose /etc/netdata 2022-01-10 23:56:57 +02:00
parsedmarc.md nixos/parsedmarc: Add manual entry and release note 2021-09-13 13:57:17 +02:00
parsedmarc.nix Merge pull request #148785 from pennae/more-option-doc-staticizing 2021-12-17 11:14:08 -05:00
parsedmarc.xml nixos/parsedmarc: Add manual entry and release note 2021-09-13 13:57:17 +02:00
riemann-dash.nix
riemann-tools.nix
riemann.nix
scollector.nix nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
smartd.nix Merge pull request #148785 from pennae/more-option-doc-staticizing 2021-12-17 11:14:08 -05:00
statsd.nix nixos/statsd: fix username 2020-02-10 17:56:35 +01:00
sysstat.nix
teamviewer.nix nixos/teamviewer: fix issue #44307 2021-09-30 19:36:45 -04:00
telegraf.nix nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
thanos.nix treewide: add literalDocBook text to options with complex defaults 2021-12-09 01:38:24 +01:00
tuptime.nix nixos: define the primary group of users where needed 2021-09-12 14:59:30 +02:00
unifi-poller.nix Merge pull request #136191 from LeSuisse/nixos-unifi-poller-loki 2021-11-03 08:25:13 +01:00
ups.nix treewide: fix double quoted strings in meta.description 2021-01-24 19:56:59 +07:00
uptime.nix treewide: add defaultText for options with simple cfg.* expression defaults 2021-12-09 01:14:16 +01:00
vnstat.nix nixos/vnstat: homedir -> statedir 2021-04-24 00:31:58 +02:00
zabbix-agent.nix nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
zabbix-proxy.nix treewide: add defaultText for options using other shortcut bindings 2021-12-09 01:42:24 +01:00
zabbix-server.nix treewide: add defaultText for options using other shortcut bindings 2021-12-09 01:42:24 +01:00