mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git
synced 2024-11-25 12:31:27 +00:00
Merge pull request 'add prometheus-based monitoring service' (#66) from nhnn/selfprivacy-nixos-config:monitoring into flakes
Reviewed-on: https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config/pulls/66
This commit is contained in:
commit
ea207b48d6
3
sp-modules/monitoring/config-paths-needed.json
Normal file
3
sp-modules/monitoring/config-paths-needed.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
[
|
||||
[ "selfprivacy", "modules", "monitoring" ]
|
||||
]
|
9
sp-modules/monitoring/flake.nix
Normal file
9
sp-modules/monitoring/flake.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
description = "PoC SP module for Prometheus-based monitoring";
|
||||
|
||||
outputs = { self }: {
|
||||
nixosModules.default = import ./module.nix;
|
||||
configPathsNeeded =
|
||||
builtins.fromJSON (builtins.readFile ./config-paths-needed.json);
|
||||
};
|
||||
}
|
33
sp-modules/monitoring/module.nix
Normal file
33
sp-modules/monitoring/module.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{config, lib, ...}: let
|
||||
cfg = config.selfprivacy.modules.monitoring;
|
||||
in {
|
||||
options.selfprivacy.modules.monitoring = {
|
||||
enable = lib.mkOption {
|
||||
default = false;
|
||||
type = lib.types.bool;
|
||||
};
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.prometheus = {
|
||||
enable = true;
|
||||
port = 9001;
|
||||
listenAddress = "127.0.0.1";
|
||||
exporters = {
|
||||
node = {
|
||||
enable = true;
|
||||
enabledCollectors = [ "systemd" ];
|
||||
port = 9002;
|
||||
listenAddress = "127.0.0.1";
|
||||
};
|
||||
};
|
||||
scrapeConfigs = [
|
||||
{
|
||||
job_name = "node-exporter";
|
||||
static_configs = [{
|
||||
targets = [ "127.0.0.1:9002" ];
|
||||
}];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue