nixos/tests/prometheus-exporters: add exportarr-sonarr test (#285119)

This commit is contained in:
Sandro 2024-11-06 00:13:17 +01:00 committed by GitHub
commit 5634c21398
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -356,6 +356,46 @@ let
''; '';
}; };
exportarr-sonarr = let apikey = "eccff6a992bc2e4b88e46d064b26bb4e"; in {
nodeName = "exportarr_sonarr";
exporterConfig = {
enable = true;
url = "http://127.0.0.1:8989";
apiKeyFile = pkgs.writeText "dummy-api-key" apikey;
};
metricProvider = {
services.sonarr.enable = true;
systemd.services.sonarr.serviceConfig.ExecStartPre =
let
sonarr_config = pkgs.writeText "config.xml" ''
<Config>
<LogLevel>info</LogLevel>
<EnableSsl>False</EnableSsl>
<Port>8989</Port>
<SslPort>9898</SslPort>
<UrlBase></UrlBase>
<BindAddress>*</BindAddress>
<ApiKey>${apikey}</ApiKey>
<AuthenticationMethod>None</AuthenticationMethod>
<UpdateMechanism>BuiltIn</UpdateMechanism>
<Branch>main</Branch>
<InstanceName>Sonarr</InstanceName>
</Config>
'';
in
[
''${pkgs.coreutils}/bin/install -D -m 777 ${sonarr_config} -T /var/lib/sonarr/.config/NzbDrone/config.xml''
];
};
exporterTest = ''
wait_for_unit("sonarr.service")
wait_for_open_port(8989)
wait_for_unit("prometheus-exportarr-sonarr-exporter.service")
wait_for_open_port(9708)
succeed("curl -sSf http://localhost:9708/metrics | grep sonarr_series_total")
'';
};
fastly = { fastly = {
exporterConfig = { exporterConfig = {
enable = true; enable = true;