1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 13:10:33 +00:00

nixos/tests/prometheus-exporters: add mail exporter

This commit is contained in:
WilliButz 2019-07-30 00:43:34 +02:00
parent 5818c73d95
commit deedad80c7
No known key found for this signature in database
GPG key ID: 92582A10F1179CB2

View file

@ -188,6 +188,48 @@ let
'';
};
mail = {
exporterConfig = {
enable = true;
user = "mailexporter";
configuration = {
monitoringInterval = "2s";
mailCheckTimeout = "10s";
servers = [ {
name = "testserver";
server = "localhost";
port = 25;
from = "mailexporter@localhost";
to = "mailexporter@localhost";
detectionDir = "/var/spool/mail/mailexporter/new";
} ];
};
};
metricProvider = {
services.postfix.enable = true;
systemd.services.prometheus-mail-exporter = {
after = [ "postfix.service" ];
requires = [ "postfix.service" ];
preStart = ''
mkdir -p 0600 mailexporter/new
'';
serviceConfig = {
ProtectHome = true;
ReadOnlyPaths = "/";
ReadWritePaths = "/var/spool/mail";
WorkingDirectory = "/var/spool/mail";
};
};
users.users.mailexporter.isSystemUser = true;
};
exporterTest = ''
waitForUnit("postfix.service")
waitForUnit("prometheus-mail-exporter.service")
waitForOpenPort(9225)
waitUntilSucceeds("curl -sSf http://localhost:9225/metrics | grep -q 'mail_deliver_success{configname=\"testserver\"} 1'")
'';
};
nginx = {
exporterConfig = {
enable = true;