Commit Graph

15 Commits

Author SHA1 Message Date
Pyrox
ae359d1ef2
nixos/prometheus/exporters: Remove all with lib; usage
Fixes issues described in #208242 for this part of the nixpkgs tree.

There are no behavioral changes in this, it only adjusts the code so
that it is easier to understand.
2024-04-24 14:42:16 -04:00
stuebinm
6afb255d97 nixos: remove all uses of lib.mdDoc
these changes were generated with nixq 0.0.2, by running

  nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix

two mentions of the mdDoc function remain in nixos/, both of which
are inside of comments.

Since lib.mdDoc is already defined as just id, this commit is a no-op as
far as Nix (and the built manual) is concerned.
2024-04-13 10:07:35 -07:00
Martin Weinelt
d702c91302
nixos/prometheus/exporters: pass utils into exporter modules
This is useful, because it provides escapeSystemdShellArgs.
2024-03-21 05:27:21 +01:00
ajs124
6fc4e722c4 nixos/prometheus-smartctl-exporter: fix evaluation after adding cfg.extraFlags
was done in 3c61665b7f but does not evaluate
error: value is a string with context while a list was expected
2023-04-13 17:32:50 +02:00
Jakub Sokołowski
3c61665b7f
nixos/prometheus-smartctl-exporter: support extraFlags
Seems to be ignored currently. Useful for `-verbose` flag.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-04-12 23:56:32 +02:00
Martin Weinelt
fdcc9e8202
nixos/prometheus.exporters.smartctl: Simplify DeviceAllow logic
Setting up the DeviceAllow list with explicitly configured devices was a
nice idea, but sometimes a configured device (`/dev/nvme0n1` an NVMe
namespace) has a parent device (`/dev/nvme0`) that smartctl needs to
access to query metrics.

Falling back to the block and character definitions is probably a valid
fallback.
2022-12-09 01:40:01 +01:00
Sergey Lukjanov
a49feed255 nixos/prometheus.exporters.smartctl: use cli args instead of config
Config support was dropped and replaced with CLI args
2022-12-08 15:31:33 -08:00
Martin Weinelt
96d7f29087
Merge pull request #176553 from MalteT/fix/smartctl-exporter-override 2022-10-27 15:50:54 +02:00
MidAutumnMoon
afb8d0e5a6
nixos/prometheus-smartctl: set proper SystemCallFilter 2022-10-25 16:47:09 +08:00
pennae
087472b1e5 nixos/*: automatically convert option docs 2022-08-06 20:39:12 +02:00
Malte Tammena
488aa85ca1 Increase override priority for DeviceAllow 2022-06-06 15:00:32 +02:00
Martin Weinelt
9d8a23f66e
nixos/smartctl-exporter: fix typo in rawio capab 2022-01-30 04:32:15 +01:00
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
Martin Weinelt
f860b289d4
prometheus.exporters.smartctl: Allow RAWIO
This allows the exporter to perform SCSI commands and interact with hpsa
and cciss devices.
2022-01-27 13:49:25 +01:00
Martin Weinelt
386a1e79eb
nixos/smartctl-exporter: init 2021-11-23 11:30:28 +01:00