feat(octoprint): metrics

This commit is contained in:
arcnmx 2024-07-13 14:08:37 -07:00
parent 1ead7f237e
commit 2c9219ba87
8 changed files with 91 additions and 18 deletions

View file

@ -22,7 +22,9 @@
portName,
}: let
port = service.ports.${portName};
in "${mkAddress6 (access.getAddressFor system.name "lan")}:${toString port.port}";
# TODO: this properly
getAddressFor = if port.status.gatus.client.network or "ip" == "ip4" then "getAddress4For" else "getAddressFor";
in "${mkAddress6 (access.${getAddressFor} system.name "lan")}:${toString port.port}";
mkServiceConfig = system: serviceName: let
inherit (service.prometheus) exporter;
service = system.exports.services.${serviceName};

View file

@ -9,6 +9,7 @@ in {
config.exports.services.octoprint = {config, ...}: {
displayName = mkAlmostOptionDefault "OctoPrint";
id = mkAlmostOptionDefault "print";
prometheus.exporter.metricsPath = "/plugin/prometheus_exporter/metrics";
nixos = {
serviceAttr = "octoprint";
assertions = let
@ -33,6 +34,7 @@ in {
enable = mkAlmostOptionDefault true;
gatus.client.network = mkAlmostOptionDefault "ip4";
};
prometheus.exporter.enable = mkAlmostOptionDefault true;
};
};
};