refactor: Remove grafana

This commit is contained in:
batteredbunny 2025-02-26 23:44:49 +02:00
parent 7b23d0b740
commit 05fd54e723
4 changed files with 0 additions and 206 deletions

View file

@ -42,18 +42,6 @@ in
hash = "sha256-kbTKCPjjIGRZZ550lBg0c5Ye4AK4o5yCRynBIvCLYkQ="; hash = "sha256-kbTKCPjjIGRZZ550lBg0c5Ye4AK4o5yCRynBIvCLYkQ=";
}; };
globalConfig = ''
metrics
admin 0.0.0.0:2019
'';
logFormat = ''
output file ${config.services.caddy.logDir}/access.log {
mode 640
}
'';
virtualHosts = { virtualHosts = {
"kaya.ee".extraConfig = '' "kaya.ee".extraConfig = ''
tls { tls {

View file

@ -38,9 +38,6 @@
"bazarr.internal" "bazarr.internal"
"lidarr.internal" "lidarr.internal"
"syncthing.internal" "syncthing.internal"
"stats.internal"
"promtail.internal"
"prometheus.internal"
] "100.93.150.89"; ] "100.93.150.89";
}; };
conditional = conditional =

View file

@ -14,7 +14,6 @@
./nextcloud.nix ./nextcloud.nix
./unpackerr.nix ./unpackerr.nix
./qbittorrent.nix ./qbittorrent.nix
./grafana.nix
./pds.nix ./pds.nix
./gonic.nix ./gonic.nix
./youtuee.nix ./youtuee.nix

View file

@ -1,190 +0,0 @@
{ config, ... }: {
services = {
grafana = {
enable = true;
provision = {
enable = true;
datasources.settings.datasources = [
{
name = "Prometheus";
type = "prometheus";
access = "proxy";
url = "http://127.0.0.1:${toString config.services.prometheus.port}";
}
{
name = "loki";
type = "loki";
access = "proxy";
url = "http://127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}";
}
];
};
settings = {
server = {
http_addr = "127.0.0.1";
http_port = 3002;
enable_gzip = true;
domain = "stats.internal";
};
analytics.reporting_enabled = false;
};
};
promtail = {
enable = true;
configuration = {
server = {
http_listen_port = 3003;
grpc_listen_port = 0;
};
positions.filename = "/tmp/positions.yaml";
clients = [{
url = "http://localhost:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push";
}];
scrape_configs = [{
job_name = "caddy";
static_configs = [{
targets = [ "localhost" ];
labels = {
job = "caddy";
__path__ = "/var/log/caddy/access.log";
};
}];
}];
};
};
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";
};
schema_config = {
configs = [{
from = "2024-04-01";
store = "tsdb";
object_store = "filesystem";
schema = "v13";
index = {
prefix = "index_";
period = "24h";
};
}];
};
storage_config = {
tsdb_shipper = {
active_index_directory = "/var/lib/loki/tsdb-index";
cache_location = "/var/lib/loki/tsdb-cache";
cache_ttl = "24h";
};
filesystem = {
directory = "/var/lib/loki/chunks";
};
};
query_scheduler.max_outstanding_requests_per_tenant = 32768;
querier.max_concurrent = 16;
limits_config = {
reject_old_samples = true;
reject_old_samples_max_age = "168h";
};
table_manager = {
retention_deletes_enabled = false;
retention_period = "0s";
};
compactor = {
working_directory = "/var/lib/loki";
compactor_ring = {
kvstore = {
store = "inmemory";
};
};
};
};
};
prometheus = {
port = 3020;
enable = true;
exporters = {
node = {
port = 3021;
enabledCollectors = [ "systemd" ];
enable = true;
};
};
scrapeConfigs = [
{
job_name = "caddy";
static_configs = [{
targets = [
"127.0.0.1:2019"
];
}];
}
{
job_name = "nodes";
static_configs = [{
targets = [
"127.0.0.1:${toString config.services.prometheus.exporters.node.port}"
];
}];
}
];
};
caddy.virtualHosts = {
"http://prometheus.internal".extraConfig = ''
@local remote_ip private_ranges 100.64.0.0/10
reverse_proxy @local http://127.0.0.1:${toString config.services.prometheus.port}
'';
"http://promtail.internal".extraConfig = ''
@local remote_ip private_ranges 100.64.0.0/10
reverse_proxy @local http://127.0.0.1:${toString config.services.promtail.configuration.server.http_listen_port}
'';
"http://stats.internal".extraConfig = ''
@local remote_ip private_ranges 100.64.0.0/10
reverse_proxy @local http://${config.services.grafana.settings.server.http_addr}:${toString config.services.grafana.settings.server.http_port}
'';
};
borgbackup.jobs."borgbase".paths = [
"/var/lib/loki"
"/var/lib/grafana"
"/var/lib/prometheus2"
];
};
users.users.promtail.extraGroups = [
config.systemd.services.caddy.serviceConfig.Group # Promtail needs caddy group to access its logs
];
}