port = mkOption { type = nullOr str; default = null; description = "Port to connect to ssh"; };
login = mkOption { type = nullOr str; default = null; description = "Login to connect to ssh"; };
targets = mkOption { type = listOf str; description = "Hosts to send E-mails to"; };
- mail_address = mkOption { type = str; description = "E-mail recipient part to send e-mail to"; };
- mail_domain = mkOption { type = str; description = "E-mail domain part to send e-mail to"; };
+ mail_address = mkOption { type = nullOr str; default = null; description = "E-mail recipient part to send e-mail to"; };
+ mail_domain = mkOption { type = nullOr str; default = null; description = "E-mail domain part to send e-mail to"; };
};
});
};
);
};
sasl_access = {
- host_sender_login = pkgs.writeText "host-sender-login"
- (builtins.concatStringsSep "\n" (lib.flatten (lib.attrsets.mapAttrsToList
- (n: v: (map (e: "${e} ${n}@immae.eu") v.emails)) config.myEnv.servers)));
+ host_sender_login = with lib.attrsets; let
+ addresses = zipAttrs (lib.flatten (mapAttrsToList
+ (n: v: (map (e: { "${e}" = "${n}@immae.eu"; }) v.emails)) config.myEnv.servers));
+ joined = builtins.concatStringsSep ",";
+ in pkgs.writeText "host-sender-login"
+ (builtins.concatStringsSep "\n" (mapAttrsToList (n: v: "${n} ${joined v}") addresses));
host_dummy_mailboxes = pkgs.writeText "host-virtual-mailbox"
(builtins.concatStringsSep "\n" (lib.attrsets.mapAttrsToList (n: v: "${n}@immae.eu dummy") nodes));
};
-{ config, pkgs, lib, hostFQDN, ... }:
+{ config, pkgs, lib, hostFQDN, emailCheck, ... }:
let
defaultPassiveInfo = {
filter = lib.attrsets.filterAttrs
in
{
service = [
+ (emailCheck "backup-2" hostFQDN // {
+ passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-email"; freshness_threshold = "1350"; };
+ })
{
passiveInfo = defaultPassiveInfo;
service_description = "Size on /backup2 partition";
-{ config, pkgs, ... }:
+{ config, pkgs, hostFQDN, emailCheck, ... }:
{
host = {
# Dummy host for testing
# check_command = "check_critical";
# }
+ (emailCheck "monitoring-1" hostFQDN)
+
{
service_description = "ftp has access to database for authentication";
host_name = "eldiron.immae.eu";
my $cmd_result;
if ($local_directory ne '') {
- if (! -d $local_directory) {
+ if (@emails_to_expect and ! -d $local_directory) {
print "Emails $host UNKNOWN - Could not find local directory";
exit($STATE_UNKNOWN);
}