nagios-herald 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 335b4477670958112568a92c559b299ee3c992bf
4
- data.tar.gz: dd284b572df136d6afd4b18ec80312923a3b5b8f
5
- SHA512:
6
- metadata.gz: 711870cc088ec314c383a2a97f16a43a2af7c00284b3858f23dad0e00d8727ba284634f505c674f86cb4c09b602343c7f464c9e85b626a969c3880ab59216e3a
7
- data.tar.gz: 4b2981598b689cf8390c62aae5bb863f6c916cdf90cf884a693835e33a585202f11043dc6781324475e55b8f6869315c89e7776dfd731a935b055570b295361f
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MjBhMDg0MjY5NWYxMTk4NjMxOThjNjA5MzVkZWNmOTA4NGM2Y2FlYQ==
5
+ data.tar.gz: !binary |-
6
+ ZDU0MTJhZWNjZWU1Mjc2ODIyMjgwOGEyMjIwNDdiNzU0MmFmZDU5ZQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ OTRiNDA4MGRjMGYxZjk4NzBhZTJhZjcwZjRkZTQ2ZjAwMjNjMjA4ZTlhYjll
10
+ MzZkY2ViODZjMDgwMGY4Nzg3YmQ2ZmNjNzMyNjE5MTlhNjRiNmM3NGFlNWIz
11
+ NmNjYTZlZTI5ODJmZWZmOTY2NjU2NTQwNjkzOTY0MDYzOWZiMmE=
12
+ data.tar.gz: !binary |-
13
+ ZGViMzUwY2NiZTMyMDMxNmJmMWU3MTdjNmVmNGJlZjI0ODUxYjFlN2JkNTQ1
14
+ ZDFkMzRkZjY0ZjEyY2EwMjUwOWI2ZjMzNGRlNGQ1MjMyNjA4M2YyNjRlMzQ4
15
+ ZjUwNTRkZDJhOWE0ODhkMDBlMzJlOTI0OTVkYjk1NWM3Y2IxOGY=
data/.travis.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 1.9.3
3
4
  - 1.9.2
4
5
  sudo: false
5
6
  cache: bundler
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## 0.0.3 (10th Oct, 2014)
2
+
3
+ Features:
4
+
5
+ - check_graphite_graph formatter allows nagios-herald to embed Graphite graphs
6
+
7
+ Bug fixes:
8
+
9
+ - Corrected a regression in the check_disk formatter so that it generates a correct stack bar
10
+
11
+ Thanks:
12
+
13
+ - Shout out to @kdaniels for the new formatter and @v for fixing up the check_disk formatter!
14
+
1
15
  ## 0.0.2 (23rd June, 2014)
2
16
 
3
17
  Features:
@@ -8,4 +22,4 @@ Features:
8
22
 
9
23
  Features:
10
24
 
11
- - Initial Release
25
+ - Initial Release
@@ -41,9 +41,9 @@ module NagiosHerald
41
41
  # Returns the filename of the generated image or nil if the image was not generated.
42
42
  def get_partitions_stackedbars_chart(partitions_data)
43
43
  # Sort results by the most full partition
44
- partitions_data.sort! { |a,b| a[:free_percent] <=> b[:free_percent] }
44
+ partitions_data.sort! { |a,b| a['free_percent'] <=> b['free_percent'] }
45
45
  # generate argument as string
46
- volumes_space_str = partitions_data.map {|x| "#{x[:partition]}=#{100 - x[:free_percent].to_i}"}.compact
46
+ volumes_space_str = partitions_data.map {|x| "#{x['partition']}=#{100 - x['free_percent'].to_i}"}.compact
47
47
  output_file = File.join(@sandbox, "host_status.png")
48
48
  command = ""
49
49
  command += NagiosHerald::Util::get_script_path('draw_stack_bars')
@@ -0,0 +1,62 @@
1
+ # CheckGraphiteGraph formatter
2
+ # Downloads the Graphite graph used to trigger the alert.
3
+ # Also downloads an historical graph of the last 24 hours for comparison.
4
+
5
+ module NagiosHerald
6
+ class Formatter
7
+ class CheckGraphiteGraph < NagiosHerald::Formatter
8
+ include NagiosHerald::Logging
9
+
10
+ # Public: Retrieves Graphite graphs for the endpoint the check queried.
11
+ # url - The URL for the Graphite endpoint the check queried.
12
+ # Returns the file names of all retrieved graphs. These can be attached to the message.
13
+ def get_graphite_graphs(url)
14
+ begin
15
+ graphite = NagiosHerald::Helpers::GraphiteGraph.new
16
+ show_historical = true
17
+ graphs = graphite.get_graph(url, @sandbox, show_historical)
18
+ return graphs
19
+ rescue Exception => e
20
+ logger.error "Exception encountered retrieving Graphite graphs - #{e.message}"
21
+ e.backtrace.each do |line|
22
+ logger.error "#{line}"
23
+ end
24
+ return []
25
+ end
26
+ end
27
+
28
+ # Public: Overrides Formatter::Base#additional_info.
29
+ # Returns nothing. Updates the formatter content hash.
30
+ def additional_info
31
+ section = __method__
32
+ output = get_nagios_var("NAGIOS_#{@state_type}OUTPUT")
33
+ # Output is formmated like: Current value: 18094.25, warn threshold: 100.0, crit threshold: 1000.0
34
+ add_text(section, "Additional Info:\n #{unescape_text(output)}\n\n") if output
35
+ output_match = output.match(/Current value: (?<current_value>[^,]*), warn threshold: (?<warn_threshold>[^,]*), crit threshold: (?<crit_threshold>[^,]*)/)
36
+ if output_match
37
+ add_html(section, "Current value: <b><font color='red'>#{output_match['current_value']}</font></b>, warn threshold: <b>#{output_match['warn_threshold']}</b>, crit threshold: <b><font color='red'>#{output_match['crit_threshold']}</font></b><br><br>")
38
+ else
39
+ add_html(section, "<b>Additional Info</b>:<br> #{output}<br><br>") if output
40
+ end
41
+
42
+ # Get Graphite graphs.
43
+ # Extract the Graphite URL from NAGIOS_SERVICECHECKCOMMAND
44
+ service_check_command = get_nagios_var("NAGIOS_SERVICECHECKCOMMAND")
45
+ url = service_check_command.split(/!/)[-1].gsub(/'/, '')
46
+ graphite_graphs = get_graphite_graphs(url)
47
+ from_match = url.match(/from=(?<from>[^&]*)/)
48
+ if from_match
49
+ add_html(section, "<b>View from '#{from_match['from']}' ago</b><br>")
50
+ else
51
+ add_html(section, "<b>View from the time of the Nagios check</b><br>")
52
+ end
53
+ add_attachment graphite_graphs[0] # The original graph.
54
+ add_html(section, %Q(<img src="#{graphite_graphs[0]}" alt="graphite_graph" /><br><br>))
55
+ add_html(section, '<b>24-hour View</b><br>')
56
+ add_attachment graphite_graphs[1] # The 24-hour graph.
57
+ add_html(section, %Q(<img src="#{graphite_graphs[1]}" alt="graphite_graph" /><br><br>))
58
+ end
59
+
60
+ end
61
+ end
62
+ end
@@ -1,3 +1,3 @@
1
1
  module NagiosHerald
2
- VERSION = "0.0.2"
3
- end
2
+ VERSION = "0.0.3"
3
+ end
metadata CHANGED
@@ -1,87 +1,115 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: nagios-herald
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Ryan Frantz
8
8
  - Nassim Kammah
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2014-09-26 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2014-10-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: app_conf
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- requirements:
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
20
18
  - - ~>
21
- - !ruby/object:Gem::Version
22
- version: "0.4"
23
- - - ">="
24
- - !ruby/object:Gem::Version
19
+ - !ruby/object:Gem::Version
20
+ version: '0.4'
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
25
23
  version: 0.4.2
26
24
  type: :runtime
27
- version_requirements: *id001
28
- - !ruby/object:Gem::Dependency
29
- name: choice
30
25
  prerelease: false
31
- requirement: &id002 !ruby/object:Gem::Requirement
32
- requirements:
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: '0.4'
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.4.2
34
+ - !ruby/object:Gem::Dependency
35
+ name: choice
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
33
38
  - - ~>
34
- - !ruby/object:Gem::Version
35
- version: "0.1"
36
- - - ">="
37
- - !ruby/object:Gem::Version
39
+ - !ruby/object:Gem::Version
40
+ version: '0.1'
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
38
43
  version: 0.1.6
39
44
  type: :runtime
40
- version_requirements: *id002
41
- - !ruby/object:Gem::Dependency
42
- name: mail
43
45
  prerelease: false
44
- requirement: &id003 !ruby/object:Gem::Requirement
45
- requirements:
46
+ version_requirements: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ~>
49
+ - !ruby/object:Gem::Version
50
+ version: '0.1'
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 0.1.6
54
+ - !ruby/object:Gem::Dependency
55
+ name: mail
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
46
58
  - - ~>
47
- - !ruby/object:Gem::Version
48
- version: "2.5"
49
- - - ">="
50
- - !ruby/object:Gem::Version
59
+ - !ruby/object:Gem::Version
60
+ version: '2.5'
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
51
63
  version: 2.5.4
52
64
  type: :runtime
53
- version_requirements: *id003
54
- - !ruby/object:Gem::Dependency
55
- name: chef
56
65
  prerelease: false
57
- requirement: &id004 !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ~>
69
+ - !ruby/object:Gem::Version
70
+ version: '2.5'
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: 2.5.4
74
+ - !ruby/object:Gem::Dependency
75
+ name: chef
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
61
80
  version: 11.8.2
62
81
  type: :runtime
63
- version_requirements: *id004
64
- - !ruby/object:Gem::Dependency
65
- name: elasticsearch
66
82
  prerelease: false
67
- requirement: &id005 !ruby/object:Gem::Requirement
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
83
+ version_requirements: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: 11.8.2
88
+ - !ruby/object:Gem::Dependency
89
+ name: elasticsearch
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
71
94
  version: 1.0.2
72
95
  type: :runtime
73
- version_requirements: *id005
74
- description: " A project that aims to make it easy to provide context in Nagios alerts.\n The project consists of a core notifier script that can be called with a formatter\n to tailor the content of the message sent to an operator.\n"
75
- email:
96
+ prerelease: false
97
+ version_requirements: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: 1.0.2
102
+ description: ! " A project that aims to make it easy to provide context in Nagios
103
+ alerts.\n The project consists of a core notifier script that can be called with
104
+ a formatter\n to tailor the content of the message sent to an operator.\n"
105
+ email:
76
106
  - rfrantz@etsy.com
77
107
  - nkammah@etsy.com
78
- executables:
108
+ executables:
79
109
  - nagios-herald
80
110
  extensions: []
81
-
82
111
  extra_rdoc_files: []
83
-
84
- files:
112
+ files:
85
113
  - .gitignore
86
114
  - .travis.yml
87
115
  - CHANGELOG.md
@@ -128,6 +156,7 @@ files:
128
156
  - lib/nagios-herald/formatters/base.rb
129
157
  - lib/nagios-herald/formatters/check_cpu.rb
130
158
  - lib/nagios-herald/formatters/check_disk.rb
159
+ - lib/nagios-herald/formatters/check_graphite_graph.rb
131
160
  - lib/nagios-herald/formatters/check_logstash.rb
132
161
  - lib/nagios-herald/formatters/check_memory.rb
133
162
  - lib/nagios-herald/formatters/example.rb
@@ -173,32 +202,28 @@ files:
173
202
  - test/unit/test_message_email.rb
174
203
  - test/unit/test_message_pager.rb
175
204
  homepage: https://github.com/etsy/nagios-herald
176
- licenses:
205
+ licenses:
177
206
  - MIT
178
207
  metadata: {}
179
-
180
208
  post_install_message: Have fun and write your own formatters!
181
209
  rdoc_options: []
182
-
183
- require_paths:
210
+ require_paths:
184
211
  - lib
185
- required_ruby_version: !ruby/object:Gem::Requirement
186
- requirements:
187
- - - ">="
188
- - !ruby/object:Gem::Version
212
+ required_ruby_version: !ruby/object:Gem::Requirement
213
+ requirements:
214
+ - - ! '>='
215
+ - !ruby/object:Gem::Version
189
216
  version: 1.9.2
190
- required_rubygems_version: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - ">="
193
- - !ruby/object:Gem::Version
194
- version: "0"
217
+ required_rubygems_version: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - ! '>='
220
+ - !ruby/object:Gem::Version
221
+ version: '0'
195
222
  requirements: []
196
-
197
223
  rubyforge_project:
198
224
  rubygems_version: 2.2.2
199
225
  signing_key:
200
226
  specification_version: 4
201
227
  summary: A project that aims to make it easy to provide context in Nagios alerts.
202
228
  test_files: []
203
-
204
229
  has_rdoc: