nixos/tests/prometheus-exporters: add nextcloud exporter
This commit is contained in:
parent
d953d328ca
commit
91b2c844df
@ -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 = {
|
||||
exporterConfig = {
|
||||
enable = true;
|
||||
|
Loading…
Reference in New Issue
Block a user