sensu 0.6.8-x86-mswin32 → 0.6.9-x86-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.org +13 -46
- data/lib/sensu/api.rb +0 -0
- data/lib/sensu/client.rb +2 -2
- data/lib/sensu/server.rb +61 -22
- data/lib/sensu.rb +1 -1
- data/sensu-logo.png +0 -0
- metadata +62 -102
data/.gitignore
CHANGED
data/README.org
CHANGED
@@ -1,61 +1,28 @@
|
|
1
1
|
* Welcome to Sensu
|
2
|
-
Sensu is a monitoring system framework
|
2
|
+
Sensu is a monitoring system framework.
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
Check results are handled by user created handlers.
|
4
|
+
[[https://github.com/sonian/sensu/raw/master/sensu-logo.png]]
|
7
5
|
|
8
|
-
|
6
|
+
Checks can utilize user created plugins, returning an exit status code and outputting to STDOUT.
|
9
7
|
|
8
|
+
Check results are handled by user created handlers, receiving JSON formatted event data from STDIN.
|
9
|
+
* Documentation
|
10
|
+
Documentation can be found [[https://github.com/sonian/sensu/wiki][HERE]].
|
10
11
|
* License
|
11
12
|
Sensu is released under the [[https://github.com/sonian/sensu/blob/master/MIT-LICENSE.txt][MIT license]].
|
12
|
-
|
13
13
|
* Contributing
|
14
14
|
- [[http://help.github.com/fork-a-repo/][Fork]] [[https://github.com/sonian/sensu][Sensu]]
|
15
15
|
- Use a [[https://github.com/dchelimsky/rspec/wiki/Topic-Branches][topic branch]]
|
16
16
|
- Create a [[http://help.github.com/send-pull-requests/][pull request]]
|
17
17
|
|
18
18
|
Keep it simple.
|
19
|
-
|
20
|
-
** Readme Driven Development
|
21
|
-
*** A Client Will
|
22
|
-
- Have a set of attributes to describe it, including its responsibilities
|
23
|
-
- Send keep-alives to a server
|
24
|
-
- Subscribe to a queue bound to a set of fanout exchanges, determined by its responsibilities
|
25
|
-
- Substitute tokens in check commands with their matching client attribute
|
26
|
-
- Report when it does not have a client attribute for token substitution
|
27
|
-
- Receive checks from subscriptions, execute them, and publish the results to a queue with its client name
|
28
|
-
- Not allow overlapping check executions of the same name
|
29
|
-
- Report when it is unaware of a check it received from a subscription
|
30
|
-
|
31
|
-
*** A Server Will
|
32
|
-
- Subscribe to a queue for check results, another for keep-alives
|
33
|
-
- Pull keep-alives, storing client details
|
34
|
-
- Publish checks on defined intervals to their associated fanout exchanges
|
35
|
-
- Pull check results, storing the latest events for clients, a good result will flush a previous event for that client
|
36
|
-
- Create an event when it stops receiving keep-alives from a client, a new keep-alive for the client will clear the event
|
37
|
-
- Trigger a event handler, either the default handler or one specified for the check, providing it with a JSON event file
|
38
|
-
|
39
|
-
*** An API Will
|
40
|
-
- List all current events
|
41
|
-
- List all clients and their attributes
|
42
|
-
- Show a client and its attributes
|
43
|
-
- Remove a client and resolve associated events
|
44
|
-
|
45
|
-
*** A Plugin Will
|
46
|
-
- Output to STDOUT
|
47
|
-
- Return a valid exit status code
|
48
|
-
|
49
|
-
*** A Handler Will
|
50
|
-
- Accept a command line argument "-f", for an event file path
|
51
|
-
- Parse the JSON event file
|
52
|
-
- Handle the event as it wishes
|
53
|
-
|
54
19
|
** Testing
|
55
20
|
*** Requirements
|
56
|
-
- RabbitMQ
|
57
|
-
- Redis
|
58
|
-
|
59
|
-
|
60
|
-
|
21
|
+
- RabbitMQ
|
22
|
+
- Redis
|
23
|
+
*** Running
|
24
|
+
: bundle install
|
61
25
|
: rake test
|
26
|
+
* Contributors
|
27
|
+
- Sean Porter ([[https://twitter.com/#!/portertech][@portertech]])
|
28
|
+
- Justin Kolberg ([[https://twitter.com/#!/amdprophet][@amdprophet]])
|
data/lib/sensu/api.rb
CHANGED
File without changes
|
data/lib/sensu/client.rb
CHANGED
@@ -8,7 +8,7 @@ module Sensu
|
|
8
8
|
client.setup_amqp
|
9
9
|
client.setup_keepalives
|
10
10
|
client.setup_subscriptions
|
11
|
-
client.
|
11
|
+
client.setup_queue_monitor
|
12
12
|
|
13
13
|
Signal.trap('INT') do
|
14
14
|
EM.stop
|
@@ -90,7 +90,7 @@ module Sensu
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
def
|
93
|
+
def setup_queue_monitor
|
94
94
|
EM.add_periodic_timer(5) do
|
95
95
|
unless @check_queue.subscribed?
|
96
96
|
@check_queue.delete
|
data/lib/sensu/server.rb
CHANGED
@@ -19,7 +19,7 @@ module Sensu
|
|
19
19
|
server.setup_publisher
|
20
20
|
server.setup_keepalive_monitor
|
21
21
|
end
|
22
|
-
server.
|
22
|
+
server.setup_queue_monitor
|
23
23
|
|
24
24
|
Signal.trap('INT') do
|
25
25
|
EM.stop
|
@@ -83,29 +83,68 @@ module Sensu
|
|
83
83
|
unless client_json.nil?
|
84
84
|
client = JSON.parse(client_json)
|
85
85
|
check = result['check']
|
86
|
-
|
86
|
+
if @settings['checks'][check['name']]
|
87
|
+
check.merge!(@settings['checks'][check['name']])
|
88
|
+
end
|
87
89
|
check['handler'] ||= 'default'
|
88
90
|
event = {'client' => client, 'check' => check, 'occurrences' => 1}
|
89
91
|
if check['type'] == 'metric'
|
90
92
|
handle_event(event)
|
91
93
|
else
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
94
|
+
history_key = 'history:' + client['name'] + ':' + check['name']
|
95
|
+
@redis.rpush(history_key, check['status']).callback do
|
96
|
+
@redis.lrange(history_key, -21, -1).callback do |history|
|
97
|
+
total_state_change = 0
|
98
|
+
unless history.count < 21
|
99
|
+
state_changes = 0
|
100
|
+
change_weight = 0.8
|
101
|
+
history.each do |status|
|
102
|
+
previous_status ||= status
|
103
|
+
unless status == previous_status
|
104
|
+
state_changes += change_weight
|
105
|
+
end
|
106
|
+
change_weight += 0.02
|
107
|
+
previous_status = status
|
108
|
+
end
|
109
|
+
total_state_change = (state_changes.fdiv(20) * 100).to_i
|
110
|
+
@redis.lpop(history_key)
|
101
111
|
end
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
112
|
+
high_flap_threshold = check['high_flap_threshold'] || 50
|
113
|
+
low_flap_threshold = check['low_flap_threshold'] || 40
|
114
|
+
@redis.hget('events:' + client['name'], check['name']).callback do |event_json|
|
115
|
+
previous_event = event_json ? JSON.parse(event_json) : false
|
116
|
+
flapping = previous_event ? previous_event['flapping'] : false
|
117
|
+
check['flapping'] = case
|
118
|
+
when total_state_change >= high_flap_threshold
|
119
|
+
true
|
120
|
+
when flapping && total_state_change <= low_flap_threshold
|
121
|
+
false
|
122
|
+
else
|
123
|
+
flapping
|
124
|
+
end
|
125
|
+
if previous_event && check['status'] == 0
|
126
|
+
unless check['flapping']
|
127
|
+
@redis.hdel('events:' + client['name'], check['name']).callback do
|
128
|
+
event['action'] = 'resolve'
|
129
|
+
handle_event(event)
|
130
|
+
end
|
131
|
+
else
|
132
|
+
@redis.hset('events:' + client['name'], check['name'], previous_event.merge({'flapping' => true}).to_json)
|
133
|
+
end
|
134
|
+
elsif check['status'] != 0
|
135
|
+
if previous_event && check['status'] == previous_event['status']
|
136
|
+
event['occurrences'] = previous_event['occurrences'] += 1
|
137
|
+
end
|
138
|
+
@redis.hset('events:' + client['name'], check['name'], {
|
139
|
+
'status' => check['status'],
|
140
|
+
'output' => check['output'],
|
141
|
+
'flapping' => check['flapping'],
|
142
|
+
'occurrences' => event['occurrences']
|
143
|
+
}.to_json).callback do
|
144
|
+
event['action'] = 'create'
|
145
|
+
handle_event(event)
|
146
|
+
end
|
147
|
+
end
|
109
148
|
end
|
110
149
|
end
|
111
150
|
end
|
@@ -153,17 +192,17 @@ module Sensu
|
|
153
192
|
when time_since_last_check >= 180
|
154
193
|
result['check']['status'] = 2
|
155
194
|
result['check']['output'] = 'No keep-alive sent from host in over 180 seconds'
|
156
|
-
|
195
|
+
process_result(result)
|
157
196
|
when time_since_last_check >= 120
|
158
197
|
result['check']['status'] = 1
|
159
198
|
result['check']['output'] = 'No keep-alive sent from host in over 120 seconds'
|
160
|
-
|
199
|
+
process_result(result)
|
161
200
|
else
|
162
201
|
@redis.hexists('events:' + client_id, 'keepalive').callback do |exists|
|
163
202
|
if exists == 1
|
164
203
|
result['check']['status'] = 0
|
165
204
|
result['check']['output'] = 'Keep-alive sent from host'
|
166
|
-
|
205
|
+
process_result(result)
|
167
206
|
end
|
168
207
|
end
|
169
208
|
end
|
@@ -173,7 +212,7 @@ module Sensu
|
|
173
212
|
end
|
174
213
|
end
|
175
214
|
|
176
|
-
def
|
215
|
+
def setup_queue_monitor
|
177
216
|
EM.add_periodic_timer(5) do
|
178
217
|
unless @keepalive_queue.subscribed?
|
179
218
|
setup_keepalives
|
data/lib/sensu.rb
CHANGED
data/sensu-logo.png
ADDED
Binary file
|
metadata
CHANGED
@@ -1,114 +1,83 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 6
|
9
|
-
- 8
|
10
|
-
version: 0.6.8
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.6.9
|
5
|
+
prerelease:
|
11
6
|
platform: x86-mswin32
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Sean Porter
|
14
9
|
- Justin Kolberg
|
15
10
|
autorequire:
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
dependencies:
|
22
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2011-10-13 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
23
16
|
name: eventmachine
|
24
|
-
|
25
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &70216286357220 !ruby/object:Gem::Requirement
|
26
18
|
none: false
|
27
|
-
requirements:
|
28
|
-
- -
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
hash: 124392917
|
31
|
-
segments:
|
32
|
-
- 1
|
33
|
-
- 0
|
34
|
-
- 0
|
35
|
-
- beta
|
36
|
-
- 4
|
37
|
-
- 1
|
19
|
+
requirements:
|
20
|
+
- - =
|
21
|
+
- !ruby/object:Gem::Version
|
38
22
|
version: 1.0.0.beta.4.1
|
39
23
|
type: :runtime
|
40
|
-
version_requirements: *id001
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: amqp
|
43
24
|
prerelease: false
|
44
|
-
|
25
|
+
version_requirements: *70216286357220
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: amqp
|
28
|
+
requirement: &70216286356720 !ruby/object:Gem::Requirement
|
45
29
|
none: false
|
46
|
-
requirements:
|
47
|
-
- -
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
hash: 11
|
50
|
-
segments:
|
51
|
-
- 0
|
52
|
-
- 7
|
53
|
-
- 4
|
30
|
+
requirements:
|
31
|
+
- - =
|
32
|
+
- !ruby/object:Gem::Version
|
54
33
|
version: 0.7.4
|
55
34
|
type: :runtime
|
56
|
-
version_requirements: *id002
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: json
|
59
35
|
prerelease: false
|
60
|
-
|
36
|
+
version_requirements: *70216286356720
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: json
|
39
|
+
requirement: &70216286356340 !ruby/object:Gem::Requirement
|
61
40
|
none: false
|
62
|
-
requirements:
|
63
|
-
- -
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
|
66
|
-
segments:
|
67
|
-
- 0
|
68
|
-
version: "0"
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
69
45
|
type: :runtime
|
70
|
-
version_requirements: *id003
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: uuidtools
|
73
46
|
prerelease: false
|
74
|
-
|
47
|
+
version_requirements: *70216286356340
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: uuidtools
|
50
|
+
requirement: &70216286355880 !ruby/object:Gem::Requirement
|
75
51
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
|
80
|
-
segments:
|
81
|
-
- 0
|
82
|
-
version: "0"
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
83
56
|
type: :runtime
|
84
|
-
version_requirements: *id004
|
85
|
-
- !ruby/object:Gem::Dependency
|
86
|
-
name: em-syslog
|
87
57
|
prerelease: false
|
88
|
-
|
58
|
+
version_requirements: *70216286355880
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: em-syslog
|
61
|
+
requirement: &70216286355460 !ruby/object:Gem::Requirement
|
89
62
|
none: false
|
90
|
-
requirements:
|
91
|
-
- -
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
|
94
|
-
segments:
|
95
|
-
- 0
|
96
|
-
version: "0"
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
97
67
|
type: :runtime
|
98
|
-
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *70216286355460
|
99
70
|
description: A server monitoring framework using the publish-subscribe model
|
100
|
-
email:
|
71
|
+
email:
|
101
72
|
- sean.porter@sonian.net
|
102
73
|
- justin.kolberg@sonian.net
|
103
|
-
executables:
|
74
|
+
executables:
|
104
75
|
- sensu-api
|
105
76
|
- sensu-client
|
106
77
|
- sensu-server
|
107
78
|
extensions: []
|
108
|
-
|
109
79
|
extra_rdoc_files: []
|
110
|
-
|
111
|
-
files:
|
80
|
+
files:
|
112
81
|
- .gitignore
|
113
82
|
- Gemfile
|
114
83
|
- Gemfile.lock
|
@@ -124,41 +93,32 @@ files:
|
|
124
93
|
- lib/sensu/config.rb
|
125
94
|
- lib/sensu/helpers.rb
|
126
95
|
- lib/sensu/server.rb
|
96
|
+
- sensu-logo.png
|
127
97
|
- sensu.gemspec
|
128
98
|
- sensu.windows
|
129
|
-
has_rdoc: true
|
130
99
|
homepage: https://github.com/sonian/sensu
|
131
|
-
licenses:
|
100
|
+
licenses:
|
132
101
|
- MIT
|
133
102
|
post_install_message:
|
134
103
|
rdoc_options: []
|
135
|
-
|
136
|
-
require_paths:
|
104
|
+
require_paths:
|
137
105
|
- lib
|
138
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
139
107
|
none: false
|
140
|
-
requirements:
|
141
|
-
- -
|
142
|
-
- !ruby/object:Gem::Version
|
143
|
-
|
144
|
-
|
145
|
-
- 0
|
146
|
-
version: "0"
|
147
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
113
|
none: false
|
149
|
-
requirements:
|
150
|
-
- -
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
|
153
|
-
segments:
|
154
|
-
- 0
|
155
|
-
version: "0"
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
156
118
|
requirements: []
|
157
|
-
|
158
119
|
rubyforge_project:
|
159
|
-
rubygems_version: 1.
|
120
|
+
rubygems_version: 1.8.10
|
160
121
|
signing_key:
|
161
122
|
specification_version: 3
|
162
123
|
summary: A server monitoring framework
|
163
124
|
test_files: []
|
164
|
-
|