sensu-plugins-mailhandler 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 386af8452fc2944c0848c2eb96a737015e816af7
4
- data.tar.gz: e3f035ad6e7fec1387be41dcd1683d93d5fe8242
3
+ metadata.gz: 850a82c9767464d7c05ea5dbf4b3bf3985867af9
4
+ data.tar.gz: c8366be9915146b479004c88f11de8105e021c1b
5
5
  SHA512:
6
- metadata.gz: edb2485905430e4b1a26af7443cfc10987168552051b23c08db95925953c8c760fcd98939d5d325f3cb45e8624103bf9e93d83a307be0775f6f78af4460efbdd
7
- data.tar.gz: 05645dd22a71b4a8f619a96a6d53c8c343cb971f7d4f475423b8a8a6a72498daa8c08c6b9716127183f1bd42027a75640406a6d01bcedf8a368427cb12bef617
6
+ metadata.gz: 1ecb5b68a3a41852f1ed68d70abef803d495de0cc828541ced6e2e3baca3d1688891a5bd76bed9b3116c3a3f574bba6d8d31fffd39b296b13d2f7ef81abba649
7
+ data.tar.gz: 85607ea1e60df5e56e1c1d63069217dacf2e5e139657db789910175563270cc2fb05df679858d538c49546c699dfe302b0cc5586cb4d13c4dc67702370752fbd
data/.gitignore CHANGED
@@ -1 +1 @@
1
- *.gem$
1
+ *.gem
data/bin/mailhandler.rb CHANGED
@@ -44,8 +44,6 @@ require 'json'
44
44
  require 'mail'
45
45
  require 'erubis'
46
46
 
47
- $fqdn = %x(hostname -f)
48
-
49
47
  class Mailhandler < Sensu::Handler
50
48
 
51
49
  option :body_template,
@@ -88,12 +86,18 @@ class Mailhandler < Sensu::Handler
88
86
  # Set sane defaults
89
87
  default = Hash.new
90
88
 
91
- default['from'] = 'root@' + $fqdn,
89
+ default['from'] = 'root@' + @fqdn,
92
90
  default['to'] = 'lars.bahner@gmail.com',
93
91
  default['smtp_host'] = 'localhost',
94
92
  default['smtp_port'] = '25'
95
93
  default['subject'] = 'Sensu@' + @event['client']['name'] + ': ' + status_text
96
94
 
95
+ def initialize
96
+
97
+ @fqdn = %x(hostname -f)
98
+
99
+ end
100
+
97
101
  def status_text
98
102
  case @event['check']['status']
99
103
  when 0
@@ -2,7 +2,7 @@ module SensuPluginsMailhandler
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 3
5
+ PATCH = 4
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'sensu-plugins-mailhandler'
3
- s.version = '0.0.3'
3
+ s.version = '0.0.4'
4
4
  s.date = '2016-07-20'
5
5
  s.summary = 'Handler to easily send email'
6
6
  s.description = 'Handler to pretty print an event and send it as email.'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-mailhandler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lars Bahner