From 69b7d5b07bbcb6c144bda8ae16a1694297e50ea1 Mon Sep 17 00:00:00 2001 From: Hiroaki Sano Date: Wed, 23 Apr 2014 13:58:48 +0900 Subject: [PATCH] embed admin gui url into mail body --- handlers/notification/mailer.json | 1 + handlers/notification/mailer.rb | 2 ++ 2 files changed, 3 insertions(+) diff --git a/handlers/notification/mailer.json b/handlers/notification/mailer.json index 8f1dfe0e9..65e67d7d9 100644 --- a/handlers/notification/mailer.json +++ b/handlers/notification/mailer.json @@ -1,5 +1,6 @@ { "mailer": { + "admin_gui": "http://admin.example.com:8080/", "mail_from": "sensu@example.com", "mail_to": "monitor@example.com", "smtp_address": "smtp.example.org", diff --git a/handlers/notification/mailer.rb b/handlers/notification/mailer.rb index 9ef78bed2..c59118696 100755 --- a/handlers/notification/mailer.rb +++ b/handlers/notification/mailer.rb @@ -37,6 +37,7 @@ def action_to_string end def handle + admin_gui = settings['mailer']['admin_gui'] || 'http://localhost:8080/' mail_to = settings['mailer']['mail_to'] mail_from = settings['mailer']['mail_from'] @@ -53,6 +54,7 @@ def handle playbook = "Playbook: #{@event['check']['playbook']}" if @event['check']['playbook'] body = <<-BODY.gsub(/^\s+/, '') #{@event['check']['output']} + Admin GUI: #{admin_gui} Host: #{@event['client']['name']} Timestamp: #{Time.at(@event['check']['issued'])} Address: #{@event['client']['address']}