From 6483c516e3658a4e4aa0bbe9734d77e0229fc87b Mon Sep 17 00:00:00 2001 From: Axel <1597611+axeloz@users.noreply.github.com> Date: Mon, 20 Dec 2021 10:16:20 +0100 Subject: [PATCH] Email subjects --- monitolite.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/monitolite.pl b/monitolite.pl index 86f25e7..8c79650 100644 --- a/monitolite.pl +++ b/monitolite.pl @@ -291,12 +291,12 @@ sub send_notifications { my ($task_id, $host, $type, $message, $status) = @_; if ($status == 0) { - $subject = 'ALERT: host "' . $host . '" [' . $type . '] is down'; - $datas = "------ ALERT DETECTED BY MONITORING SERVICE ------ \n\n\nDATETIME: " . server_time() . "(server time)\nHOST: " . $host . "\nSERVICE: " . $type . "\nMESSAGE: " . $message; + $subject = 'DOWN: host "' . $host . '" [' . $type . '] is down'; + $datas = "------ ALERT DETECTED BY MONITORING SERVICE ------ \n\n\nDATETIME: " . server_time() . " (server time)\nHOST: " . $host . "\nSERVICE: " . $type . "\nMESSAGE: " . $message; } else { - $subject = 'RECOVERY: host "' . $host . '" [' . $type . '] is up'; - $datas = "------ RECOVERY DETECTED BY MONITORING SERVICE ------ \n\n\nDATETIME: " . server_time() . "(server time)\nHOST: " . $host . "\nSERVICE: " . $type . "\nMESSAGE: " . $message; + $subject = 'UP: host "' . $host . '" [' . $type . '] is up'; + $datas = "------ RECOVERY DETECTED BY MONITORING SERVICE ------ \n\n\nDATETIME: " . server_time() . " (server time)\nHOST: " . $host . "\nSERVICE: " . $type . "\nMESSAGE: " . $message; } my $query = $dbh->prepare('SELECT c.email FROM contacts as c JOIN notifications as n ON (n.contact_id = c.id) WHERE c.active = 1 AND n.task_id = '.$task_id);