1{
2 config,
3 lib,
4 pkgs,
5 utils,
6 ...
7}:
8
9let
10 inherit (lib)
11 getExe
12 mkOption
13 types
14 ;
15
16 inherit (utils) escapeSystemdExecArgs;
17
18 cfg = config.services.prometheus.exporters.rasdaemon;
19in
20{
21 port = 10029;
22 extraOpts = with types; {
23 databasePath = mkOption {
24 type = path;
25 default = "/var/lib/rasdaemon/ras-mc_event.db";
26 description = ''
27 Path to the RAS daemon machine check event database.
28 '';
29 };
30
31 enabledCollectors = mkOption {
32 type = listOf (enum [
33 "aer"
34 "mce"
35 "mc"
36 "extlog"
37 "devlink"
38 "disk"
39 ]);
40 default = [
41 "aer"
42 "mce"
43 "mc"
44 ];
45 description = ''
46 List of error types to collect from the event database.
47 '';
48 };
49 };
50 serviceOpts = {
51 serviceConfig = {
52 ExecStart = escapeSystemdExecArgs (
53 [
54 (getExe pkgs.prometheus-rasdaemon-exporter)
55 "--address"
56 cfg.listenAddress
57 "--port"
58 (toString cfg.port)
59 "--db"
60 cfg.databasePath
61 ]
62 ++ map (collector: "--collector-${collector}") cfg.enabledCollectors
63 ++ cfg.extraFlags
64 );
65 };
66 };
67}