X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fprivate%2Fmonitoring%2Fplugins%2Fcheck_emails;h=534e5a5096bf3943c766ba4c92ac15e529510923;hb=a97118c489a59d723538292214efaa10dfcb96df;hp=5a8453e70f7aa82b182e54c4c77a2724728ca15d;hpb=b1b8a5623d22a7ee4301afe4e7b9d368ef7ded8f;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/modules/private/monitoring/plugins/check_emails b/modules/private/monitoring/plugins/check_emails index 5a8453e..534e5a5 100755 --- a/modules/private/monitoring/plugins/check_emails +++ b/modules/private/monitoring/plugins/check_emails @@ -61,6 +61,7 @@ foreach my $line (@lines) { } my $output = ""; +my $old = 0; foreach my $email_from (@emails_to_expect) { my @email_split = split(/:/, $email_from); my $email = $email_split[0]; @@ -73,16 +74,17 @@ foreach my $email_from (@emails_to_expect) { if ($current_date - $email_date > 60*30) { $output = "$output$email ($found_emails{$email} from $from) "; } + $old = ($current_date - $email_date) > $old ? ($current_date - $email_date) : $old; } else { $output = "$output$email (missing) " } } if ($output ne '') { - print "Emails $host CRITICAL - expecting emails: $output\n"; + print "Emails $host CRITICAL - expecting emails: $output | timestamp=${old}s;;;;\n"; exit($STATE_CRITICAL); } else { - print "Emails $host OK\n"; + print "Emails $host OK | timestamp=${old}s;;;;\n"; exit($STATE_OK); }