Skip to content
Snippets Groups Projects
Commit 8b570d49 authored by Florian Sesser's avatar Florian Sesser
Browse files

Use mkIf cfg.enable pattern

Should be pure refactoring
parent e348c991
Branches
No related tags found
No related merge requests found
...@@ -62,6 +62,8 @@ ...@@ -62,6 +62,8 @@
"172.23.23.1" = [ "monitoring" "monitoring.monitoringvpn" ]; "172.23.23.1" = [ "monitoring" "monitoring.monitoringvpn" ];
}; };
services.private-storage.monitoring.exporters.promtail.enable = true;
assertions = [ assertions = [
# This is a check to save somebody in the future trying to debug why # This is a check to save somebody in the future trying to debug why
# setting `nixpkgs.config` is not having an effect. # setting `nixpkgs.config` is not having an effect.
......
...@@ -8,7 +8,6 @@ in { ...@@ -8,7 +8,6 @@ in {
imports = [ imports = [
../../nixos/modules/monitoring/vpn/client.nix ../../nixos/modules/monitoring/vpn/client.nix
../../nixos/modules/monitoring/exporters/node.nix ../../nixos/modules/monitoring/exporters/node.nix
../../nixos/modules/monitoring/exporters/promtail.nix
]; ];
options.grid.issuer = { options.grid.issuer = {
......
...@@ -33,7 +33,6 @@ in { ...@@ -33,7 +33,6 @@ in {
../../nixos/modules/monitoring/server/loki.nix ../../nixos/modules/monitoring/server/loki.nix
../../nixos/modules/monitoring/exporters/node.nix ../../nixos/modules/monitoring/exporters/node.nix
../../nixos/modules/monitoring/exporters/blackbox.nix ../../nixos/modules/monitoring/exporters/blackbox.nix
../../nixos/modules/monitoring/exporters/promtail.nix
]; ];
options.grid.monitoring = { options.grid.monitoring = {
......
...@@ -15,8 +15,6 @@ in { ...@@ -15,8 +15,6 @@ in {
../../nixos/modules/monitoring/exporters/node.nix ../../nixos/modules/monitoring/exporters/node.nix
# Collect Tahoe OpenMetrics statistics. # Collect Tahoe OpenMetrics statistics.
../../nixos/modules/monitoring/exporters/tahoe.nix ../../nixos/modules/monitoring/exporters/tahoe.nix
# Send logs to central logging server.
../../nixos/modules/monitoring/exporters/promtail.nix
]; ];
options.grid.storage = { options.grid.storage = {
......
...@@ -12,5 +12,6 @@ ...@@ -12,5 +12,6 @@
imports = [ imports = [
./packages.nix ./packages.nix
./issuer.nix ./issuer.nix
./monitoring/exporters/promtail.nix
]; ];
} }
...@@ -6,15 +6,21 @@ ...@@ -6,15 +6,21 @@
# exporters, but it is very similar in what it is doing - # exporters, but it is very similar in what it is doing -
# preparing local data and sending it off to a TSDB. # preparing local data and sending it off to a TSDB.
{ config, ... }: { config, options, lib, ... }:
let let
cfg = config.services.private-storage.monitoring.exporters.promtail;
hostName = config.networking.hostName; hostName = config.networking.hostName;
in { in {
config.services.promtail.enable = true; options.services.private-storage.monitoring.exporters.promtail = {
config.networking.firewall.interfaces.monitoringvpn.allowedTCPPorts = [ 9080 ]; enable = lib.mkEnableOption "Promtail log exporter service";
config.services.promtail.configuration = { };
config = lib.mkIf cfg.enable {
services.promtail.enable = true;
networking.firewall.interfaces.monitoringvpn.allowedTCPPorts = [ 9080 ];
services.promtail.configuration = {
server = { server = {
http_listen_port = 9080; # Using /metrics for health check http_listen_port = 9080; # Using /metrics for health check
grpc_listen_address = "127.0.0.1"; # unused, but no option to turn it off. grpc_listen_address = "127.0.0.1"; # unused, but no option to turn it off.
...@@ -39,4 +45,5 @@ in { ...@@ -39,4 +45,5 @@ in {
}]; }];
}]; }];
}; };
};
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment