sakura: init basic grafana / prometheus

This commit is contained in:
notohh 2023-06-06 00:08:22 -04:00
parent 919d2af886
commit 817927b7e2
Signed by: notohh
GPG key ID: BD47506D475EE86D
4 changed files with 67 additions and 0 deletions

View file

@ -9,5 +9,7 @@
./forgejo.nix ./forgejo.nix
./jellyfin.nix ./jellyfin.nix
./rustypaste.nix ./rustypaste.nix
./grafana.nix
./prometheus.nix
]; ];
} }

View file

@ -0,0 +1,34 @@
{...}: {
services.grafana = {
enable = true;
settings = {
server = {
root_url = "https://metrics.notohh.dev";
domain = "metrics.notohh.dev";
enforce_domain = true;
http_addr = "0.0.0.0";
http_port = 3100;
};
auth = {
disable_login_form = false;
};
users = {
allow_signup = false;
auto_assign_org = true;
auto_assign_org_role = "Viewer";
};
};
provision = {
datasources.settings = {
datasources = [
{
name = "Prometheus";
type = "prometheus";
url = "http://127.0.0.0:9090";
orgId = 1;
}
];
};
};
};
}

View file

@ -0,0 +1,23 @@
{...}: {
services.prometheus = {
enable = true;
scrapeConfigs = [
{
job_name = "prometheus";
scrape_interval = "30s";
static_configs = [{targets = ["127.0.0.0:9090"];}];
}
{
job_name = "node";
scrape_interval = "30s";
static_configs = [{targets = ["127.0.0.0:9100"];}];
}
];
exporters = {
node = {
enable = true;
enabledCollectors = ["systemd" "cpu"];
};
};
};
}

View file

@ -68,6 +68,13 @@
tls.domains = [{main = "*.notohh.dev";}]; tls.domains = [{main = "*.notohh.dev";}];
tls.certresolver = "production"; tls.certresolver = "production";
}; };
grafana = {
rule = "Host(`metrics.notohh.dev`)";
entrypoints = ["websecure"];
service = "grafana";
tls.domains = [{main = "*.notohh.dev";}];
tls.certresolver = "production";
};
}; };
services = { services = {
homepage.loadBalancer.servers = [{url = "http://localhost:3005";}]; homepage.loadBalancer.servers = [{url = "http://localhost:3005";}];
@ -78,6 +85,7 @@
foundryvtt.loadBalancer.servers = [{url = "http://localhost:30000";}]; foundryvtt.loadBalancer.servers = [{url = "http://localhost:30000";}];
gitea.loadBalancer.servers = [{url = "http://localhost:3000";}]; gitea.loadBalancer.servers = [{url = "http://localhost:3000";}];
rustypaste.loadBalancer.servers = [{url = "http://localhost:8000";}]; rustypaste.loadBalancer.servers = [{url = "http://localhost:8000";}];
grafana.loadBalancer.servers = [{url = "http://localhost:3100";}];
}; };
}; };
}; };