From ef0a9217fba817d7fb71ccd4cca65919dd89ebec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Fri, 17 Jan 2020 17:57:49 +0100 Subject: Add e-mail relay monitoring for backup-2 and monitoring-1 --- modules/private/monitoring/objects_backup-2.nix | 5 ++++- modules/private/monitoring/objects_monitoring-1.nix | 4 +++- modules/private/monitoring/plugins/check_emails | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'modules/private/monitoring') diff --git a/modules/private/monitoring/objects_backup-2.nix b/modules/private/monitoring/objects_backup-2.nix index 52289dd..927cc25 100644 --- a/modules/private/monitoring/objects_backup-2.nix +++ b/modules/private/monitoring/objects_backup-2.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, hostFQDN, ... }: +{ config, pkgs, lib, hostFQDN, emailCheck, ... }: let defaultPassiveInfo = { filter = lib.attrsets.filterAttrs @@ -12,6 +12,9 @@ let in { service = [ + (emailCheck "backup-2" hostFQDN // { + passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-email"; freshness_threshold = "1350"; }; + }) { passiveInfo = defaultPassiveInfo; service_description = "Size on /backup2 partition"; diff --git a/modules/private/monitoring/objects_monitoring-1.nix b/modules/private/monitoring/objects_monitoring-1.nix index f69d3ff..3200d5c 100644 --- a/modules/private/monitoring/objects_monitoring-1.nix +++ b/modules/private/monitoring/objects_monitoring-1.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, hostFQDN, emailCheck, ... }: { host = { # Dummy host for testing @@ -22,6 +22,8 @@ # check_command = "check_critical"; # } + (emailCheck "monitoring-1" hostFQDN) + { service_description = "ftp has access to database for authentication"; host_name = "eldiron.immae.eu"; diff --git a/modules/private/monitoring/plugins/check_emails b/modules/private/monitoring/plugins/check_emails index 0ee3e4e..5a8453e 100755 --- a/modules/private/monitoring/plugins/check_emails +++ b/modules/private/monitoring/plugins/check_emails @@ -37,7 +37,7 @@ my @emails_to_expect = split(/,/, $opts{'f'}); 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); } -- cgit v1.2.3