add grafana

This commit is contained in:
stupidcomputer 2024-10-28 00:10:19 -05:00
parent 5aceed436c
commit af0395badd
5 changed files with 76 additions and 0 deletions

View File

@ -4,5 +4,6 @@
imports = [ imports = [
./photoprism.nix ./photoprism.nix
./wireguard.nix ./wireguard.nix
./grafana.nix
]; ];
} }

View File

@ -0,0 +1,44 @@
{ lib, config, pkgs, ...}:
{
services.grafana = {
enable = true;
settings = {
server = {
http_addr = "10.100.0.2";
http_port = 9802;
domain = "grafana.beepboop.systems";
};
};
};
services.prometheus = {
enable = true;
listenAddress = "10.100.0.2";
port = 9001;
exporters = {
node = {
enable = true;
enabledCollectors = [ "systemd" ];
listenAddress = "10.100.0.2";
port = 9002;
};
};
scrapeConfigs = [
{
job_name = "copernicus";
static_configs = [{
targets = [ "10.100.0.2:9002" ];
}];
}
{
job_name = "netbox";
static_configs = [{
targets = [ "10.100.0.1:9002" ];
}];
}
];
};
}

View File

@ -18,6 +18,8 @@
./franklincce.nix ./franklincce.nix
./wireguard.nix ./wireguard.nix
./photoprism-bridge.nix ./photoprism-bridge.nix
./grafana-bridge.nix
./prometheus.nix
]; ];
nix = { nix = {

View File

@ -0,0 +1,16 @@
{ lib, config, pkgs, ... }:
{
services.nginx.virtualHosts."grafana.beepboop.systems" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://10.100.0.2:9802";
proxyWebsockets = true;
extraConfig = ''
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_buffering off;
'';
};
};
}

View File

@ -0,0 +1,13 @@
{ lib, config, pkgs, ... }:
{
services.prometheus = {
exporters = {
node = {
enable = true;
enabledCollectors = [ "systemd" ];
listenAddress = "10.100.0.1";
port = 9002;
};
};
};
}