nixos/prometheus-postfix-exporter: whitelist addr-family AF_UNIX
Otherwise, `postfix_up{path="/var/lib/postfix/queue/public/showq"}` will always be `0` indicating an postfix outage because this is a unix domain socket that cannot be connected to: 2021/12/03 14:50:46 Failed to scrape showq socket: dial unix /var/lib/postfix/queue/public/showq: socket: address family not supported by protocol
This commit is contained in:
parent
7fff1e9c0c
commit
8e6d403e65
|
@ -76,6 +76,9 @@ in
|
|||
serviceOpts = {
|
||||
serviceConfig = {
|
||||
DynamicUser = false;
|
||||
# By default, each prometheus exporter only gets AF_INET & AF_INET6,
|
||||
# but AF_UNIX is needed to read from the `showq`-socket.
|
||||
RestrictAddressFamilies = [ "AF_UNIX" ];
|
||||
ExecStart = ''
|
||||
${pkgs.prometheus-postfix-exporter}/bin/postfix_exporter \
|
||||
--web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
|
||||
|
|
|
@ -861,6 +861,9 @@ let
|
|||
wait_for_unit("prometheus-postfix-exporter.service")
|
||||
wait_for_file("/var/lib/postfix/queue/public/showq")
|
||||
wait_for_open_port(9154)
|
||||
wait_until_succeeds(
|
||||
"curl -sSf http://localhost:9154/metrics | grep 'postfix_up{path=\"/var/lib/postfix/queue/public/showq\"} 1'"
|
||||
)
|
||||
succeed(
|
||||
"curl -sSf http://localhost:9154/metrics | grep 'postfix_smtpd_connects_total 0'"
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue