Deploy Prometheus + Grafana

This commit is contained in:
minish 2024-12-14 19:24:51 -05:00
parent 2575562c74
commit d0c233b7e1
Signed by: min
SSH Key Fingerprint: SHA256:NFjjdbkd6u7aoMlcrDCVvz6o2UBtlAuPm8IQ2vhZ3Fg
9 changed files with 93 additions and 9 deletions

View File

@ -11,6 +11,7 @@
./nebula.nix
./zfs.nix
./samba.nix
./prometheus.nix
];
networking.hostName = "eidola"; # Define your hostname.

View File

@ -0,0 +1,11 @@
{...}: let
ipInternal = "10.13.1.1"; # TODO: hardcoding
in {
services.prometheus.exporters = {
node = {
enable = true;
listenAddress = ipInternal;
enabledCollectors = ["systemd"];
};
};
}

View File

@ -13,11 +13,13 @@
};
in {
imports = [
./services
./hardware.nix
./disk-config.nix
./mounts.nix
./secrets.nix
./services
./prometheus.nix
];
networking.hostName = "silver"; # Define your hostname.

View File

@ -14,6 +14,9 @@
"/var/lib/acme"
"/var/lib/prometheus2"
"/var/lib/grafana"
"/srv"
];
files = [

View File

@ -0,0 +1,11 @@
{...}: let
ipInternal = "10.13.0.1"; # TODO: hardcoding
in {
services.prometheus.exporters = {
node = {
enable = true;
listenAddress = ipInternal;
enabledCollectors = ["systemd"];
};
};
}

View File

@ -7,16 +7,14 @@ in {
group = "breeze";
};
services.nginx = {
virtualHosts.${dom} = {
forceSSL = true;
enableACME = true;
services.nginx.virtualHosts.${dom} = {
forceSSL = true;
enableACME = true;
quic = true;
quic = true;
locations."/" = {
proxyPass = "http://127.0.0.1:${toString httpIntPort}";
};
locations."/" = {
proxyPass = "http://127.0.0.1:${toString httpIntPort}";
};
};

View File

@ -6,6 +6,8 @@
./gitea.nix
./synapse.nix
./nebula.nix
./prometheus.nix
./grafana.nix
];
security.acme = {

View File

@ -0,0 +1,29 @@
{...}: let
dom = "graf.min.rip";
httpIntPort = 14050;
in {
services.nginx.virtualHosts.${dom} = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://127.0.0.1:${toString httpIntPort}";
};
};
services.grafana = {
enable = true;
settings = {
server = {
http_addr = "127.0.0.1";
http_port = httpIntPort;
enable_gzip = true;
enforce_domain = true;
domain = dom;
};
};
};
}

View File

@ -0,0 +1,27 @@
{...}: let
ipSilver = "10.13.0.1"; # TODO: hardcoding
ipEidola = "10.13.1.1"; # TODO: hardcoding
in {
services.prometheus = {
enable = true;
scrapeConfigs = [
{
job_name = "silver";
static_configs = [
{
targets = ["${ipSilver}:9100"];
}
];
}
{
job_name = "eidola";
static_configs = [
{
targets = ["${ipEidola}:9100"];
}
];
}
];
};
}