nixos/tests/prometheus-exporters: add nextcloud exporter

This commit is contained in:
WilliButz 2019-10-12 22:35:30 +02:00
parent d953d328ca
commit 91b2c844df
No known key found for this signature in database
GPG Key ID: 92582A10F1179CB2

View File

@ -229,6 +229,40 @@ let
''; '';
}; };
nextcloud = {
exporterConfig = {
enable = true;
passwordFile = "/var/nextcloud-pwfile";
url = "http://localhost/negative-space.xml";
};
metricProvider = {
systemd.services.nc-pwfile = let
passfile = (pkgs.writeText "pwfile" "snakeoilpw");
in {
requiredBy = [ "prometheus-nextcloud-exporter.service" ];
before = [ "prometheus-nextcloud-exporter.service" ];
serviceConfig.ExecStart = ''
${pkgs.coreutils}/bin/install -o nextcloud-exporter -m 0400 ${passfile} /var/nextcloud-pwfile
'';
};
services.nginx = {
enable = true;
virtualHosts."localhost" = {
basicAuth.nextcloud-exporter = "snakeoilpw";
locations."/" = {
root = "${pkgs.prometheus-nextcloud-exporter.src}/serverinfo/testdata";
};
};
};
};
exporterTest = ''
waitForUnit("nginx.service")
waitForUnit("prometheus-nextcloud-exporter.service")
waitForOpenPort(9205)
succeed("curl -sSf http://localhost:9205/metrics | grep -q 'nextcloud_up 1'")
'';
};
nginx = { nginx = {
exporterConfig = { exporterConfig = {
enable = true; enable = true;