sensu 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/sensu.rb +1 -1
- data/lib/sensu/config.rb +15 -16
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/lib/sensu.rb
CHANGED
data/lib/sensu/config.rb
CHANGED
@@ -13,6 +13,11 @@ module Sensu
|
|
13
13
|
attr_accessor :settings, :logger
|
14
14
|
|
15
15
|
def initialize(options={})
|
16
|
+
@logger = Cabin::Channel.new
|
17
|
+
log_dir = File.writable?('/var/log') ? '/var/log' : '/tmp'
|
18
|
+
ruby_logger = Logger.new(File.join(log_dir, 'sensu.log'))
|
19
|
+
@logger.subscribe(Cabin::Outputs::EmStdlibLogger.new(ruby_logger))
|
20
|
+
@logger.level = options[:verbose] ? 'debug' : 'info'
|
16
21
|
config_file = options[:config_file] || '/etc/sensu/config.json'
|
17
22
|
if File.readable?(config_file)
|
18
23
|
begin
|
@@ -23,11 +28,6 @@ module Sensu
|
|
23
28
|
else
|
24
29
|
invalid_config('configuration file does not exist or is not readable: ' + config_file)
|
25
30
|
end
|
26
|
-
@logger = Cabin::Channel.new
|
27
|
-
log_dir = File.writable?('/var/log') ? '/var/log' : '/tmp'
|
28
|
-
ruby_logger = Logger.new(File.join(log_dir, 'sensu.log'))
|
29
|
-
@logger.subscribe(Cabin::Outputs::EmStdlibLogger.new(ruby_logger))
|
30
|
-
@logger.level = options[:verbose] ? 'debug' : 'info'
|
31
31
|
validate_config(options['type'])
|
32
32
|
end
|
33
33
|
|
@@ -41,6 +41,15 @@ module Sensu
|
|
41
41
|
has_keys(%w[redis api])
|
42
42
|
when 'client'
|
43
43
|
has_keys(%w[client checks])
|
44
|
+
unless @settings.client.name.is_a?(String)
|
45
|
+
invalid_config('client must have a name')
|
46
|
+
end
|
47
|
+
unless @settings.client.address.is_a?(String)
|
48
|
+
invalid_config('client must have an address (ip or hostname)')
|
49
|
+
end
|
50
|
+
unless @settings.client.subscriptions.is_a?(Array) && @settings.client.subscriptions.count > 0
|
51
|
+
invalid_config('client must have subscriptions')
|
52
|
+
end
|
44
53
|
end
|
45
54
|
@settings.checks.each do |name, details|
|
46
55
|
unless details.interval.is_a?(Integer) && details.interval > 0
|
@@ -53,15 +62,6 @@ module Sensu
|
|
53
62
|
invalid_config('missing subscribers for check ' + name)
|
54
63
|
end
|
55
64
|
end
|
56
|
-
unless @settings.client.name.is_a?(String)
|
57
|
-
invalid_config('client must have a name')
|
58
|
-
end
|
59
|
-
unless @settings.client.address.is_a?(String)
|
60
|
-
invalid_config('client must have an address (ip or hostname)')
|
61
|
-
end
|
62
|
-
unless @settings.client.subscriptions.is_a?(Array) && @settings.client.subscriptions.count > 0
|
63
|
-
invalid_config('client must have subscriptions')
|
64
|
-
end
|
65
65
|
if type
|
66
66
|
@logger.debug('[config] -- configuration valid -- running ' + type)
|
67
67
|
puts 'configuration valid -- running ' + type
|
@@ -90,7 +90,6 @@ module Sensu
|
|
90
90
|
end
|
91
91
|
current_process = $0.split('/').last
|
92
92
|
if current_process == 'sensu-server' || current_process == 'rake'
|
93
|
-
options[:worker] = false
|
94
93
|
opts.on('-w', '--worker', 'Only consume jobs, no check publishing (default: false)') do
|
95
94
|
options[:worker] = true
|
96
95
|
end
|
@@ -98,7 +97,7 @@ module Sensu
|
|
98
97
|
opts.on('-c', '--config FILE', 'Sensu JSON config FILE (default: /etc/sensu/config.json)') do |file|
|
99
98
|
options[:config_file] = file
|
100
99
|
end
|
101
|
-
opts.on('-v', '--verbose', 'Enable verbose logging') do
|
100
|
+
opts.on('-v', '--verbose', 'Enable verbose logging (default: false)') do
|
102
101
|
options[:verbose] = true
|
103
102
|
end
|
104
103
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 53
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 5
|
10
|
+
version: 0.8.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sean Porter
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-11-
|
19
|
+
date: 2011-11-10 00:00:00 -08:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|