lazy
This commit is contained in:
parent
817ec5b6b8
commit
7061c52ef6
6 changed files with 230 additions and 204 deletions
|
@ -1,47 +1,48 @@
|
|||
{config, ...}: let
|
||||
virtualHostName = "grafana.helveticanonstandard.net";
|
||||
in {
|
||||
services.grafana = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
server = {
|
||||
domain = virtualHostName;
|
||||
http_port = 9010;
|
||||
http_addr = "127.0.0.1";
|
||||
root_url = "http://192.168.1.10:8010"; # TODO
|
||||
protocol = "http";
|
||||
};
|
||||
|
||||
analytics.reporting_enabled = false;
|
||||
};
|
||||
|
||||
provision = {
|
||||
enable = true;
|
||||
datasources.settings.datasources = [
|
||||
{
|
||||
name = "Prometheus";
|
||||
type = "prometheus";
|
||||
access = "proxy";
|
||||
url = "http://127.0.0.1:${builtins.toString config.services.prometheus.port}";
|
||||
}
|
||||
{
|
||||
name = "Loki";
|
||||
type = "loki";
|
||||
access = "proxy";
|
||||
url = "http://127.0.0.1:${builtins.toString config.services.loki.configuration.server.http_listen_port}";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# services.nginx.virtualHosts.${virtualHostName} = {
|
||||
# locations."/" = {
|
||||
# proxyPass = let
|
||||
# host = config.services.grafana.settings.server.http_addr;
|
||||
# port = builtins.toString config.services.grafana.settings.server.http_port;
|
||||
# in "http://${host}:${port}";
|
||||
# proxyWebsockets = true;
|
||||
# };
|
||||
# };
|
||||
}
|
||||
# {config, ...}: let
|
||||
# virtualHostName = "grafana.helveticanonstandard.net";
|
||||
# in {
|
||||
# services.grafana = {
|
||||
# enable = true;
|
||||
#
|
||||
# settings = {
|
||||
# server = {
|
||||
# domain = virtualHostName;
|
||||
# http_port = 9010;
|
||||
# http_addr = "127.0.0.1";
|
||||
# root_url = "http://192.168.1.10:8010"; # TODO
|
||||
# protocol = "http";
|
||||
# };
|
||||
#
|
||||
# analytics.reporting_enabled = false;
|
||||
# };
|
||||
#
|
||||
# provision = {
|
||||
# enable = true;
|
||||
# datasources.settings.datasources = [
|
||||
# {
|
||||
# name = "Prometheus";
|
||||
# type = "prometheus";
|
||||
# access = "proxy";
|
||||
# url = "http://127.0.0.1:${builtins.toString config.services.prometheus.port}";
|
||||
# }
|
||||
# {
|
||||
# name = "Loki";
|
||||
# type = "loki";
|
||||
# access = "proxy";
|
||||
# url = "http://127.0.0.1:${builtins.toString config.services.loki.configuration.server.http_listen_port}";
|
||||
# }
|
||||
# ];
|
||||
# };
|
||||
# };
|
||||
#
|
||||
# # services.nginx.virtualHosts.${virtualHostName} = {
|
||||
# # locations."/" = {
|
||||
# # proxyPass = let
|
||||
# # host = config.services.grafana.settings.server.http_addr;
|
||||
# # port = builtins.toString config.services.grafana.settings.server.http_port;
|
||||
# # in "http://${host}:${port}";
|
||||
# # proxyWebsockets = true;
|
||||
# # };
|
||||
# # };
|
||||
# }
|
||||
{}
|
||||
|
|
|
@ -1,78 +1,79 @@
|
|||
{config, ...}: {
|
||||
services.loki = {
|
||||
enable = true;
|
||||
configuration = {
|
||||
server.http_listen_port = 3030;
|
||||
auth_enabled = false;
|
||||
|
||||
ingester = {
|
||||
lifecycler = {
|
||||
address = "127.0.0.1";
|
||||
ring = {
|
||||
kvstore = {
|
||||
store = "inmemory";
|
||||
};
|
||||
replication_factor = 1;
|
||||
};
|
||||
};
|
||||
chunk_idle_period = "1h";
|
||||
max_chunk_age = "1h";
|
||||
chunk_target_size = 999999;
|
||||
chunk_retain_period = "30s";
|
||||
max_transfer_retries = 0;
|
||||
};
|
||||
|
||||
schema_config = {
|
||||
configs = [
|
||||
{
|
||||
from = "2022-06-06"; #TODO
|
||||
store = "tsdb";
|
||||
object_store = "filesystem";
|
||||
schema = "v13";
|
||||
index = {
|
||||
prefix = "index_";
|
||||
period = "24h";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
storage_config = {
|
||||
tsdb_shipper = {
|
||||
active_index_directory = "${config.services.loki.dataDir}/tsdb-shipper-active";
|
||||
cache_location = "${config.services.loki.dataDir}/tsdb-shipper-cache";
|
||||
cache_ttl = "24h";
|
||||
shared_store = "filesystem";
|
||||
};
|
||||
|
||||
filesystem = {
|
||||
directory = "/var/lib/loki/chunks";
|
||||
};
|
||||
};
|
||||
|
||||
limits_config = {
|
||||
reject_old_samples = true;
|
||||
reject_old_samples_max_age = "168h";
|
||||
};
|
||||
|
||||
chunk_store_config = {
|
||||
max_look_back_period = "0s";
|
||||
};
|
||||
|
||||
table_manager = {
|
||||
retention_deletes_enabled = false;
|
||||
retention_period = "0s";
|
||||
};
|
||||
|
||||
compactor = {
|
||||
working_directory = config.services.loki.dataDir;
|
||||
shared_store = "filesystem";
|
||||
compactor_ring = {
|
||||
kvstore = {
|
||||
store = "inmemory";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
# {config, ...}: {
|
||||
# services.loki = {
|
||||
# enable = true;
|
||||
# configuration = {
|
||||
# server.http_listen_port = 3030;
|
||||
# auth_enabled = false;
|
||||
#
|
||||
# ingester = {
|
||||
# lifecycler = {
|
||||
# address = "127.0.0.1";
|
||||
# ring = {
|
||||
# kvstore = {
|
||||
# store = "inmemory";
|
||||
# };
|
||||
# replication_factor = 1;
|
||||
# };
|
||||
# };
|
||||
# chunk_idle_period = "1h";
|
||||
# max_chunk_age = "1h";
|
||||
# chunk_target_size = 999999;
|
||||
# chunk_retain_period = "30s";
|
||||
# max_transfer_retries = 0;
|
||||
# };
|
||||
#
|
||||
# schema_config = {
|
||||
# configs = [
|
||||
# {
|
||||
# from = "2022-06-06"; #TODO
|
||||
# store = "tsdb";
|
||||
# object_store = "filesystem";
|
||||
# schema = "v13";
|
||||
# index = {
|
||||
# prefix = "index_";
|
||||
# period = "24h";
|
||||
# };
|
||||
# }
|
||||
# ];
|
||||
# };
|
||||
#
|
||||
# storage_config = {
|
||||
# tsdb_shipper = {
|
||||
# active_index_directory = "${config.services.loki.dataDir}/tsdb-shipper-active";
|
||||
# cache_location = "${config.services.loki.dataDir}/tsdb-shipper-cache";
|
||||
# cache_ttl = "24h";
|
||||
# shared_store = "filesystem";
|
||||
# };
|
||||
#
|
||||
# filesystem = {
|
||||
# directory = "/var/lib/loki/chunks";
|
||||
# };
|
||||
# };
|
||||
#
|
||||
# limits_config = {
|
||||
# reject_old_samples = true;
|
||||
# reject_old_samples_max_age = "168h";
|
||||
# };
|
||||
#
|
||||
# chunk_store_config = {
|
||||
# max_look_back_period = "0s";
|
||||
# };
|
||||
#
|
||||
# table_manager = {
|
||||
# retention_deletes_enabled = false;
|
||||
# retention_period = "0s";
|
||||
# };
|
||||
#
|
||||
# compactor = {
|
||||
# working_directory = config.services.loki.dataDir;
|
||||
# shared_store = "filesystem";
|
||||
# compactor_ring = {
|
||||
# kvstore = {
|
||||
# store = "inmemory";
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
# }
|
||||
{}
|
||||
|
|
|
@ -1,29 +1,30 @@
|
|||
{config, ...}: {
|
||||
services.prometheus = {
|
||||
enable = true;
|
||||
port = 3020;
|
||||
|
||||
exporters = {
|
||||
node = {
|
||||
enable = true;
|
||||
listenAddress = "127.0.0.1";
|
||||
port = 3021;
|
||||
enabledCollectors = ["systemd"];
|
||||
};
|
||||
};
|
||||
|
||||
scrapeConfigs = [
|
||||
{
|
||||
job_name = "nodes";
|
||||
static_configs = [
|
||||
{
|
||||
targets = let
|
||||
host = config.services.prometheus.exporters.node.listenAddress;
|
||||
port = builtins.toString config.services.prometheus.exporters.node.port;
|
||||
in ["${host}:${port}"];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
# {config, ...}: {
|
||||
# services.prometheus = {
|
||||
# enable = true;
|
||||
# port = 3020;
|
||||
#
|
||||
# exporters = {
|
||||
# node = {
|
||||
# enable = true;
|
||||
# listenAddress = "127.0.0.1";
|
||||
# port = 3021;
|
||||
# enabledCollectors = ["systemd"];
|
||||
# };
|
||||
# };
|
||||
#
|
||||
# scrapeConfigs = [
|
||||
# {
|
||||
# job_name = "nodes";
|
||||
# static_configs = [
|
||||
# {
|
||||
# targets = let
|
||||
# host = config.services.prometheus.exporters.node.listenAddress;
|
||||
# port = builtins.toString config.services.prometheus.exporters.node.port;
|
||||
# in ["${host}:${port}"];
|
||||
# }
|
||||
# ];
|
||||
# }
|
||||
# ];
|
||||
# };
|
||||
# }
|
||||
{}
|
||||
|
|
|
@ -1,41 +1,42 @@
|
|||
{config, ...}: {
|
||||
services.promtail = {
|
||||
enable = true;
|
||||
|
||||
configuration = {
|
||||
server = {
|
||||
http_listen_port = 3031;
|
||||
grpc_listen_port = 0;
|
||||
};
|
||||
|
||||
positions = {
|
||||
filename = "/tmp/positions.yaml";
|
||||
};
|
||||
|
||||
clients = [
|
||||
{
|
||||
url = "http://127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push";
|
||||
}
|
||||
];
|
||||
|
||||
scrape_configs = [
|
||||
{
|
||||
job_name = "journal";
|
||||
journal = {
|
||||
max_age = "12h";
|
||||
labels = {
|
||||
job = "systemd-journal";
|
||||
host = "pihole";
|
||||
};
|
||||
};
|
||||
relabel_configs = [
|
||||
{
|
||||
source_labels = ["__journal__systemd_unit"];
|
||||
target_label = "unit";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
# {config, ...}: {
|
||||
# services.promtail = {
|
||||
# enable = true;
|
||||
#
|
||||
# configuration = {
|
||||
# server = {
|
||||
# http_listen_port = 3031;
|
||||
# grpc_listen_port = 0;
|
||||
# };
|
||||
#
|
||||
# positions = {
|
||||
# filename = "/tmp/positions.yaml";
|
||||
# };
|
||||
#
|
||||
# clients = [
|
||||
# {
|
||||
# url = "http://127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push";
|
||||
# }
|
||||
# ];
|
||||
#
|
||||
# scrape_configs = [
|
||||
# {
|
||||
# job_name = "journal";
|
||||
# journal = {
|
||||
# max_age = "12h";
|
||||
# labels = {
|
||||
# job = "systemd-journal";
|
||||
# host = "pihole";
|
||||
# };
|
||||
# };
|
||||
# relabel_configs = [
|
||||
# {
|
||||
# source_labels = ["__journal__systemd_unit"];
|
||||
# target_label = "unit";
|
||||
# }
|
||||
# ];
|
||||
# }
|
||||
# ];
|
||||
# };
|
||||
# };
|
||||
# }
|
||||
{}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue