feat: add prometheus module and enable grafana and prometheus on chibi
All checks were successful
ci / treefmt (push) Successful in 2m19s
All checks were successful
ci / treefmt (push) Successful in 2m19s
This commit is contained in:
parent
1ee9747674
commit
2c9fb740ad
2 changed files with 35 additions and 4 deletions
|
|
@ -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;
|
||||
|
|
|
|||
27
modules/nixos/services/apps/prometheus/default.nix
Normal file
27
modules/nixos/services/apps/prometheus/default.nix
Normal 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"
|
||||
];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue