nagiosharder 0.4.0 → 0.5.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/Gemfile.lock +14 -12
- data/README.rdoc +26 -11
- data/bin/nagiosharder +1 -0
- data/lib/nagiosharder.rb +87 -60
- data/lib/nagiosharder/cli.rb +96 -16
- data/lib/nagiosharder/filters.rb +140 -0
- data/nagiosharder.gemspec +5 -5
- metadata +129 -138
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -3,8 +3,8 @@ PATH
|
|
3
3
|
specs:
|
4
4
|
nagiosharder (0.4.0)
|
5
5
|
activesupport
|
6
|
-
hashie (~> 1.
|
7
|
-
httparty (~> 0.
|
6
|
+
hashie (~> 1.2.0)
|
7
|
+
httparty (~> 0.8.3)
|
8
8
|
i18n
|
9
9
|
nokogiri
|
10
10
|
rest-client (~> 1.6.1)
|
@@ -13,17 +13,19 @@ PATH
|
|
13
13
|
GEM
|
14
14
|
remote: http://rubygems.org/
|
15
15
|
specs:
|
16
|
-
activesupport (3.
|
16
|
+
activesupport (3.2.8)
|
17
|
+
i18n (~> 0.6)
|
17
18
|
multi_json (~> 1.0)
|
18
|
-
crack (0.1.8)
|
19
19
|
diff-lcs (1.1.3)
|
20
|
-
hashie (1.
|
21
|
-
httparty (0.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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)
|
27
29
|
rest-client (1.6.7)
|
28
30
|
mime-types (>= 1.16)
|
29
31
|
rspec (2.7.0)
|
@@ -34,7 +36,7 @@ GEM
|
|
34
36
|
rspec-expectations (2.7.0)
|
35
37
|
diff-lcs (~> 1.1.2)
|
36
38
|
rspec-mocks (2.7.0)
|
37
|
-
terminal-table (1.4.
|
39
|
+
terminal-table (1.4.5)
|
38
40
|
|
39
41
|
PLATFORMS
|
40
42
|
ruby
|
data/README.rdoc
CHANGED
@@ -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,16 +20,28 @@ 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
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
+
|
31
43
|
# or get the details for a single service group
|
32
|
-
site.service_status(:
|
44
|
+
site.service_status(:group => "AWESOME")
|
33
45
|
|
34
46
|
# schedule a host to have services checks run again right now
|
35
47
|
site.schedule_service_check('myhost', 'myservice')
|
@@ -46,6 +58,9 @@ Here's some examples to get you started with the Ruby API:
|
|
46
58
|
# or unacknowledge
|
47
59
|
site.unacknowledge_service('myhost', 'myservice')
|
48
60
|
|
61
|
+
# acknowledge a down service
|
62
|
+
site.acknowledge_host('myhost', 'something bad happened')
|
63
|
+
|
49
64
|
# disable notifications for a service:
|
50
65
|
site.disable_service_notifications('myhost', 'myservice')
|
51
66
|
|
@@ -73,7 +88,7 @@ This will display all available commands.
|
|
73
88
|
|
74
89
|
|
75
90
|
== Note on Patches/Pull Requests
|
76
|
-
|
91
|
+
|
77
92
|
* Fork the project.
|
78
93
|
* Make your feature addition or bug fix.
|
79
94
|
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
data/bin/nagiosharder
CHANGED
data/lib/nagiosharder.rb
CHANGED
@@ -3,6 +3,7 @@ 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'
|
6
7
|
|
7
8
|
# :(
|
8
9
|
require 'active_support/version' # double and triplely ensure ActiveSupport::VERSION is around
|
@@ -24,25 +25,28 @@ class NagiosHarder
|
|
24
25
|
attr_accessor :nagios_url, :user, :password, :default_options, :default_cookies, :version, :nagios_time_format
|
25
26
|
include HTTParty::ClassMethods
|
26
27
|
|
27
|
-
def initialize(nagios_url, user, password, version = 3)
|
28
|
+
def initialize(nagios_url, user, password, version = 3, nagios_time_format = nil)
|
28
29
|
@nagios_url = nagios_url.gsub(/\/$/, '')
|
29
30
|
@user = user
|
30
31
|
@password = password
|
31
32
|
@default_options = {}
|
32
33
|
@default_cookies = {}
|
33
34
|
@version = version
|
35
|
+
debug_output if ENV['DEBUG']
|
34
36
|
basic_auth(@user, @password) if @user && @password
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
41
47
|
end
|
42
48
|
|
43
49
|
def acknowledge_service(host, service, comment)
|
44
|
-
# extra options: sticky_arg, send_notification, persistent
|
45
|
-
|
46
50
|
request = {
|
47
51
|
:cmd_typ => 34,
|
48
52
|
:cmd_mod => 2,
|
@@ -59,6 +63,22 @@ class NagiosHarder
|
|
59
63
|
response.code == 200 && response.body =~ /successful/
|
60
64
|
end
|
61
65
|
|
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
|
+
|
62
82
|
def unacknowledge_service(host, service)
|
63
83
|
request = {
|
64
84
|
:cmd_typ => 52,
|
@@ -170,57 +190,42 @@ class NagiosHarder
|
|
170
190
|
response.code == 200 && response.body =~ /successful/
|
171
191
|
end
|
172
192
|
|
173
|
-
def service_status(
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
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
|
-
}
|
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
|
217
220
|
|
218
221
|
if @version == 3
|
219
|
-
params['servicegroup'] =
|
222
|
+
params['servicegroup'] = options[:group] || 'all'
|
220
223
|
params['style'] = 'detail'
|
224
|
+
params['embedded'] = '1'
|
225
|
+
params['noheader'] = '1'
|
221
226
|
else
|
222
|
-
if
|
223
|
-
params['servicegroup'] =
|
227
|
+
if options[:group]
|
228
|
+
params['servicegroup'] = options[:group]
|
224
229
|
params['style'] = 'detail'
|
225
230
|
else
|
226
231
|
params['host'] = 'all'
|
@@ -242,7 +247,7 @@ class NagiosHarder
|
|
242
247
|
end
|
243
248
|
|
244
249
|
def host_status(host)
|
245
|
-
host_status_url = "#{status_url}?host=#{host}"
|
250
|
+
host_status_url = "#{status_url}?host=#{host}&embedded=1&noheader=1"
|
246
251
|
response = get(host_status_url)
|
247
252
|
|
248
253
|
raise "wtf #{host_status_url}? #{response.code}" unless response.code == 200
|
@@ -339,6 +344,7 @@ class NagiosHarder
|
|
339
344
|
columns = Nokogiri::HTML(row.inner_html).css('body > td').to_a
|
340
345
|
if columns.any?
|
341
346
|
|
347
|
+
# Host column
|
342
348
|
host = columns[0].inner_text.gsub(/\n/, '')
|
343
349
|
|
344
350
|
# for a given host, the host details are blank after the first row
|
@@ -349,7 +355,9 @@ class NagiosHarder
|
|
349
355
|
# or save it for later
|
350
356
|
host = last_host
|
351
357
|
end
|
358
|
+
debug 'parsed host column'
|
352
359
|
|
360
|
+
# Service Column
|
353
361
|
if columns[1]
|
354
362
|
service_links = columns[1].css('td a')
|
355
363
|
service_link, other_links = service_links[0], service_links[1..-1]
|
@@ -380,13 +388,21 @@ class NagiosHarder
|
|
380
388
|
|
381
389
|
service = service_links[0].inner_html
|
382
390
|
end
|
391
|
+
debug 'parsed service column'
|
383
392
|
|
393
|
+
# Status
|
384
394
|
status = columns[2].inner_html if columns[2]
|
395
|
+
debug 'parsed status column'
|
396
|
+
|
397
|
+
# Last Check
|
385
398
|
last_check = if columns[3] && columns[3].inner_html != 'N/A'
|
386
399
|
last_check_str = columns[3].inner_html
|
387
|
-
|
400
|
+
debug "Need to parse #{columns[3].inner_html} in #{nagios_time_format}"
|
388
401
|
DateTime.strptime(columns[3].inner_html, nagios_time_format).to_s
|
389
402
|
end
|
403
|
+
debug 'parsed last check column'
|
404
|
+
|
405
|
+
# Duration
|
390
406
|
duration = columns[4].inner_html.squeeze(' ').gsub(/^ /, '') if columns[4]
|
391
407
|
started_at = if duration && match_data = duration.match(/^\s*(\d+)d\s+(\d+)h\s+(\d+)m\s+(\d+)s\s*$/)
|
392
408
|
(
|
@@ -396,8 +412,16 @@ class NagiosHarder
|
|
396
412
|
match_data[4].to_i.seconds
|
397
413
|
).ago
|
398
414
|
end
|
415
|
+
debug 'parsed duration column'
|
416
|
+
|
417
|
+
# Attempts
|
399
418
|
attempts = columns[5].inner_html if columns[5]
|
400
|
-
|
419
|
+
debug 'parsed attempts column'
|
420
|
+
|
421
|
+
# Status info
|
422
|
+
status_info = columns[6].inner_html.gsub(' ', '').gsub("\302\240", '') if columns[6]
|
423
|
+
debug 'parsed status info column'
|
424
|
+
|
401
425
|
|
402
426
|
if host && service && status && last_check && duration && attempts && started_at && status_info
|
403
427
|
service_extinfo_url = "#{extinfo_url}?type=2&host=#{host}&service=#{CGI.escape(service)}"
|
@@ -427,6 +451,9 @@ class NagiosHarder
|
|
427
451
|
nil
|
428
452
|
end
|
429
453
|
|
430
|
-
|
454
|
+
def debug(*args)
|
455
|
+
$stderr.puts *args if ENV['DEBUG']
|
456
|
+
end
|
431
457
|
|
458
|
+
end
|
432
459
|
end
|
data/lib/nagiosharder/cli.rb
CHANGED
@@ -23,8 +23,12 @@ class NagiosHarder
|
|
23
23
|
end.map { |name, s| s }
|
24
24
|
end
|
25
25
|
true
|
26
|
-
when /^ack
|
27
|
-
|
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
|
28
32
|
when /^unack/
|
29
33
|
client.unacknowledge_service(host, service)
|
30
34
|
when /^(mute|disable_notifications)$/
|
@@ -45,23 +49,82 @@ class NagiosHarder
|
|
45
49
|
end
|
46
50
|
when 'problems'
|
47
51
|
service_table do
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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)
|
53
74
|
end
|
54
75
|
true
|
55
76
|
when /^(triage|unhandled)/
|
56
77
|
service_table do
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
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)
|
62
124
|
end
|
63
125
|
true
|
64
126
|
else
|
127
|
+
debug "'#{command}'"
|
65
128
|
raise ArgumentError, help
|
66
129
|
end
|
67
130
|
if return_value
|
@@ -75,7 +138,8 @@ class NagiosHarder
|
|
75
138
|
protected
|
76
139
|
|
77
140
|
def client
|
78
|
-
|
141
|
+
debug "loading client with options #{options.inspect}"
|
142
|
+
@client ||= NagiosHarder::Site.new(options['nagios_url'], options['user'], options['password'], options['version'], options['time'])
|
79
143
|
end
|
80
144
|
|
81
145
|
def parse_connection_options(argv)
|
@@ -106,8 +170,12 @@ class NagiosHarder
|
|
106
170
|
options['nagios_url'] = nagios_url
|
107
171
|
end
|
108
172
|
|
109
|
-
opts.on( '-v', '--version [3]', 'Nagios version (2 or 3, defaults to 3)') do |
|
110
|
-
options['version'] =
|
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
|
111
179
|
end
|
112
180
|
|
113
181
|
end
|
@@ -154,6 +222,10 @@ class NagiosHarder
|
|
154
222
|
"\\1\\3\n")
|
155
223
|
end
|
156
224
|
|
225
|
+
def debug(*args)
|
226
|
+
$stderr.puts *args if ENV['DEBUG']
|
227
|
+
end
|
228
|
+
|
157
229
|
def help
|
158
230
|
help = <<-HELP
|
159
231
|
NagiosHarder
|
@@ -170,6 +242,8 @@ COMMANDS:
|
|
170
242
|
nagiosharder status aux1
|
171
243
|
nagiosharder status aux1/http
|
172
244
|
|
245
|
+
nagiosharder acknowledge aux1 [message]
|
246
|
+
|
173
247
|
nagiosharder acknowledge aux1/http [message]
|
174
248
|
nagiosharder ack aux1/http [message]
|
175
249
|
|
@@ -184,7 +258,7 @@ COMMANDS:
|
|
184
258
|
nagiosharder unmute aux1/http
|
185
259
|
nagiosharder enable_notifications aux1/http
|
186
260
|
|
187
|
-
|
261
|
+
nagiosharder check aux1/http
|
188
262
|
|
189
263
|
nagiosharder downtime aux1 15
|
190
264
|
nagiosharder downtime aux1/http 15
|
@@ -192,6 +266,12 @@ COMMANDS:
|
|
192
266
|
nagiosharder problems
|
193
267
|
nagiosharder problems http-services
|
194
268
|
|
269
|
+
nagiosharder acknowledged
|
270
|
+
nagiosharder acked http-services
|
271
|
+
|
272
|
+
nagiosharder muted
|
273
|
+
nagiosharder muted http-services
|
274
|
+
|
195
275
|
nagiosharder triage
|
196
276
|
nagiosharder unhandled
|
197
277
|
nagiosharder unhandled http-services
|
@@ -0,0 +1,140 @@
|
|
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
|
data/nagiosharder.gemspec
CHANGED
@@ -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.
|
6
|
+
s.version = "0.5.0.rc1"
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
|
-
s.authors = ["Josh Nichols"]
|
9
|
-
s.email = ["josh@technicalpickles.com"]
|
8
|
+
s.authors = ["Josh Nichols", "Jesse Newland"]
|
9
|
+
s.email = ["josh@technicalpickles.com", "jesse@github.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.
|
22
|
-
s.add_dependency 'hashie', '~> 1.
|
21
|
+
s.add_dependency 'httparty', '~> 0.8.3'
|
22
|
+
s.add_dependency 'hashie', '~> 1.2.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,153 +1,154 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: nagiosharder
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 4
|
9
|
-
- 0
|
10
|
-
version: 0.4.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0.rc1
|
5
|
+
prerelease: 6
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Josh Nichols
|
9
|
+
- Jesse Newland
|
14
10
|
autorequire:
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2012-10-22 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
22
16
|
name: rest-client
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
19
|
+
requirements:
|
27
20
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 13
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 6
|
33
|
-
- 1
|
21
|
+
- !ruby/object:Gem::Version
|
34
22
|
version: 1.6.1
|
35
23
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: nokogiri
|
39
24
|
prerelease: false
|
40
|
-
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
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'
|
49
39
|
type: :runtime
|
50
|
-
version_requirements: *id002
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: activesupport
|
53
40
|
prerelease: false
|
54
|
-
|
55
|
-
none: false
|
56
|
-
requirements:
|
57
|
-
- -
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
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'
|
63
55
|
type: :runtime
|
64
|
-
version_requirements: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: i18n
|
67
56
|
prerelease: false
|
68
|
-
|
69
|
-
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
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'
|
77
71
|
type: :runtime
|
78
|
-
version_requirements: *id004
|
79
|
-
- !ruby/object:Gem::Dependency
|
80
|
-
name: terminal-table
|
81
72
|
prerelease: false
|
82
|
-
|
83
|
-
none: false
|
84
|
-
requirements:
|
85
|
-
- -
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
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'
|
91
87
|
type: :runtime
|
92
|
-
version_requirements: *id005
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: httparty
|
95
88
|
prerelease: false
|
96
|
-
|
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
|
97
98
|
none: false
|
98
|
-
requirements:
|
99
|
+
requirements:
|
99
100
|
- - ~>
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
|
102
|
-
segments:
|
103
|
-
- 0
|
104
|
-
- 6
|
105
|
-
- 1
|
106
|
-
version: 0.6.1
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 0.8.3
|
107
103
|
type: :runtime
|
108
|
-
version_requirements: *id006
|
109
|
-
- !ruby/object:Gem::Dependency
|
110
|
-
name: hashie
|
111
104
|
prerelease: false
|
112
|
-
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.8.3
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: hashie
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
113
114
|
none: false
|
114
|
-
requirements:
|
115
|
+
requirements:
|
115
116
|
- - ~>
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
|
118
|
-
segments:
|
119
|
-
- 1
|
120
|
-
- 0
|
121
|
-
- 0
|
122
|
-
version: 1.0.0
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 1.2.0
|
123
119
|
type: :runtime
|
124
|
-
version_requirements: *id007
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rspec
|
127
120
|
prerelease: false
|
128
|
-
|
129
|
-
none: false
|
130
|
-
requirements:
|
131
|
-
- -
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ~>
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 1.2.0
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
name: rspec
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - ! '>='
|
133
|
+
- !ruby/object:Gem::Version
|
138
134
|
version: 1.2.9
|
139
135
|
type: :development
|
140
|
-
|
136
|
+
prerelease: false
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 1.2.9
|
141
143
|
description: Nagios access at your ruby fingertips
|
142
|
-
email:
|
144
|
+
email:
|
143
145
|
- josh@technicalpickles.com
|
144
|
-
|
146
|
+
- jesse@github.com
|
147
|
+
executables:
|
145
148
|
- nagiosharder
|
146
149
|
extensions: []
|
147
|
-
|
148
150
|
extra_rdoc_files: []
|
149
|
-
|
150
|
-
files:
|
151
|
+
files:
|
151
152
|
- .document
|
152
153
|
- .gitignore
|
153
154
|
- Gemfile
|
@@ -158,40 +159,30 @@ files:
|
|
158
159
|
- bin/nagiosharder
|
159
160
|
- lib/nagiosharder.rb
|
160
161
|
- lib/nagiosharder/cli.rb
|
162
|
+
- lib/nagiosharder/filters.rb
|
161
163
|
- nagiosharder.gemspec
|
162
|
-
has_rdoc: true
|
163
164
|
homepage: http://github.com/railsmachine/nagiosharder
|
164
165
|
licenses: []
|
165
|
-
|
166
166
|
post_install_message:
|
167
167
|
rdoc_options: []
|
168
|
-
|
169
|
-
require_paths:
|
168
|
+
require_paths:
|
170
169
|
- lib
|
171
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
170
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
172
171
|
none: false
|
173
|
-
requirements:
|
174
|
-
- -
|
175
|
-
- !ruby/object:Gem::Version
|
176
|
-
|
177
|
-
|
178
|
-
- 0
|
179
|
-
version: "0"
|
180
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - ! '>='
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
177
|
none: false
|
182
|
-
requirements:
|
183
|
-
- -
|
184
|
-
- !ruby/object:Gem::Version
|
185
|
-
|
186
|
-
segments:
|
187
|
-
- 0
|
188
|
-
version: "0"
|
178
|
+
requirements:
|
179
|
+
- - ! '>'
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: 1.3.1
|
189
182
|
requirements: []
|
190
|
-
|
191
183
|
rubyforge_project: nagiosharder
|
192
|
-
rubygems_version: 1.
|
184
|
+
rubygems_version: 1.8.23
|
193
185
|
signing_key:
|
194
186
|
specification_version: 3
|
195
187
|
summary: Nagios access at your ruby fingertips
|
196
188
|
test_files: []
|
197
|
-
|