3
0
Fork 0
forked from mirrors/nixpkgs
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
prometheus prometheus.exporters.smartctl: Fix autodiscovery 2022-01-27 17:33:27 +01:00
alerta.nix
apcupsd.nix
arbtt.nix
bosun.nix
cadvisor.nix
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
do-agent.nix
fusion-inventory.nix
grafana-image-renderer.nix
grafana-reporter.nix
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
incron.nix
kapacitor.nix
loki.nix
longview.nix
mackerel-agent.nix
metricbeat.nix
monit.nix
munin.nix
nagios.nix
netdata.nix nixos/netdata: expose /etc/netdata 2022-01-10 23:56:57 +02:00
parsedmarc.md
parsedmarc.nix Merge pull request #148785 from pennae/more-option-doc-staticizing 2021-12-17 11:14:08 -05:00
parsedmarc.xml
riemann-dash.nix
riemann-tools.nix
riemann.nix
scollector.nix
smartd.nix Merge pull request #148785 from pennae/more-option-doc-staticizing 2021-12-17 11:14:08 -05:00
statsd.nix
sysstat.nix
teamviewer.nix
telegraf.nix
thanos.nix treewide: add literalDocBook text to options with complex defaults 2021-12-09 01:38:24 +01:00
tuptime.nix
unifi-poller.nix
ups.nix
uptime.nix treewide: add defaultText for options with simple cfg.* expression defaults 2021-12-09 01:14:16 +01:00
vnstat.nix
zabbix-agent.nix
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