This commit is contained in:
Lukas Wurzinger 2025-03-25 20:20:05 +01:00
parent 817ec5b6b8
commit 7061c52ef6
No known key found for this signature in database
6 changed files with 230 additions and 204 deletions

View file

@ -1,47 +1,48 @@
{config, ...}: let # {config, ...}: let
virtualHostName = "grafana.helveticanonstandard.net"; # virtualHostName = "grafana.helveticanonstandard.net";
in { # in {
services.grafana = { # services.grafana = {
enable = true; # enable = true;
#
settings = { # settings = {
server = { # server = {
domain = virtualHostName; # domain = virtualHostName;
http_port = 9010; # http_port = 9010;
http_addr = "127.0.0.1"; # http_addr = "127.0.0.1";
root_url = "http://192.168.1.10:8010"; # TODO # root_url = "http://192.168.1.10:8010"; # TODO
protocol = "http"; # protocol = "http";
}; # };
#
analytics.reporting_enabled = false; # analytics.reporting_enabled = false;
}; # };
#
provision = { # provision = {
enable = true; # enable = true;
datasources.settings.datasources = [ # datasources.settings.datasources = [
{ # {
name = "Prometheus"; # name = "Prometheus";
type = "prometheus"; # type = "prometheus";
access = "proxy"; # access = "proxy";
url = "http://127.0.0.1:${builtins.toString config.services.prometheus.port}"; # url = "http://127.0.0.1:${builtins.toString config.services.prometheus.port}";
} # }
{ # {
name = "Loki"; # name = "Loki";
type = "loki"; # type = "loki";
access = "proxy"; # access = "proxy";
url = "http://127.0.0.1:${builtins.toString config.services.loki.configuration.server.http_listen_port}"; # url = "http://127.0.0.1:${builtins.toString config.services.loki.configuration.server.http_listen_port}";
} # }
]; # ];
}; # };
}; # };
#
# services.nginx.virtualHosts.${virtualHostName} = { # # services.nginx.virtualHosts.${virtualHostName} = {
# locations."/" = { # # locations."/" = {
# proxyPass = let # # proxyPass = let
# host = config.services.grafana.settings.server.http_addr; # # host = config.services.grafana.settings.server.http_addr;
# port = builtins.toString config.services.grafana.settings.server.http_port; # # port = builtins.toString config.services.grafana.settings.server.http_port;
# in "http://${host}:${port}"; # # in "http://${host}:${port}";
# proxyWebsockets = true; # # proxyWebsockets = true;
# }; # # };
# }; # # };
} # }
{}

View file

@ -1,78 +1,79 @@
{config, ...}: { # {config, ...}: {
services.loki = { # services.loki = {
enable = true; # enable = true;
configuration = { # configuration = {
server.http_listen_port = 3030; # server.http_listen_port = 3030;
auth_enabled = false; # auth_enabled = false;
#
ingester = { # ingester = {
lifecycler = { # lifecycler = {
address = "127.0.0.1"; # address = "127.0.0.1";
ring = { # ring = {
kvstore = { # kvstore = {
store = "inmemory"; # store = "inmemory";
}; # };
replication_factor = 1; # replication_factor = 1;
}; # };
}; # };
chunk_idle_period = "1h"; # chunk_idle_period = "1h";
max_chunk_age = "1h"; # max_chunk_age = "1h";
chunk_target_size = 999999; # chunk_target_size = 999999;
chunk_retain_period = "30s"; # chunk_retain_period = "30s";
max_transfer_retries = 0; # max_transfer_retries = 0;
}; # };
#
schema_config = { # schema_config = {
configs = [ # configs = [
{ # {
from = "2022-06-06"; #TODO # from = "2022-06-06"; #TODO
store = "tsdb"; # store = "tsdb";
object_store = "filesystem"; # object_store = "filesystem";
schema = "v13"; # schema = "v13";
index = { # index = {
prefix = "index_"; # prefix = "index_";
period = "24h"; # period = "24h";
}; # };
} # }
]; # ];
}; # };
#
storage_config = { # storage_config = {
tsdb_shipper = { # tsdb_shipper = {
active_index_directory = "${config.services.loki.dataDir}/tsdb-shipper-active"; # active_index_directory = "${config.services.loki.dataDir}/tsdb-shipper-active";
cache_location = "${config.services.loki.dataDir}/tsdb-shipper-cache"; # cache_location = "${config.services.loki.dataDir}/tsdb-shipper-cache";
cache_ttl = "24h"; # cache_ttl = "24h";
shared_store = "filesystem"; # shared_store = "filesystem";
}; # };
#
filesystem = { # filesystem = {
directory = "/var/lib/loki/chunks"; # directory = "/var/lib/loki/chunks";
}; # };
}; # };
#
limits_config = { # limits_config = {
reject_old_samples = true; # reject_old_samples = true;
reject_old_samples_max_age = "168h"; # reject_old_samples_max_age = "168h";
}; # };
#
chunk_store_config = { # chunk_store_config = {
max_look_back_period = "0s"; # max_look_back_period = "0s";
}; # };
#
table_manager = { # table_manager = {
retention_deletes_enabled = false; # retention_deletes_enabled = false;
retention_period = "0s"; # retention_period = "0s";
}; # };
#
compactor = { # compactor = {
working_directory = config.services.loki.dataDir; # working_directory = config.services.loki.dataDir;
shared_store = "filesystem"; # shared_store = "filesystem";
compactor_ring = { # compactor_ring = {
kvstore = { # kvstore = {
store = "inmemory"; # store = "inmemory";
}; # };
}; # };
}; # };
}; # };
}; # };
} # }
{}

View file

@ -1,29 +1,30 @@
{config, ...}: { # {config, ...}: {
services.prometheus = { # services.prometheus = {
enable = true; # enable = true;
port = 3020; # port = 3020;
#
exporters = { # exporters = {
node = { # node = {
enable = true; # enable = true;
listenAddress = "127.0.0.1"; # listenAddress = "127.0.0.1";
port = 3021; # port = 3021;
enabledCollectors = ["systemd"]; # enabledCollectors = ["systemd"];
}; # };
}; # };
#
scrapeConfigs = [ # scrapeConfigs = [
{ # {
job_name = "nodes"; # job_name = "nodes";
static_configs = [ # static_configs = [
{ # {
targets = let # targets = let
host = config.services.prometheus.exporters.node.listenAddress; # host = config.services.prometheus.exporters.node.listenAddress;
port = builtins.toString config.services.prometheus.exporters.node.port; # port = builtins.toString config.services.prometheus.exporters.node.port;
in ["${host}:${port}"]; # in ["${host}:${port}"];
} # }
]; # ];
} # }
]; # ];
}; # };
} # }
{}

View file

@ -1,41 +1,42 @@
{config, ...}: { # {config, ...}: {
services.promtail = { # services.promtail = {
enable = true; # enable = true;
#
configuration = { # configuration = {
server = { # server = {
http_listen_port = 3031; # http_listen_port = 3031;
grpc_listen_port = 0; # grpc_listen_port = 0;
}; # };
#
positions = { # positions = {
filename = "/tmp/positions.yaml"; # filename = "/tmp/positions.yaml";
}; # };
#
clients = [ # clients = [
{ # {
url = "http://127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push"; # url = "http://127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push";
} # }
]; # ];
#
scrape_configs = [ # scrape_configs = [
{ # {
job_name = "journal"; # job_name = "journal";
journal = { # journal = {
max_age = "12h"; # max_age = "12h";
labels = { # labels = {
job = "systemd-journal"; # job = "systemd-journal";
host = "pihole"; # host = "pihole";
}; # };
}; # };
relabel_configs = [ # relabel_configs = [
{ # {
source_labels = ["__journal__systemd_unit"]; # source_labels = ["__journal__systemd_unit"];
target_label = "unit"; # target_label = "unit";
} # }
]; # ];
} # }
]; # ];
}; # };
}; # };
} # }
{}

View file

@ -1,7 +1,7 @@
{ {
nix.gc = { nix.gc = {
automatic = true; automatic = true;
dates = "weekly"; dates = "daily";
options = "--delete-older-than 30d"; options = "--delete-older-than +5";
}; };
} }

View file

@ -332,11 +332,11 @@
}, },
"hardware": { "hardware": {
"locked": { "locked": {
"lastModified": 1742631601, "lastModified": 1742806253,
"narHash": "sha256-yJ3OOAmsGAxSl0bTmKUp3+cEYtSS+V6hUPK2rYhIPr8=", "narHash": "sha256-zvQ4GsCJT6MTOzPKLmlFyM+lxo0JGQ0cSFaZSACmWfY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "380ed15bcd6440606c6856db44a99140d422b46f", "rev": "ecaa2d911e77c265c2a5bac8b583c40b0f151726",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -463,14 +463,15 @@
"inputs": { "inputs": {
"flake-compat": "flake-compat_3", "flake-compat": "flake-compat_3",
"nixpkgs": "nixpkgs_6", "nixpkgs": "nixpkgs_6",
"nixpkgs-stable": "nixpkgs-stable_2" "nixpkgs-stable": "nixpkgs-stable_2",
"rust-overlay": "rust-overlay_2"
}, },
"locked": { "locked": {
"lastModified": 1742641703, "lastModified": 1742863891,
"narHash": "sha256-hoN8blvJco8OSZmPj8izwQaQUdydVi+5FO4/nWd1MNU=", "narHash": "sha256-/mGCIxO7zlWCHOZLaOMRoJgSLpIav0PBKWG3BQddElw=",
"owner": "lilyinstarlight", "owner": "lilyinstarlight",
"repo": "nixos-cosmic", "repo": "nixos-cosmic",
"rev": "216557e6cd229dbe7d73a497c227824a3c579cd7", "rev": "366999efebcad2165f472ef93e9c996693bda75d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -724,6 +725,27 @@
"type": "github" "type": "github"
} }
}, },
"rust-overlay_2": {
"inputs": {
"nixpkgs": [
"nixos-cosmic",
"nixpkgs"
]
},
"locked": {
"lastModified": 1742437918,
"narHash": "sha256-Vflb6KJVDikFcM9E231mRN88uk4+jo7BWtaaQMifthI=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "f03085549609e49c7bcbbee86a1949057d087199",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": { "systems": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,