10 cfg = config.services.prometheus.exporters.mongodb;
27 default = "mongodb://localhost:27017/test";
28 example = "mongodb://localhost:27017/test";
29 description = "MongoDB URI to connect to.";
31 collStats = mkOption {
32 type = types.listOf types.str;
39 List of comma separared databases.collections to get $collStats
42 indexStats = mkOption {
43 type = types.listOf types.str;
50 List of comma separared databases.collections to get $indexStats
53 collector = mkOption {
54 type = types.listOf types.str;
66 description = "Enabled collectors";
68 collectAll = mkOption {
72 Enable all collectors. Same as specifying all --collector.<name>
75 telemetryPath = mkOption {
79 description = "Metrics expose path";
84 RuntimeDirectory = "prometheus-mongodb-exporter";
86 ${getExe pkgs.prometheus-mongodb-exporter} \
87 --mongodb.uri="${cfg.uri}" \
89 if cfg.collectAll then
92 concatMapStringsSep " " (x: "--collect.${x}") cfg.collector
96 length cfg.collStats > 0
97 ) "--mongodb.collstats-colls=${concatStringsSep "," cfg.collStats}"
101 length cfg.indexStats > 0
102 ) "--mongodb.indexstats-colls=${concatStringsSep "," cfg.indexStats}"
104 --web.listen-address="${cfg.listenAddress}:${toString cfg.port}" \
105 --web.telemetry-path="${cfg.telemetryPath}" \
106 ${escapeShellArgs cfg.extraFlags}