nagiosharder 0.4.0.rc1 → 0.4.0

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.
data/.gitignore CHANGED
@@ -22,5 +22,3 @@ pkg
22
22
  nagiosharder*.gem
23
23
  .bundle
24
24
  vendor/gems
25
- config
26
- *.yml
@@ -3,8 +3,8 @@ PATH
3
3
  specs:
4
4
  nagiosharder (0.4.0)
5
5
  activesupport
6
- hashie (~> 1.2.0)
7
- httparty (~> 0.8.3)
6
+ hashie (~> 1.0.0)
7
+ httparty (~> 0.6.1)
8
8
  i18n
9
9
  nokogiri
10
10
  rest-client (~> 1.6.1)
@@ -13,19 +13,17 @@ PATH
13
13
  GEM
14
14
  remote: http://rubygems.org/
15
15
  specs:
16
- activesupport (3.2.8)
17
- i18n (~> 0.6)
16
+ activesupport (3.1.3)
18
17
  multi_json (~> 1.0)
18
+ crack (0.1.8)
19
19
  diff-lcs (1.1.3)
20
- hashie (1.2.0)
21
- httparty (0.8.3)
22
- multi_json (~> 1.0)
23
- multi_xml
24
- i18n (0.6.1)
25
- mime-types (1.19)
26
- multi_json (1.3.6)
27
- multi_xml (0.5.1)
28
- nokogiri (1.5.5)
20
+ hashie (1.0.0)
21
+ httparty (0.6.1)
22
+ crack (= 0.1.8)
23
+ i18n (0.6.0)
24
+ mime-types (1.17.2)
25
+ multi_json (1.0.4)
26
+ nokogiri (1.5.0)
29
27
  rest-client (1.6.7)
30
28
  mime-types (>= 1.16)
31
29
  rspec (2.7.0)
@@ -36,7 +34,7 @@ GEM
36
34
  rspec-expectations (2.7.0)
37
35
  diff-lcs (~> 1.1.2)
38
36
  rspec-mocks (2.7.0)
39
- terminal-table (1.4.5)
37
+ terminal-table (1.4.4)
40
38
 
41
39
  PLATFORMS
42
40
  ruby
@@ -12,7 +12,7 @@ Here's some examples to get you started with the Ruby API:
12
12
  require 'nagiosharder'
13
13
  site = NagiosHarder::Site.new('http://path/to/nagios/cgi/directory', 'user', 'password', 'version')
14
14
  # version defaults to 3
15
-
15
+
16
16
  # get details back about a host's services
17
17
  puts site.host_status('myhost')
18
18
 
@@ -20,28 +20,16 @@ Here's some examples to get you started with the Ruby API:
20
20
  site.schedule_host_check('myhost')
21
21
 
22
22
  # get details on all services
23
- site.service_status
24
-
25
- # or just things with problems
26
- site.service_status(
27
- :service_status_types => [
28
- :critical,
29
- :warning,
30
- :unknown
31
- ]
32
- )
33
-
34
- # or just muted services, sorted desc by duration
35
- site.service_status(
36
- :service_props => [
37
- :notifications_disabled,
38
- ],
39
- :sort_type => :descending,
40
- :sort_option => :state_duration,
41
- )
42
-
23
+ site.service_status(:all)
24
+ # or just services that have problems
25
+ site.service_status(:all_problems)
26
+ # (other valid symbols: :ok, :warning, :unknown, :critical, :pending, :all_problems)
27
+ # or make it sorted by duration, descending
28
+ site.service_status(:all_problem, :sort_option => :duration, :sort_type => :desc
29
+ # (other sort_options: :host, :service, :status, :last_check, :duration, :attempts)
30
+ # (other sort_types: :asc, :desc)
43
31
  # or get the details for a single service group
44
- site.service_status(:group => "AWESOME")
32
+ site.service_status(:all_problem, :group => "AWESOME")
45
33
 
46
34
  # schedule a host to have services checks run again right now
47
35
  site.schedule_service_check('myhost', 'myservice')
@@ -58,9 +46,6 @@ Here's some examples to get you started with the Ruby API:
58
46
  # or unacknowledge
59
47
  site.unacknowledge_service('myhost', 'myservice')
60
48
 
61
- # acknowledge a down service
62
- site.acknowledge_host('myhost', 'something bad happened')
63
-
64
49
  # disable notifications for a service:
65
50
  site.disable_service_notifications('myhost', 'myservice')
66
51
 
@@ -88,7 +73,7 @@ This will display all available commands.
88
73
 
89
74
 
90
75
  == Note on Patches/Pull Requests
91
-
76
+
92
77
  * Fork the project.
93
78
  * Make your feature addition or bug fix.
94
79
  * Add tests for it. This is important so I don't break it in a future version unintentionally.
@@ -4,6 +4,5 @@ begin
4
4
  exit NagiosHarder::Cli.new(ARGV).run
5
5
  rescue ArgumentError => e
6
6
  puts e.message
7
- puts e.backtrace.join("\n") if ENV['DEBUG']
8
7
  exit 1
9
8
  end
@@ -3,7 +3,6 @@ require 'nokogiri'
3
3
  require 'active_support' # fine, we'll just do all of activesupport instead of the parts I want. thank Rails 3 for shuffling requires around.
4
4
  require 'cgi'
5
5
  require 'hashie'
6
- require 'nagiosharder/filters'
7
6
 
8
7
  # :(
9
8
  require 'active_support/version' # double and triplely ensure ActiveSupport::VERSION is around
@@ -25,28 +24,25 @@ class NagiosHarder
25
24
  attr_accessor :nagios_url, :user, :password, :default_options, :default_cookies, :version, :nagios_time_format
26
25
  include HTTParty::ClassMethods
27
26
 
28
- def initialize(nagios_url, user, password, version = 3, nagios_time_format = nil)
27
+ def initialize(nagios_url, user, password, version = 3)
29
28
  @nagios_url = nagios_url.gsub(/\/$/, '')
30
29
  @user = user
31
30
  @password = password
32
31
  @default_options = {}
33
32
  @default_cookies = {}
34
33
  @version = version
35
- debug_output if ENV['DEBUG']
36
34
  basic_auth(@user, @password) if @user && @password
37
- @nagios_time_format = if nagios_time_format == 'us'
38
- "%m-%d-%Y %H:%M:%S"
39
- else
40
- if @version.to_i < 3
41
- "%m-%d-%Y %H:%M:%S"
42
- else
43
- "%Y-%m-%d %H:%M:%S"
44
- end
45
- end
46
- self
35
+
36
+ @nagios_time_format = if @version.to_i < 3
37
+ "%m-%d-%Y %H:%M:%S"
38
+ else
39
+ "%Y-%m-%d %H:%M:%S"
40
+ end
47
41
  end
48
42
 
49
43
  def acknowledge_service(host, service, comment)
44
+ # extra options: sticky_arg, send_notification, persistent
45
+
50
46
  request = {
51
47
  :cmd_typ => 34,
52
48
  :cmd_mod => 2,
@@ -63,22 +59,6 @@ class NagiosHarder
63
59
  response.code == 200 && response.body =~ /successful/
64
60
  end
65
61
 
66
- def acknowledge_host(host, comment)
67
- request = {
68
- :cmd_typ => 33,
69
- :cmd_mod => 2,
70
- :com_author => @user,
71
- :com_data => comment,
72
- :host => host,
73
- :send_notification => true,
74
- :persistent => false,
75
- :sticky_ack => true
76
- }
77
-
78
- response = post(cmd_url, :body => request)
79
- response.code == 200 && response.body =~ /successful/
80
- end
81
-
82
62
  def unacknowledge_service(host, service)
83
63
  request = {
84
64
  :cmd_typ => 52,
@@ -190,42 +170,57 @@ class NagiosHarder
190
170
  response.code == 200 && response.body =~ /successful/
191
171
  end
192
172
 
193
- def service_status(options = {})
194
- params = {}
195
-
196
- {
197
- :host_status_types => :notification_host,
198
- :service_status_types => :notification_service,
199
- :sort_type => :sort,
200
- :sort_option => :sort,
201
- :host_props => :host,
202
- :service_props => :service,
203
- }.each do |key, val|
204
- if options[key] && (options[key].is_a?(Array) || options[key].is_a?(Symbol))
205
- params[key.to_s.gsub(/_/, '')] = Nagiosharder::Filters.value(val, *options[key])
206
- end
207
- end
208
-
209
- # if any of the standard filter params are already integers, those win
210
- %w(
211
- :hoststatustypes,
212
- :servicestatustypes,
213
- :sorttype,
214
- :sortoption,
215
- :hostprops,
216
- :serviceprops,
217
- ).each do |key|
218
- params[key.to_s] = options[:val] if !options[:val].nil? && options[:val].match(/^\d*$/)
219
- end
173
+ def service_status(type, options = {})
174
+ service_status_type = case type
175
+ when :ok then 2
176
+ when :warning then 4
177
+ when :unknown then 8
178
+ when :critical then 16
179
+ when :pending then 1
180
+ when :all_problems then 28
181
+ when :all then nil
182
+ else
183
+ raise "Unknown type"
184
+ end
185
+
186
+ sort_type = case options[:sort_type]
187
+ when :asc then 1
188
+ when :desc then 2
189
+ when nil then nil
190
+ else
191
+ raise "Invalid options[:sort_type]"
192
+ end
193
+
194
+ sort_option = case options[:sort_option]
195
+ when :host then 1
196
+ when :service then 2
197
+ when :status then 3
198
+ when :last_check then 4
199
+ when :duration then 6
200
+ when :attempts then 5
201
+ when nil then nil
202
+ else
203
+ raise "Invalid options[:sort_option]"
204
+ end
205
+
206
+ service_group = options[:group]
207
+
208
+
209
+ params = {
210
+ 'hoststatustype' => options[:hoststatustype] || 15,
211
+ 'servicestatustypes' => options[:servicestatustypes] || service_status_type,
212
+ 'sorttype' => options[:sorttype] || sort_type,
213
+ 'sortoption' => options[:sortoption] || sort_option,
214
+ 'hoststatustypes' => options[:hoststatustypes],
215
+ 'serviceprops' => options[:serviceprops]
216
+ }
220
217
 
221
218
  if @version == 3
222
- params['servicegroup'] = options[:group] || 'all'
219
+ params['servicegroup'] = service_group || 'all'
223
220
  params['style'] = 'detail'
224
- params['embedded'] = '1'
225
- params['noheader'] = '1'
226
221
  else
227
- if options[:group]
228
- params['servicegroup'] = options[:group]
222
+ if service_group
223
+ params['servicegroup'] = service_group
229
224
  params['style'] = 'detail'
230
225
  else
231
226
  params['host'] = 'all'
@@ -247,7 +242,7 @@ class NagiosHarder
247
242
  end
248
243
 
249
244
  def host_status(host)
250
- host_status_url = "#{status_url}?host=#{host}&embedded=1&noheader=1"
245
+ host_status_url = "#{status_url}?host=#{host}"
251
246
  response = get(host_status_url)
252
247
 
253
248
  raise "wtf #{host_status_url}? #{response.code}" unless response.code == 200
@@ -344,7 +339,6 @@ class NagiosHarder
344
339
  columns = Nokogiri::HTML(row.inner_html).css('body > td').to_a
345
340
  if columns.any?
346
341
 
347
- # Host column
348
342
  host = columns[0].inner_text.gsub(/\n/, '')
349
343
 
350
344
  # for a given host, the host details are blank after the first row
@@ -355,9 +349,7 @@ class NagiosHarder
355
349
  # or save it for later
356
350
  host = last_host
357
351
  end
358
- debug 'parsed host column'
359
352
 
360
- # Service Column
361
353
  if columns[1]
362
354
  service_links = columns[1].css('td a')
363
355
  service_link, other_links = service_links[0], service_links[1..-1]
@@ -388,21 +380,13 @@ class NagiosHarder
388
380
 
389
381
  service = service_links[0].inner_html
390
382
  end
391
- debug 'parsed service column'
392
383
 
393
- # Status
394
384
  status = columns[2].inner_html if columns[2]
395
- debug 'parsed status column'
396
-
397
- # Last Check
398
385
  last_check = if columns[3] && columns[3].inner_html != 'N/A'
399
386
  last_check_str = columns[3].inner_html
400
- debug "Need to parse #{columns[3].inner_html} in #{nagios_time_format}"
387
+
401
388
  DateTime.strptime(columns[3].inner_html, nagios_time_format).to_s
402
389
  end
403
- debug 'parsed last check column'
404
-
405
- # Duration
406
390
  duration = columns[4].inner_html.squeeze(' ').gsub(/^ /, '') if columns[4]
407
391
  started_at = if duration && match_data = duration.match(/^\s*(\d+)d\s+(\d+)h\s+(\d+)m\s+(\d+)s\s*$/)
408
392
  (
@@ -412,16 +396,8 @@ class NagiosHarder
412
396
  match_data[4].to_i.seconds
413
397
  ).ago
414
398
  end
415
- debug 'parsed duration column'
416
-
417
- # Attempts
418
399
  attempts = columns[5].inner_html if columns[5]
419
- debug 'parsed attempts column'
420
-
421
- # Status info
422
- status_info = columns[6].inner_html.gsub('&nbsp;', '').gsub("\302\240", '') if columns[6]
423
- debug 'parsed status info column'
424
-
400
+ status_info = columns[6].inner_html.gsub('&nbsp;', '') if columns[6]
425
401
 
426
402
  if host && service && status && last_check && duration && attempts && started_at && status_info
427
403
  service_extinfo_url = "#{extinfo_url}?type=2&host=#{host}&service=#{CGI.escape(service)}"
@@ -451,9 +427,6 @@ class NagiosHarder
451
427
  nil
452
428
  end
453
429
 
454
- def debug(*args)
455
- $stderr.puts *args if ENV['DEBUG']
456
- end
457
-
458
430
  end
431
+
459
432
  end
@@ -23,12 +23,8 @@ class NagiosHarder
23
23
  end.map { |name, s| s }
24
24
  end
25
25
  true
26
- when /^(ack|acknowledged)$/
27
- if service.nil?
28
- client.acknowledge_host(host, the_rest.join(' '))
29
- else
30
- client.acknowledge_service(host, service, the_rest.join(' '))
31
- end
26
+ when /^ack/
27
+ client.acknowledge_service(host, service, the_rest.join(' '))
32
28
  when /^unack/
33
29
  client.unacknowledge_service(host, service)
34
30
  when /^(mute|disable_notifications)$/
@@ -49,82 +45,23 @@ class NagiosHarder
49
45
  end
50
46
  when 'problems'
51
47
  service_table do
52
- params = {
53
- :service_status_types => [:critical, :warning, :unknown],
54
- }
55
- params[:group] = param
56
- client.service_status(params)
57
- end
58
- true
59
- when /^(critical|warning|unknown)/
60
- service_table do
61
- params = {
62
- :service_status_types => [
63
- $1,
64
- ],
65
- :service_props => [
66
- :hard_state,
67
- :no_scheduled_downtime,
68
- :state_unacknowledged,
69
- :notifications_enabled
70
- ]
71
- }
72
- params[:group] = param
73
- client.service_status(params)
48
+ if param
49
+ client.service_status(:all_problems, :group => param)
50
+ else
51
+ client.service_status(:all_problems)
52
+ end
74
53
  end
75
54
  true
76
55
  when /^(triage|unhandled)/
77
56
  service_table do
78
- params = {
79
- :service_status_types => [
80
- :critical,
81
- :warning,
82
- :unknown
83
- ],
84
- :host_props => [
85
- :no_scheduled_downtime,
86
- :state_unacknowledged,
87
- :notifications_enabled
88
- ],
89
- :service_props => [
90
- :no_scheduled_downtime,
91
- :state_unacknowledged,
92
- :notifications_enabled
93
- ]
94
- }
95
- params[:group] = param
96
- client.service_status(params)
97
- end
98
- true
99
- when /^muted/
100
- service_table do
101
- params = {
102
- :service_props => [
103
- :notifications_disabled,
104
- ]
105
- }
106
- params[:group] = param
107
- client.service_status(params)
108
- end
109
- true
110
- when /^(acked|acknowledged)/
111
- service_table do
112
- params = {
113
- :service_status_types => [
114
- :critical,
115
- :warning,
116
- :unknown
117
- ],
118
- :service_props => [
119
- :state_acknowledged,
120
- ]
121
- }
122
- params[:group] = param
123
- client.service_status(params)
57
+ if param
58
+ client.service_status(:all_problems, :group => param, :hoststatustypes => 3, :serviceprops => 42, :servicestatustypes => 28)
59
+ else
60
+ client.service_status(:all_problems, :hoststatustypes => 3, :serviceprops => 42, :servicestatustypes => 28)
61
+ end
124
62
  end
125
63
  true
126
64
  else
127
- debug "'#{command}'"
128
65
  raise ArgumentError, help
129
66
  end
130
67
  if return_value
@@ -138,8 +75,7 @@ class NagiosHarder
138
75
  protected
139
76
 
140
77
  def client
141
- debug "loading client with options #{options.inspect}"
142
- @client ||= NagiosHarder::Site.new(options['nagios_url'], options['user'], options['password'], options['version'], options['time'])
78
+ @client ||= NagiosHarder::Site.new(options['nagios_url'], options['user'], options['password'], options['version'])
143
79
  end
144
80
 
145
81
  def parse_connection_options(argv)
@@ -170,12 +106,8 @@ class NagiosHarder
170
106
  options['nagios_url'] = nagios_url
171
107
  end
172
108
 
173
- opts.on( '-v', '--version [3]', 'Nagios version (2 or 3, defaults to 3)') do |version|
174
- options['version'] = version
175
- end
176
-
177
- opts.on( '-t', '--time [us|euro]', 'Nagios time format') do |time|
178
- options['time'] = time
109
+ opts.on( '-v', '--version [3]', 'Nagios version (2 or 3, defaults to 3)') do |nagios_url|
110
+ options['version'] = nagios_url
179
111
  end
180
112
 
181
113
  end
@@ -222,10 +154,6 @@ class NagiosHarder
222
154
  "\\1\\3\n")
223
155
  end
224
156
 
225
- def debug(*args)
226
- $stderr.puts *args if ENV['DEBUG']
227
- end
228
-
229
157
  def help
230
158
  help = <<-HELP
231
159
  NagiosHarder
@@ -242,8 +170,6 @@ COMMANDS:
242
170
  nagiosharder status aux1
243
171
  nagiosharder status aux1/http
244
172
 
245
- nagiosharder acknowledge aux1 [message]
246
-
247
173
  nagiosharder acknowledge aux1/http [message]
248
174
  nagiosharder ack aux1/http [message]
249
175
 
@@ -258,7 +184,7 @@ COMMANDS:
258
184
  nagiosharder unmute aux1/http
259
185
  nagiosharder enable_notifications aux1/http
260
186
 
261
- nagiosharder check aux1/http
187
+ nagios check aux1/http
262
188
 
263
189
  nagiosharder downtime aux1 15
264
190
  nagiosharder downtime aux1/http 15
@@ -266,12 +192,6 @@ COMMANDS:
266
192
  nagiosharder problems
267
193
  nagiosharder problems http-services
268
194
 
269
- nagiosharder acknowledged
270
- nagiosharder acked http-services
271
-
272
- nagiosharder muted
273
- nagiosharder muted http-services
274
-
275
195
  nagiosharder triage
276
196
  nagiosharder unhandled
277
197
  nagiosharder unhandled http-services
@@ -3,10 +3,10 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "nagiosharder"
6
- s.version = "0.4.0.rc1"
6
+ s.version = "0.4.0"
7
7
  s.platform = Gem::Platform::RUBY
8
- s.authors = ["Josh Nichols", "Jesse Newland"]
9
- s.email = ["josh@technicalpickles.com", "jesse@github.com"]
8
+ s.authors = ["Josh Nichols"]
9
+ s.email = ["josh@technicalpickles.com"]
10
10
  s.homepage = "http://github.com/railsmachine/nagiosharder"
11
11
  s.summary = %q{Nagios access at your ruby fingertips}
12
12
  s.description = %q{Nagios access at your ruby fingertips}
@@ -18,8 +18,8 @@ Gem::Specification.new do |s|
18
18
  s.add_dependency 'activesupport'
19
19
  s.add_dependency 'i18n'
20
20
  s.add_dependency 'terminal-table'
21
- s.add_dependency 'httparty', '~> 0.8.3'
22
- s.add_dependency 'hashie', '~> 1.2.0'
21
+ s.add_dependency 'httparty', '~> 0.6.1'
22
+ s.add_dependency 'hashie', '~> 1.0.0'
23
23
  s.add_development_dependency "rspec", ">= 1.2.9"
24
24
 
25
25
  s.files = `git ls-files`.split("\n")
metadata CHANGED
@@ -1,154 +1,153 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: nagiosharder
3
- version: !ruby/object:Gem::Version
4
- version: 0.4.0.rc1
5
- prerelease: 6
3
+ version: !ruby/object:Gem::Version
4
+ hash: 15
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 4
9
+ - 0
10
+ version: 0.4.0
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Josh Nichols
9
- - Jesse Newland
10
14
  autorequire:
11
15
  bindir: bin
12
16
  cert_chain: []
13
- date: 2012-10-22 00:00:00.000000000 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2012-01-23 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
16
22
  name: rest-client
17
- requirement: !ruby/object:Gem::Requirement
18
- none: false
19
- requirements:
20
- - - ~>
21
- - !ruby/object:Gem::Version
22
- version: 1.6.1
23
- type: :runtime
24
23
  prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
24
+ requirement: &id001 !ruby/object:Gem::Requirement
26
25
  none: false
27
- requirements:
26
+ requirements:
28
27
  - - ~>
29
- - !ruby/object:Gem::Version
28
+ - !ruby/object:Gem::Version
29
+ hash: 13
30
+ segments:
31
+ - 1
32
+ - 6
33
+ - 1
30
34
  version: 1.6.1
31
- - !ruby/object:Gem::Dependency
32
- name: nokogiri
33
- requirement: !ruby/object:Gem::Requirement
34
- none: false
35
- requirements:
36
- - - ! '>='
37
- - !ruby/object:Gem::Version
38
- version: '0'
39
35
  type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: nokogiri
40
39
  prerelease: false
41
- version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - ! '>='
45
- - !ruby/object:Gem::Version
46
- version: '0'
47
- - !ruby/object:Gem::Dependency
48
- name: activesupport
49
- requirement: !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
55
49
  type: :runtime
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: activesupport
56
53
  prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
- requirements:
60
- - - ! '>='
61
- - !ruby/object:Gem::Version
62
- version: '0'
63
- - !ruby/object:Gem::Dependency
64
- name: i18n
65
- requirement: !ruby/object:Gem::Requirement
66
- none: false
67
- requirements:
68
- - - ! '>='
69
- - !ruby/object:Gem::Version
70
- version: '0'
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
71
63
  type: :runtime
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: i18n
72
67
  prerelease: false
73
- version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
- requirements:
76
- - - ! '>='
77
- - !ruby/object:Gem::Version
78
- version: '0'
79
- - !ruby/object:Gem::Dependency
80
- name: terminal-table
81
- requirement: !ruby/object:Gem::Requirement
82
- none: false
83
- requirements:
84
- - - ! '>='
85
- - !ruby/object:Gem::Version
86
- version: '0'
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
87
77
  type: :runtime
78
+ version_requirements: *id004
79
+ - !ruby/object:Gem::Dependency
80
+ name: terminal-table
88
81
  prerelease: false
89
- version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
- requirements:
92
- - - ! '>='
93
- - !ruby/object:Gem::Version
94
- version: '0'
95
- - !ruby/object:Gem::Dependency
96
- name: httparty
97
- requirement: !ruby/object:Gem::Requirement
98
- none: false
99
- requirements:
100
- - - ~>
101
- - !ruby/object:Gem::Version
102
- version: 0.8.3
82
+ requirement: &id005 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
103
91
  type: :runtime
92
+ version_requirements: *id005
93
+ - !ruby/object:Gem::Dependency
94
+ name: httparty
104
95
  prerelease: false
105
- version_requirements: !ruby/object:Gem::Requirement
96
+ requirement: &id006 !ruby/object:Gem::Requirement
106
97
  none: false
107
- requirements:
98
+ requirements:
108
99
  - - ~>
109
- - !ruby/object:Gem::Version
110
- version: 0.8.3
111
- - !ruby/object:Gem::Dependency
112
- name: hashie
113
- requirement: !ruby/object:Gem::Requirement
114
- none: false
115
- requirements:
116
- - - ~>
117
- - !ruby/object:Gem::Version
118
- version: 1.2.0
100
+ - !ruby/object:Gem::Version
101
+ hash: 5
102
+ segments:
103
+ - 0
104
+ - 6
105
+ - 1
106
+ version: 0.6.1
119
107
  type: :runtime
108
+ version_requirements: *id006
109
+ - !ruby/object:Gem::Dependency
110
+ name: hashie
120
111
  prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
112
+ requirement: &id007 !ruby/object:Gem::Requirement
122
113
  none: false
123
- requirements:
114
+ requirements:
124
115
  - - ~>
125
- - !ruby/object:Gem::Version
126
- version: 1.2.0
127
- - !ruby/object:Gem::Dependency
116
+ - !ruby/object:Gem::Version
117
+ hash: 23
118
+ segments:
119
+ - 1
120
+ - 0
121
+ - 0
122
+ version: 1.0.0
123
+ type: :runtime
124
+ version_requirements: *id007
125
+ - !ruby/object:Gem::Dependency
128
126
  name: rspec
129
- requirement: !ruby/object:Gem::Requirement
130
- none: false
131
- requirements:
132
- - - ! '>='
133
- - !ruby/object:Gem::Version
134
- version: 1.2.9
135
- type: :development
136
127
  prerelease: false
137
- version_requirements: !ruby/object:Gem::Requirement
138
- none: false
139
- requirements:
140
- - - ! '>='
141
- - !ruby/object:Gem::Version
128
+ requirement: &id008 !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ hash: 13
134
+ segments:
135
+ - 1
136
+ - 2
137
+ - 9
142
138
  version: 1.2.9
139
+ type: :development
140
+ version_requirements: *id008
143
141
  description: Nagios access at your ruby fingertips
144
- email:
142
+ email:
145
143
  - josh@technicalpickles.com
146
- - jesse@github.com
147
- executables:
144
+ executables:
148
145
  - nagiosharder
149
146
  extensions: []
147
+
150
148
  extra_rdoc_files: []
151
- files:
149
+
150
+ files:
152
151
  - .document
153
152
  - .gitignore
154
153
  - Gemfile
@@ -159,30 +158,40 @@ files:
159
158
  - bin/nagiosharder
160
159
  - lib/nagiosharder.rb
161
160
  - lib/nagiosharder/cli.rb
162
- - lib/nagiosharder/filters.rb
163
161
  - nagiosharder.gemspec
162
+ has_rdoc: true
164
163
  homepage: http://github.com/railsmachine/nagiosharder
165
164
  licenses: []
165
+
166
166
  post_install_message:
167
167
  rdoc_options: []
168
- require_paths:
168
+
169
+ require_paths:
169
170
  - lib
170
- required_ruby_version: !ruby/object:Gem::Requirement
171
+ required_ruby_version: !ruby/object:Gem::Requirement
171
172
  none: false
172
- requirements:
173
- - - ! '>='
174
- - !ruby/object:Gem::Version
175
- version: '0'
176
- required_rubygems_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ hash: 3
177
+ segments:
178
+ - 0
179
+ version: "0"
180
+ required_rubygems_version: !ruby/object:Gem::Requirement
177
181
  none: false
178
- requirements:
179
- - - ! '>'
180
- - !ruby/object:Gem::Version
181
- version: 1.3.1
182
+ requirements:
183
+ - - ">="
184
+ - !ruby/object:Gem::Version
185
+ hash: 3
186
+ segments:
187
+ - 0
188
+ version: "0"
182
189
  requirements: []
190
+
183
191
  rubyforge_project: nagiosharder
184
- rubygems_version: 1.8.23
192
+ rubygems_version: 1.4.2
185
193
  signing_key:
186
194
  specification_version: 3
187
195
  summary: Nagios access at your ruby fingertips
188
196
  test_files: []
197
+
@@ -1,140 +0,0 @@
1
- module Nagiosharder
2
- module Filters
3
-
4
- # irb> Nagiosharder::Filters.value(:host)
5
- # => 0
6
- # irb> Nagiosharder::Filters.value(:host, :state_acknowledged)
7
- # => 4
8
- # irb> Nagiosharder::Filters.value(:host, :state_acknowledged, :checks_disabled)
9
- # => 20
10
- def self.value(type, *args)
11
- args.each.inject(0) do |i, arg|
12
- begin
13
- i += const_get("#{type}_#{arg}".upcase)
14
- rescue NameError
15
- i
16
- end
17
- end
18
- end
19
-
20
- #/********************* EXTENDED INFO CGI DISPLAY TYPES *********************/
21
-
22
- DISPLAY_PROCESS_INFO=0
23
- DISPLAY_HOST_INFO=1
24
- DISPLAY_SERVICE_INFO=2
25
- DISPLAY_COMMENTS=3
26
- DISPLAY_PERFORMANCE=4
27
- DISPLAY_HOSTGROUP_INFO=5
28
- DISPLAY_DOWNTIME=6
29
- DISPLAY_SCHEDULING_QUEUE=7
30
- DISPLAY_SERVICEGROUP_INFO=8
31
-
32
-
33
- #/************************ COMMAND CGI COMMAND MODES *************************/
34
-
35
- CMDMODE_NONE=0
36
- CMDMODE_REQUEST=1
37
- CMDMODE_COMMIT=2
38
-
39
-
40
-
41
- #/******************** HOST AND SERVICE NOTIFICATION TYPES ******************/
42
-
43
- NOTIFICATION_ALL=0 #/* all service and host notifications */
44
- NOTIFICATION_SERVICE_ALL=1 #/* all types of service notifications */
45
- NOTIFICATION_HOST_ALL=2 #/* all types of host notifications */
46
- NOTIFICATION_SERVICE_WARNING=4
47
- NOTIFICATION_SERVICE_UNKNOWN=8
48
- NOTIFICATION_SERVICE_CRITICAL=16
49
- NOTIFICATION_SERVICE_RECOVERY=32
50
- NOTIFICATION_HOST_DOWN=64
51
- NOTIFICATION_HOST_UNREACHABLE=128
52
- NOTIFICATION_HOST_RECOVERY=256
53
- NOTIFICATION_SERVICE_ACK=512
54
- NOTIFICATION_HOST_ACK=1024
55
- NOTIFICATION_SERVICE_FLAP=2048
56
- NOTIFICATION_HOST_FLAP=4096
57
- NOTIFICATION_SERVICE_CUSTOM=8192
58
- NOTIFICATION_HOST_CUSTOM=16384
59
-
60
-
61
- #/********************** HOST AND SERVICE ALERT TYPES **********************/
62
-
63
- HISTORY_ALL=0 #/* all service and host alert */
64
- HISTORY_SERVICE_ALL=1 #/* all types of service alerts */
65
- HISTORY_HOST_ALL=2 #/* all types of host alerts */
66
- HISTORY_SERVICE_WARNING=4
67
- HISTORY_SERVICE_UNKNOWN=8
68
- HISTORY_SERVICE_CRITICAL=16
69
- HISTORY_SERVICE_RECOVERY=32
70
- HISTORY_HOST_DOWN=64
71
- HISTORY_HOST_UNREACHABLE=128
72
- HISTORY_HOST_RECOVERY=256
73
-
74
-
75
- #/****************************** SORT TYPES *******************************/
76
-
77
- SORT_NONE=0
78
- SORT_ASCENDING=1
79
- SORT_DESCENDING=2
80
-
81
-
82
- #/***************************** SORT OPTIONS ******************************/
83
-
84
- SORT_NOTHING=0
85
- SORT_HOSTNAME=1
86
- SORT_SERVICENAME=2
87
- SORT_SERVICESTATUS=3
88
- SORT_LASTCHECKTIME=4
89
- SORT_CURRENTATTEMPT=5
90
- SORT_STATEDURATION=6
91
- SORT_NEXTCHECKTIME=7
92
- SORT_HOSTSTATUS=8
93
- SORT_HOSTURGENCY=9
94
-
95
-
96
- #/****************** HOST AND SERVICE FILTER PROPERTIES *******************/
97
-
98
- HOST_SCHEDULED_DOWNTIME=1
99
- HOST_NO_SCHEDULED_DOWNTIME=2
100
- HOST_STATE_ACKNOWLEDGED=4
101
- HOST_STATE_UNACKNOWLEDGED=8
102
- HOST_CHECKS_DISABLED=16
103
- HOST_CHECKS_ENABLED=32
104
- HOST_EVENT_HANDLER_DISABLED=64
105
- HOST_EVENT_HANDLER_ENABLED=128
106
- HOST_FLAP_DETECTION_DISABLED=256
107
- HOST_FLAP_DETECTION_ENABLED=512
108
- HOST_IS_FLAPPING=1024
109
- HOST_IS_NOT_FLAPPING=2048
110
- HOST_NOTIFICATIONS_DISABLED=4096
111
- HOST_NOTIFICATIONS_ENABLED=8192
112
- HOST_PASSIVE_CHECKS_DISABLED=16384
113
- HOST_PASSIVE_CHECKS_ENABLED=32768
114
- HOST_PASSIVE_CHECK=65536
115
- HOST_ACTIVE_CHECK=131072
116
- HOST_HARD_STATE=262144
117
- HOST_SOFT_STATE=524288
118
-
119
- SERVICE_SCHEDULED_DOWNTIME=1
120
- SERVICE_NO_SCHEDULED_DOWNTIME=2
121
- SERVICE_STATE_ACKNOWLEDGED=4
122
- SERVICE_STATE_UNACKNOWLEDGED=8
123
- SERVICE_CHECKS_DISABLED=16
124
- SERVICE_CHECKS_ENABLED=32
125
- SERVICE_EVENT_HANDLER_DISABLED=64
126
- SERVICE_EVENT_HANDLER_ENABLED=128
127
- SERVICE_FLAP_DETECTION_ENABLED=256
128
- SERVICE_FLAP_DETECTION_DISABLED=512
129
- SERVICE_IS_FLAPPING=1024
130
- SERVICE_IS_NOT_FLAPPING=2048
131
- SERVICE_NOTIFICATIONS_DISABLED=4096
132
- SERVICE_NOTIFICATIONS_ENABLED=8192
133
- SERVICE_PASSIVE_CHECKS_DISABLED=16384
134
- SERVICE_PASSIVE_CHECKS_ENABLED=32768
135
- SERVICE_PASSIVE_CHECK=65536
136
- SERVICE_ACTIVE_CHECK=131072
137
- SERVICE_HARD_STATE=262144
138
- SERVICE_SOFT_STATE=524288
139
- end
140
- end