improve a bit the monitor infrastructure for containers

This commit is contained in:
Ingolf Wagner 2024-05-19 10:44:37 +02:00
parent 8866476c9d
commit 3e17996965
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
7 changed files with 12 additions and 16 deletions

View file

@ -4,15 +4,12 @@ with types;
{
imports = [ ./default.nix ];
options.components.monitor.container.promtail.port = mkOption {
type = int;
};
config = {
components.monitor.enable = mkDefault true;
components.monitor.metrics.enable = mkDefault false;
components.monitor.promtail.port = config.components.monitor.container.promtail.port;
components.monitor.opentelemetry.exporter.endpoint = mkDefault "127.0.0.1:4317";
components.monitor.opentelemetry.enable = false;
services.journald.extraConfig = "SystemMaxUse=1G";
};
}

View file

@ -19,8 +19,7 @@ in
config = mkMerge [
(mkIf config.components.monitor.promtail.enable {
(mkIf config.components.monitor.opentelemetry.enable {
services.opentelemetry-collector.settings = {
receivers.loki = {
protocols.http.endpoint = "127.0.0.1:${toString cfg.port}";
@ -28,7 +27,9 @@ in
};
service.pipelines.logs.receivers = [ "loki" ];
};
})
(mkIf config.components.monitor.promtail.enable {
services.promtail = {
enable = true;
configuration = {

View file

@ -6,6 +6,11 @@ let
in
{
options.components.monitor.opentelemetry = {
enable = mkOption {
type = bool;
default = config.components.monitor.enable;
description = "weather or not to use opentelemetry";
};
receiver.endpoint = mkOption {
type = nullOr str;
default = null;
@ -30,7 +35,7 @@ in
config = mkMerge [
(mkIf config.components.monitor.enable {
(mkIf config.components.monitor.opentelemetry.enable {
services.opentelemetry-collector = {
enable = true;
package = pkgs.unstable.opentelemetry-collector-contrib;

View file

@ -90,9 +90,7 @@ in
config = { config, lib, ... }: {
nixpkgs.pkgs = pkgs;
imports = [ ../../components/monitor/container.nix ];
components.monitor.container.promtail.port = 3502;
system.stateVersion = "23.11";
services.journald.extraConfig = "SystemMaxUse=1G";
# Configuring nameservers for containers is currently broken.
# Therefore in some cases internet connectivity can be broken inside the containers.

View file

@ -26,9 +26,7 @@ in
config = { config, lib, ... }: {
nixpkgs.pkgs = pkgs;
imports = [ ../../components/monitor/container.nix ];
components.monitor.container.promtail.port = 3505;
system.stateVersion = "21.05";
services.journald.extraConfig = "SystemMaxUse=1G";
# allow transmission to write in syncthing folders
users.groups.syncthing = {

View file

@ -16,9 +16,7 @@ in
config = { config, lib, ... }: {
nixpkgs.pkgs = pkgs;
imports = [ ../../components/monitor/container.nix ];
components.monitor.container.promtail.port = 3503;
system.stateVersion = "23.11";
services.journald.extraConfig = "SystemMaxUse=1G";
# Photoprism
# ----------

View file

@ -71,7 +71,6 @@ in
config = { config, lib, ... }: {
nixpkgs.pkgs = pkgs;
imports = [ ../../components/monitor/container.nix ];
components.monitor.container.promtail.port = 3504;
system.stateVersion = "23.11";
services.postgresql = {