feat: add prometheus module and enable grafana and prometheus on chibi
All checks were successful
ci / treefmt (push) Successful in 2m19s

This commit is contained in:
Ceferino Patino 2026-06-06 14:41:40 -05:00
commit 2c9fb740ad
Signed by: c4patino
SSH key fingerprint: SHA256:Wu+cU1t+7zVT9wzew/4meNmeulo66NzMqc22MdDBgXI
2 changed files with 35 additions and 4 deletions

View file

@ -49,6 +49,14 @@ in {
port = 5201;
public = true;
};
grafana = {
port = 5500;
internal = true;
};
prometheus = {
port = 5501;
internal = true;
};
};
tsuki = {
@ -61,10 +69,6 @@ in {
internal = true;
public = true;
};
grafana = {
port = 5500;
internal = true;
};
jellyfin = {
port = 8096;
internal = true;

View file

@ -0,0 +1,27 @@
{
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf;
inherit (lib.${namespace}) getAttrByNamespace hostHasService flattenHostServices getServicePort;
inherit (config.networking) hostName;
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
networkServices = flattenHostServices networkCfg.network-services;
isEnabled = hostHasService networkCfg.network-services hostName "prometheus";
port = getServicePort networkServices "prometheus" 9090;
in {
config = mkIf isEnabled {
services.prometheus = {
enable = true;
port = port;
};
${namespace}.services.storage.impermanence.folders = [
"/var/lib/prometheus2"
];
};
}