40 lines
906 B
Nix
40 lines
906 B
Nix
|
{
|
||
|
config,
|
||
|
lib,
|
||
|
pkgs,
|
||
|
...
|
||
|
}:
|
||
|
let
|
||
|
cfg = config.bagel.monitoring.exporters.hydra;
|
||
|
|
||
|
python = pkgs.python3.withPackages(ps: [
|
||
|
ps.aioprometheus
|
||
|
ps.click
|
||
|
ps.httpx
|
||
|
ps.starlette
|
||
|
ps.uvicorn
|
||
|
]);
|
||
|
|
||
|
inherit (lib) escapeShellArg getExe mkEnableOption mkIf mkOption types;
|
||
|
in
|
||
|
{
|
||
|
options.bagel.monitoring.exporters.hydra = {
|
||
|
enable = mkEnableOption "bagel flavored Hydra exporter";
|
||
|
hydraUrl = mkOption {
|
||
|
type = types.str;
|
||
|
default = "https://hydra.forkos.org/";
|
||
|
description = "URL to the Hydra to monitor";
|
||
|
};
|
||
|
};
|
||
|
|
||
|
config = mkIf cfg.enable {
|
||
|
systemd.services.hydra-exporter = {
|
||
|
wantedBy = [ "multi-user.target" ];
|
||
|
description = "Hydra exporter";
|
||
|
script = "${getExe python} ${./hydra-exporter.py} --hydra-url=${escapeShellArg cfg.hydraUrl} --port=9105";
|
||
|
};
|
||
|
|
||
|
bagel.monitoring.grafana-agent.exporters.hydra.port = 9105;
|
||
|
};
|
||
|
}
|