aboutsummaryrefslogtreecommitdiff
path: root/modules/private/monitoring
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2020-01-17 17:57:49 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2020-01-17 17:57:49 +0100
commitef0a9217fba817d7fb71ccd4cca65919dd89ebec (patch)
tree6b8cca88c68315a41362c577a7c545267365bccd /modules/private/monitoring
parente6052491c138a418313d634ccd038d81337c6a24 (diff)
downloadNix-ef0a9217fba817d7fb71ccd4cca65919dd89ebec.tar.gz
Nix-ef0a9217fba817d7fb71ccd4cca65919dd89ebec.tar.zst
Nix-ef0a9217fba817d7fb71ccd4cca65919dd89ebec.zip
Add e-mail relay monitoring for backup-2 and monitoring-1
Diffstat (limited to 'modules/private/monitoring')
-rw-r--r--modules/private/monitoring/objects_backup-2.nix5
-rw-r--r--modules/private/monitoring/objects_monitoring-1.nix4
-rwxr-xr-xmodules/private/monitoring/plugins/check_emails2
3 files changed, 8 insertions, 3 deletions
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 @@
1{ config, pkgs, lib, hostFQDN, ... }: 1{ config, pkgs, lib, hostFQDN, emailCheck, ... }:
2let 2let
3 defaultPassiveInfo = { 3 defaultPassiveInfo = {
4 filter = lib.attrsets.filterAttrs 4 filter = lib.attrsets.filterAttrs
@@ -12,6 +12,9 @@ let
12in 12in
13{ 13{
14 service = [ 14 service = [
15 (emailCheck "backup-2" hostFQDN // {
16 passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-email"; freshness_threshold = "1350"; };
17 })
15 { 18 {
16 passiveInfo = defaultPassiveInfo; 19 passiveInfo = defaultPassiveInfo;
17 service_description = "Size on /backup2 partition"; 20 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 @@
1{ config, pkgs, ... }: 1{ config, pkgs, hostFQDN, emailCheck, ... }:
2{ 2{
3 host = { 3 host = {
4 # Dummy host for testing 4 # Dummy host for testing
@@ -22,6 +22,8 @@
22 # check_command = "check_critical"; 22 # check_command = "check_critical";
23 # } 23 # }
24 24
25 (emailCheck "monitoring-1" hostFQDN)
26
25 { 27 {
26 service_description = "ftp has access to database for authentication"; 28 service_description = "ftp has access to database for authentication";
27 host_name = "eldiron.immae.eu"; 29 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'});
37 37
38my $cmd_result; 38my $cmd_result;
39if ($local_directory ne '') { 39if ($local_directory ne '') {
40 if (! -d $local_directory) { 40 if (@emails_to_expect and ! -d $local_directory) {
41 print "Emails $host UNKNOWN - Could not find local directory"; 41 print "Emails $host UNKNOWN - Could not find local directory";
42 exit($STATE_UNKNOWN); 42 exit($STATE_UNKNOWN);
43 } 43 }