Merge master into staging-next
This commit is contained in:
@@ -214,6 +214,11 @@
|
||||
have a look at the <link xlink:href="https://github.com/nginxinc/nginx-prometheus-exporter">official repo</link>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Nodejs 8 is scheduled EOL under the lifetime of 19.09 and has been dropped.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ with lib;
|
||||
systemd.packages = packages;
|
||||
|
||||
environment.variables = {
|
||||
GTK_USE_PORTAL = optional cfg.gtkUsePortal "1";
|
||||
GTK_USE_PORTAL = mkIf cfg.gtkUsePortal "1";
|
||||
XDG_DESKTOP_PORTAL_PATH = map (p: "${p}/share/xdg-desktop-portal/portals") cfg.extraPortals;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -235,6 +235,7 @@ in
|
||||
systemd.user.services.ssh-agent = mkIf cfg.startAgent
|
||||
{ description = "SSH Agent";
|
||||
wantedBy = [ "default.target" ];
|
||||
unitConfig.ConditionUser = "!@system";
|
||||
serviceConfig =
|
||||
{ ExecStartPre = "${pkgs.coreutils}/bin/rm -f %t/ssh-agent";
|
||||
ExecStart =
|
||||
|
||||
@@ -502,6 +502,7 @@ in {
|
||||
"d ${cfg.statePath} 0750 ${cfg.user} ${cfg.group} -"
|
||||
"d ${cfg.statePath}/builds 0750 ${cfg.user} ${cfg.group} -"
|
||||
"d ${cfg.statePath}/config 0750 ${cfg.user} ${cfg.group} -"
|
||||
"d ${cfg.statePath}/config/initializers 0750 ${cfg.user} ${cfg.group} -"
|
||||
"d ${cfg.statePath}/db 0750 ${cfg.user} ${cfg.group} -"
|
||||
"d ${cfg.statePath}/log 0750 ${cfg.user} ${cfg.group} -"
|
||||
"d ${cfg.statePath}/repositories 2770 ${cfg.user} ${cfg.group} -"
|
||||
|
||||
@@ -28,6 +28,7 @@ let
|
||||
"dovecot"
|
||||
"fritzbox"
|
||||
"json"
|
||||
"mail"
|
||||
"minio"
|
||||
"nginx"
|
||||
"node"
|
||||
@@ -162,13 +163,19 @@ in
|
||||
};
|
||||
|
||||
config = mkMerge ([{
|
||||
assertions = [{
|
||||
assertions = [ {
|
||||
assertion = (cfg.snmp.configurationPath == null) != (cfg.snmp.configuration == null);
|
||||
message = ''
|
||||
Please ensure you have either `services.prometheus.exporters.snmp.configuration'
|
||||
or `services.prometheus.exporters.snmp.configurationPath' set!
|
||||
'';
|
||||
}];
|
||||
} {
|
||||
assertion = (cfg.mail.configFile == null) != (cfg.mail.configuration == {});
|
||||
message = ''
|
||||
Please specify either 'services.prometheus.exporters.mail.configuration'
|
||||
or 'services.prometheus.exporters.mail.configFile'.
|
||||
'';
|
||||
} ];
|
||||
}] ++ [(mkIf config.services.minio.enable {
|
||||
services.prometheus.exporters.minio.minioAddress = mkDefault "http://localhost:9000";
|
||||
services.prometheus.exporters.minio.minioAccessKey = mkDefault config.services.minio.accessKey;
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
{ config, lib, pkgs, options }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.prometheus.exporters.mail;
|
||||
|
||||
configurationFile = pkgs.writeText "prometheus-mail-exporter.conf" (builtins.toJSON (
|
||||
# removes the _module attribute, null values and converts attrNames to lowercase
|
||||
mapAttrs' (name: value:
|
||||
if name == "servers"
|
||||
then nameValuePair (toLower name)
|
||||
((map (srv: (mapAttrs' (n: v: nameValuePair (toLower n) v)
|
||||
(filterAttrs (n: v: !(n == "_module" || v == null)) srv)
|
||||
))) value)
|
||||
else nameValuePair (toLower name) value
|
||||
) (filterAttrs (n: _: !(n == "_module")) cfg.configuration)
|
||||
));
|
||||
|
||||
serverOptions.options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
Value for label 'configname' which will be added to all metrics.
|
||||
'';
|
||||
};
|
||||
server = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
Hostname of the server that should be probed.
|
||||
'';
|
||||
};
|
||||
port = mkOption {
|
||||
type = types.int;
|
||||
example = 587;
|
||||
description = ''
|
||||
Port to use for SMTP.
|
||||
'';
|
||||
};
|
||||
from = mkOption {
|
||||
type = types.str;
|
||||
example = "exporteruser@domain.tld";
|
||||
description = ''
|
||||
Content of 'From' Header for probing mails.
|
||||
'';
|
||||
};
|
||||
to = mkOption {
|
||||
type = types.str;
|
||||
example = "exporteruser@domain.tld";
|
||||
description = ''
|
||||
Content of 'To' Header for probing mails.
|
||||
'';
|
||||
};
|
||||
detectionDir = mkOption {
|
||||
type = types.path;
|
||||
example = "/var/spool/mail/exporteruser/new";
|
||||
description = ''
|
||||
Directory in which new mails for the exporter user are placed.
|
||||
Note that this needs to exist when the exporter starts.
|
||||
'';
|
||||
};
|
||||
login = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "exporteruser@domain.tld";
|
||||
description = ''
|
||||
Username to use for SMTP authentication.
|
||||
'';
|
||||
};
|
||||
passphrase = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Password to use for SMTP authentication.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
exporterOptions.options = {
|
||||
monitoringInterval = mkOption {
|
||||
type = types.str;
|
||||
example = "10s";
|
||||
description = ''
|
||||
Time interval between two probe attempts.
|
||||
'';
|
||||
};
|
||||
mailCheckTimeout = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
Timeout until mails are considered "didn't make it".
|
||||
'';
|
||||
};
|
||||
disableFileDelition = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Disables the exporter's function to delete probing mails.
|
||||
'';
|
||||
};
|
||||
servers = mkOption {
|
||||
type = types.listOf (types.submodule serverOptions);
|
||||
default = [];
|
||||
example = literalExample ''
|
||||
[ {
|
||||
name = "testserver";
|
||||
server = "smtp.domain.tld";
|
||||
port = 587;
|
||||
from = "exporteruser@domain.tld";
|
||||
to = "exporteruser@domain.tld";
|
||||
detectionDir = "/path/to/Maildir/new";
|
||||
} ]
|
||||
'';
|
||||
description = ''
|
||||
List of servers that should be probed.
|
||||
'';
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
port = 9225;
|
||||
extraOpts = {
|
||||
configFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
description = ''
|
||||
Specify the mailexporter configuration file to use.
|
||||
'';
|
||||
};
|
||||
configuration = mkOption {
|
||||
type = types.submodule exporterOptions;
|
||||
default = {};
|
||||
description = ''
|
||||
Specify the mailexporter configuration file to use.
|
||||
'';
|
||||
};
|
||||
telemetryPath = mkOption {
|
||||
type = types.str;
|
||||
default = "/metrics";
|
||||
description = ''
|
||||
Path under which to expose metrics.
|
||||
'';
|
||||
};
|
||||
};
|
||||
serviceOpts = {
|
||||
serviceConfig = {
|
||||
ExecStart = ''
|
||||
${pkgs.prometheus-mail-exporter}/bin/mailexporter \
|
||||
--web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
|
||||
--config.file ${
|
||||
if cfg.configuration != {} then configurationFile else cfg.configFile
|
||||
} \
|
||||
${concatStringsSep " \\\n " cfg.extraFlags}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -48,6 +48,7 @@ in {
|
||||
requires = [ "keybase.service" ];
|
||||
after = [ "keybase.service" ];
|
||||
path = [ "/run/wrappers" ];
|
||||
unitConfig.ConditionUser = "!@system";
|
||||
serviceConfig = {
|
||||
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${cfg.mountPoint}";
|
||||
ExecStart = "${pkgs.kbfs}/bin/kbfsfuse ${toString cfg.extraFlags} ${cfg.mountPoint}";
|
||||
|
||||
@@ -26,6 +26,7 @@ in {
|
||||
|
||||
systemd.user.services.keybase = {
|
||||
description = "Keybase service";
|
||||
unitConfig.ConditionUser = "!@system";
|
||||
serviceConfig = {
|
||||
ExecStart = ''
|
||||
${pkgs.keybase}/bin/keybase service --auto-forked
|
||||
|
||||
@@ -372,16 +372,18 @@ in {
|
||||
|
||||
systemd.packages = [ pkgs.syncthing ];
|
||||
|
||||
users = mkIf (cfg.systemService && cfg.user == defaultUser) {
|
||||
users."${defaultUser}" =
|
||||
users.users = mkIf (cfg.systemService && cfg.user == defaultUser) {
|
||||
"${defaultUser}" =
|
||||
{ group = cfg.group;
|
||||
home = cfg.dataDir;
|
||||
createHome = true;
|
||||
uid = config.ids.uids.syncthing;
|
||||
description = "Syncthing daemon user";
|
||||
};
|
||||
};
|
||||
|
||||
groups."${defaultUser}".gid =
|
||||
users.groups = mkIf (cfg.systemService && cfg.group == defaultUser) {
|
||||
"${defaultUser}".gid =
|
||||
config.ids.gids.syncthing;
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user