1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-30 11:37:44 +00:00
This commit is contained in:
RGBCube 2024-01-13 22:34:01 +03:00
parent e96561b036
commit 3aa5a5cb10
No known key found for this signature in database
5 changed files with 109 additions and 5 deletions

101
hosts/cube/loki.nix Normal file
View file

@ -0,0 +1,101 @@
{ config, ulib, ... }: with ulib;
serverSystemConfiguration {
services.grafana.provision.datasources.settings.datasources = [{
name = "Loki";
type = "loki";
url = "http://[::]:${toString config.services.promtail.configuration.server.http_listen_port}";
}];
services.promtail = enabled {
configuration = {
server.http_listen_port = 9002;
server.grpc_listen_port = 0;
positions.filename = "/tmp/promtail-positions.yml";
clients = [{
url = "http://[::]:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push";
}];
scrape_configs = [{
job_name = "journal";
journal.max_age = "1w";
journal.labels = {
job = "journal";
host = config.networking.hostName;
};
relabel_configs = [{
source_labels = [ "__journal__systemd_unit" ];
target_label = "journal";
}];
}];
};
};
services.loki = enabled {
configuration = {
auth_enabled = false;
server.http_listen_port = 9001;
ingester = {
lifecycler.address = "::";
lifecycler.ring = {
kvstore.store = "inmemory";
replication_factor = 1;
};
chunk_idle_period = "1h";
chunk_retain_period = "1h";
chunk_target_size = 999999;
max_chunk_age = "1h";
max_transfer_retries = 0;
};
schema_config.configs = [{
from = "2022-06-06";
schema = "v12";
store = "boltdb-shipper";
object_store = "filesystem";
index.period = "24h";
index.prefix = "index_";
}];
storage_config = {
filesystem.directory = "/var/lib/loki/chunks";
boltdb_shipper = {
active_index_directory = "/var/lib/loki/boltdb-shipper-active";
cache_location = "/var/lib/loki/boltdb-shipper-cache";
cache_ttl = "1d";
shared_store = "filesystem";
};
};
limits_config = {
reject_old_samples = true;
reject_old_samples_max_age = "2w";
};
chunk_store_config.max_look_back_period = "0s";
table_manager = {
retention_deletes_enabled = false;
retention_period = "0s";
};
compactor = {
compactor_ring.kvstore.store = "inmemory";
shared_store = "filesystem";
working_directory = "/var/lib/loki";
};
};
};
}

View file

@ -6,7 +6,7 @@ let
fqdn = "mail.${domain}";
in serverSystemConfiguration {
services.prometheus.exporters.postfix = enabled {
port = 9020;
port = 9030;
};
services.prometheus.scrapeConfigs = [{

View file

@ -4,7 +4,7 @@ serverSystemConfiguration {
networking.firewall.allowedTCPPorts = [ 80 443 ];
services.prometheus.exporters.nginx = enabled {
port = 9010;
port = 9020;
};
services.prometheus.scrapeConfigs = [{

View file

@ -2,7 +2,7 @@
(serverSystemConfiguration {
services.prometheus.exporters.postgres = enabled {
port = 9030;
port = 9040;
runAsLocalSuperUser = true;
};
@ -33,6 +33,8 @@
ensureDatabases = [ "grafana" "nextcloud" ];
initialScript = pkgs.writeText "postgresql-initial-script" ''
CREATE ROLE root WITH LOGIN PASSWORD NULL CREATEDB;
CREATE ROLE grafana WITH LOGIN PASSWORD NULL CREATEDB;
GRANT ALL PRIVILEGES ON DATABASE grafana TO grafana;

View file

@ -9,10 +9,11 @@ serverSystemConfiguration {
services.prometheus = enabled {
port = 9000;
retentionTime = "1w";
exporters.node = enabled {
enabledCollectors = [ "processes" "systemd" ];
port = 9001;
port = 9010;
};
scrapeConfigs = [{